PluginProbe
FluentCart A New Era of eCommerce – Faster, Lighter, and Simpler / 1.5.0
FluentCart A New Era of eCommerce – Faster, Lighter, and Simpler v1.5.0
1.6.5 1.6.4 1.6.3 1.6.2 1.6.1 1.6.0 1.5.4 1.5.5 1.5.3 1.5.2 1.5.1 1.5.0 1.4.2 1.4.1 1.4.0 1.3.28 1.3.27 1.3.26 1.3.25 1.3.23 1.3.22 1.3.21 1.3.20 1.3.19 trunk All 48 releases
fluent-cart / assets / custom-payment-page.js

custom-payment-page.js in FluentCart A New Era of eCommerce – Faster, Lighter, and Simpler 1.5.0, at assets/custom-payment-page.js

4 lines 2.0 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 import{P as H}from"./chunks/payment-loader.js?ver=1.5.0";const l=jQuery;l(()=>{const a=window.fluentcart_checkout_info;a.baseUrl;const N=a.paymentMode,E=a.orderHash;a.rest_url;const J=a==null?void 0:a.rest.nonce;a.ajaxurl;const M=a.variationId;a.order_information_url;const $=a.custom_checkout_url,d=window.fluentcart.$t;let u=l(l("form[data-fluent-cart-checkout-page-checkout-form]")[0]);const m=async _=>{_!==void 0&&_.preventDefault();const n=jQuery(".fct-loader"),i=f.getPaymentMethod(),C=window["is_"+i+"_ready"];if(i!=="offline_payment"&&!C)return window.dispatchEvent(new CustomEvent("fluent_cart_validate_checkout_"+i)),!1;const b=$,h=new URLSearchParams(window.location.search);let j=h.get("license_key")||"",x=h.get("coupon")||"";return n.addClass("active"),await jQuery.post(b,{order_hash:E,mode:N,payment_method:i,variation_id:M,license_key:j,coupon:x,_wpnonce:J}).then(t=>{var o;return t.actionName==="custom"?window.dispatchEvent(new CustomEvent("fluent_cart_payment_next_action_"+t.nextAction,{detail:{response:t}})):t.redirect_to?((void 0).buttonState("order_processing",d("Please wait..."),(o=t.data)==null?void 0:o.buttonState),window.location.href=t==null?void 0:t.redirect_to):(t==null?void 0:t.status)==="failed"?alert((t==null?void 0:t.message)||d("Payment failed. Please try again.")):n.removeClass("active"),t}).catch(t=>{var o,y,w,v,k,g,P,S,O;if(n.removeClass("active"),!((y=(o=t==null?void 0:t.responseJSON)==null?void 0:o.data)!=null&&y.message)){if(!((w=t==null?void 0:t.responseJSON)!=null&&w.message)){if((k=(v=t==null?void 0:t.responseJSON)==null?void 0:v.data)!=null&&k.errors){const e=(P=(g=t==null?void 0:t.responseJSON)==null?void 0:g.data)==null?void 0:P.errors;let r="";for(const c in e)e.hasOwnProperty(c)&&(r+=`${c}: ${e[c]}
2 `)}else if((S=t==null?void 0:t.responseJSON)!=null&&S.errors){const e=(O=t==null?void 0:t.responseJSON)==null?void 0:O.errors;let r="";for(const c in e)e.hasOwnProperty(c)&&(r+=`${c}: ${e[c]}
3 `)}}}})};u.on("submit",m);const f=new H({form:u[0],orderHandler:m,customPayment:!0});f.load()});
4