| Server IP : 46.105.57.169 / Your IP : 216.73.216.144 Web Server : Apache System : Linux webd003.cluster120.gra.hosting.ovh.net 5.15.206-ovh-vps-grsec-zfs-classid #1 SMP Fri May 15 02:41:25 UTC 2026 x86_64 User : maitricfuz ( 93378) PHP Version : 8.4.10 Disable Function : _dyuweyrj4,_dyuweyrj4r,dl MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /home/maitricfuz/www/saint-martin-lg/media/com_smilepack/js/widgets/ |
Upload File : |
var TF_PayPal_Button=function(){function e(e){this.wrapper=e,this.elem=e.querySelector(".sp-paypal-button-inner"),this.config=JSON.parse(this.wrapper.dataset.config)}var n=e.prototype;return n.render=function(){var o=this,e={style:{layout:this.config.button_layout||"vertical",color:this.config.color||"gold",shape:this.config.corner_style||"rect",label:this.config.label||"paypal",disableMaxWidth:!0},onCancel:function(e){e=new CustomEvent("SPPayPalPaymentCancelled",{detail:{paypalData:e,paypalButtonConfig:o.config}});document.dispatchEvent(e),o.wrapper.dispatchEvent(e)},onError:function(e){o.showMessage("error",e.message)}};"horizontal"===e.style.layout&&(e.style.tagline=this.config.tagline),"onetime"===o.config.billing_cycle?(e.onApprove=function(t,e){return e.order.capture().then(function(e){var n=new CustomEvent("SPPayPalPaymentSuccess",{detail:{paypalData:t,paypalButtonConfig:o.config}});document.dispatchEvent(n),o.wrapper.dispatchEvent(n),"message"===o.config.action&&""!==o.config.success_message?(o.showMessage("success",o.config.success_message,t),o.hideButtons()):"redirect"===o.config.action&&""!==o.config.success_url&&o.redirectToURL(t)}).catch(function(e){o.showMessage("error",e.message)})},e.createOrder=function(e,n){var t=o.config.tax_rate||0,a=parseFloat(o.config.shipping_amount||0),i=parseFloat(o.config.billing_amount||0),t=i*t/100,s=o.config.currency||"USD",i={purchase_units:[{items:[{name:o.config.item_name||"",quantity:1,tax:{currency_code:s,value:t},unit_amount:{currency_code:s,value:i}}],amount:{value:i+t+a,breakdown:{item_total:{currency_code:s,value:i},shipping:{currency_code:s,value:a},tax_total:{currency_code:s,value:t}}}}]};return o.config.show_shipping_address||(i.application_context={shipping_preference:"NO_SHIPPING"}),n.order.create(i)}):(e.onApprove=function(e,n){var t=new CustomEvent("SPPayPalPaymentSuccess",{detail:{paypalData:e,paypalButtonConfig:o.config}});document.dispatchEvent(t),o.wrapper.dispatchEvent(t),"message"===o.config.action&&""!==o.config.success_message?(o.showMessage("success",o.config.success_message,e),o.hideButtons()):"redirect"===o.config.action&&""!==o.config.success_url&&o.redirectToURL(e)},e.createSubscription=function(e,n){return o.getPlanID().then(function(e){e={plan_id:e.plan_id};return o.config.show_shipping_address||(e.application_context={shipping_preference:"NO_SHIPPING"}),n.subscription.create(e)})}),paypal.Buttons(e).render(this.elem),this.wrapper.instance=this},n.getPlanID=function(){var s=this;return new Promise(function(n,t){var e=s.config.plan_id||"";if(e)return e;var a=s,e=s.config.root_url+"?option=com_ajax&format=raw&plugin=smilepack&task=Widgets&widget=PayPal&action=get_plan_id&"+s.config.token+"=1",i=new FormData;i.append("data",JSON.stringify(s.config)),fetch(e,{method:"POST",body:i}).then(function(e){return e.json()}).then(function(e){e.plan_id?(a.config.plan_id=e.plan_id,n(e)):t({error:!0,message:e.message})}).catch(function(e){t({error:!0,message:e.err})})})},n.showMessage=function(e,n,t){void 0===t&&(t={});var a=this.wrapper.querySelector(".sp-paypal-button--message");a.classList.remove("is-visible"),a.classList.remove("is-error"),a.classList.remove("is-success"),a.innerHTML="","success"==e?(a.classList.add("is-visible"),a.classList.add("is-success")):"error"===e&&(a.classList.add("is-visible"),a.classList.add("is-error")),n=this.replacePaymentSmartTags(n,t),a.innerHTML=n},n.redirectToURL=function(e){var n=this.config.success_url,n=this.replacePaymentSmartTags(n,e);window.location.href=n},n.replacePaymentSmartTags=function(e,n){return e=this.config.pro&&(n.orderID&&(e=e.replace(new RegExp("{this.order_id}","g"),n.orderID)),n.paymentSource&&(e=e.replace(new RegExp("{this.payment_source}","g"),n.paymentSource)),n.payerID&&(e=e.replace(new RegExp("{this.payer_id}","g"),n.payerID)),n.paymentID&&(e=e.replace(new RegExp("{this.payment_id}","g"),n.paymentID)),n.subscriptionID)?e.replace(new RegExp("{this.subscription_id}","g"),n.subscriptionID):e},n.hideButtons=function(){this.config.success_hide_payment_buttons&&this.elem.remove()},e}(),TF_PayPal_Button_Init=function(){function e(){this.init()}return e.prototype.init=function(){var e;window.paypal&&(e=document.querySelectorAll(".sp-paypal-button")).length&&e.forEach(function(e){new TF_PayPal_Button(e).render()})},e}();document.addEventListener("DOMContentLoaded",function(){new TF_PayPal_Button_Init});