- Theme: momentry (custom theme with REST API routes) - Plugins: code-snippets (contains all API proxies) - Languages: zh_TW translations - Excludes: cache, backups, uploads, logs
1 line
1.0 KiB
JavaScript
1 line
1.0 KiB
JavaScript
let WPFormsPaypalCommercePaymentHandler=window.WPFormsPaypalCommercePaymentHandler||(document,{processQueue(e){for(;0<e.length;)e.shift().initPaymentButton()},PaymentHandler:class{constructor(){this.$form=null,this.formOptions=null,this.type=null}init(e,t,r){this.$form=e,this.formOptions=t,this.type=r}validateBeforePayment(){return new Promise((e,t)=>{this.$form.find(".wpforms-paypal-commerce-error").remove(),(WPFormsUtils.triggerEvent(this.$form,"wpformsPayPalCommerceOnCheckoutClick",[this.$form]).isDefaultPrevented()?t:wpforms.amountTotalCalc(this.$form)?this.$form.validate().form()?e:t:(WPFormsPaypalCommerce.onError(this.$form,wpforms_paypal_commerce.i18n.empty_amount),t))()})}getFormOptions(){var e=this.$form.data("formid");return wpforms_paypal_commerce.payment_options[e]}getPayPalSDK(){return"single"===this.type?wpforms_paypal_single:wpforms_paypal_subscriptions}initPaymentButton(){throw new Error("initPaymentButton() must be implemented by subclass")}processPayment(e){throw new Error("processPayment() must be implemented by subclass")}}}); |