@bcc-code/payment-client 1.2.2 → 1.2.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/index.js +1 -1
- package/dist/components/index.mjs +184 -205
- package/dist/styles/adyen.css +1 -1
- package/package.json +1 -1
package/dist/components/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var S=Object.create;var P=Object.defineProperty;var w=Object.getOwnPropertyDescriptor;var V=Object.getOwnPropertyNames;var B=Object.getPrototypeOf,K=Object.prototype.hasOwnProperty;var R=(l,m,i,t)=>{if(m&&typeof m=="object"||typeof m=="function")for(let o of V(m))!K.call(l,o)&&o!==i&&P(l,o,{get:()=>m[o],enumerable:!(t=w(m,o))||t.enumerable});return l};var C=(l,m,i)=>(i=l!=null?S(B(l)):{},R(m||!l||!l.__esModule?P(i,"default",{value:l,enumerable:!0}):i,l));Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),A={class:"stripe-elements"},U={key:0,class:"elements-loading"},F={key:1,class:"elements-error"},I={key:2,class:"payment-button-container"},$=["disabled"],x=e.defineComponent({__name:"StripePayment",props:{paymentId:{},clientData:{default:void 0},clientKey:{default:void 0},amount:{},currency:{},publishableKey:{default:void 0},appearance:{default:void 0},showPayButton:{type:Boolean,default:!0},locale:{default:"en"},loader:{default:"auto"},returnUrl:{default:void 0}},emits:["submit","success","error","ready"],setup(l,{expose:m,emit:i}){const t=l,o=i,v=e.ref(),p=e.ref(!0),a=e.ref(!1),u=e.ref("");let y=null,b=null,f=null;const k=e.computed(()=>({EUR:"€",USD:"$",GBP:"£",CHF:"CHF",NOK:"kr",SEK:"kr",DKK:"kr",PLN:"zł",CZK:"Kč",HUF:"Ft"})[t.currency]||t.currency),E=e.computed(()=>t.amount.toFixed(2)),r=e.computed(()=>{if(t.clientData)try{const s=JSON.parse(t.clientData);return s.clientSecret||s.client_secret}catch{return}}),c=async()=>{if(!v.value)return;let s=t.publishableKey;if(!s&&t.clientData)try{const d=JSON.parse(t.clientData);s=d.publishableKey||d.publishable_key}catch{}if(!s){u.value="Publishable key is required",p.value=!1;return}try{p.value=!0,u.value="";const{loadStripe:d}=await import("@stripe/stripe-js");if(y=await d(s),!y)throw new Error("Failed to load Stripe");const n=r.value,D={appearance:t.appearance||{theme:"stripe",variables:{colorPrimary:"#0570de",colorBackground:"#ffffff",colorText:"#30313d",colorDanger:"#df1b41",fontFamily:'system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif',spacingUnit:"4px",borderRadius:"4px"}},loader:t.loader,locale:t.locale};n&&(D.clientSecret=n),b=y.elements(D),f=b.create("payment",{layout:"tabs",defaultValues:{billingDetails:{name:"",email:"",phone:""}}}),f.mount(v.value),f.on("ready",()=>{p.value=!1,o("ready")}),f.on("change",N=>{N.error?(u.value=N.error.message,o("error",N.error)):u.value=""})}catch(d){u.value=d instanceof Error?d.message:"Failed to initialize payment form",p.value=!1,o("error",d)}},h=async()=>{if(!(!y||!f)){a.value=!0,u.value="";try{const s=t.returnUrl||`${window.location.origin}/payment/return`,{error:d,paymentIntent:n}=await y.confirmPayment({elements:b,confirmParams:{return_url:s},redirect:"if_required"});d?(u.value=d.message||"Payment failed",o("error",d)):n?n.status==="succeeded"?o("success",{paymentIntent:n,status:"succeeded",message:"Payment completed successfully!"}):n.status==="processing"?o("success",{paymentIntent:n,status:"processing",message:"Payment is being processed..."}):o("submit",{paymentIntent:n,status:n.status}):o("submit",f)}catch(s){u.value=s instanceof Error?s.message:"Payment failed",o("error",s)}finally{a.value=!1}}},g=()=>{f&&(f.destroy(),f=null),b&&(b=null),y&&(y=null)};return e.onMounted(()=>{c()}),e.onUnmounted(()=>{g()}),e.watch(()=>t.currency,()=>{g(),c()}),e.watch([()=>t.publishableKey,()=>t.clientData],()=>{(t.publishableKey||t.clientData)&&(g(),c())}),m({destroyElements:g}),(s,d)=>(e.openBlock(),e.createElementBlock("div",A,[e.createElementVNode("div",{ref_key:"elementsContainer",ref:v,class:"elements-container"},null,512),p.value?(e.openBlock(),e.createElementBlock("div",U,[...d[0]||(d[0]=[e.createElementVNode("div",{class:"loading-spinner"},null,-1),e.createElementVNode("p",null,"Loading payment form...",-1)])])):e.createCommentVNode("",!0),u.value?(e.openBlock(),e.createElementBlock("div",F,[d[1]||(d[1]=e.createElementVNode("div",{class:"error-icon"}," ⚠️ ",-1)),e.createElementVNode("p",null,e.toDisplayString(u.value),1),e.createElementVNode("button",{class:"retry-btn",onClick:c}," Retry ")])):e.createCommentVNode("",!0),l.showPayButton&&!p.value&&!u.value?(e.openBlock(),e.createElementBlock("div",I,[e.createElementVNode("button",{disabled:a.value,class:"payment-button",onClick:h},e.toDisplayString(a.value?"Processing...":`Pay ${k.value}${E.value}`),9,$)])):e.createCommentVNode("",!0)]))}}),_=(l,m)=>{const i=l.__vccOpts||l;for(const[t,o]of m)i[t]=o;return i},M=_(x,[["__scopeId","data-v-adbdf3c5"]]),O=e.defineComponent({__name:"AdyenPayment",props:{paymentId:{},clientData:{},clientKey:{},environment:{},amount:{},currency:{},paymentData:{},onCancel:{type:Function}},emits:["submit","additionalDetails","error","ready","success"],setup(l,{emit:m}){const i=l,t=m,o=e.ref(null),v=()=>{if(!i.clientData)return console.error("No clientData provided"),null;try{const a=JSON.parse(i.clientData);return console.log("Parsed Adyen session data:",a),{id:a.id,sessionData:a.sessionData,amount:a.amount,reference:a.reference,returnUrl:a.returnUrl,merchantAccount:a.merchantAccount}}catch(a){return console.error("Failed to parse clientData:",a),null}},p=async()=>{var u;if(!i.clientKey||!o.value){console.error("Initialization failed: Missing clientKey or container.");return}const a=v();if(!a){console.error("Failed to parse session data"),t("error",new Error("Failed to parse session data"));return}try{const{AdyenCheckout:y,Card:b,ApplePay:f,GooglePay:k,Klarna:E,Blik:r,Dropin:c}=await import("@adyen/adyen-web"),h={environment:i.environment||"test",clientKey:i.clientKey,session:a,onPaymentCompleted:(n,D)=>{console.info("Payment Completed:",n,D),t("submit",n),n.resultCode==="Authorised"||n.resultCode==="Received"?(console.info("Payment Successful:",n),t("success",{status:"succeeded",message:"Payment completed successfully",resultCode:n.resultCode,pspReference:n.pspReference,paymentData:n})):n.resultCode==="Pending"?(console.info("Payment Pending:",n),t("success",{status:"processing",message:"Payment is being processed",resultCode:n.resultCode,pspReference:n.pspReference,paymentData:n})):(n.resultCode==="Refused"||n.resultCode==="Error")&&(console.error("Payment Failed:",n),t("error",{message:n.refusalReason||"Payment was declined",resultCode:n.resultCode,paymentData:n}))},onError:(n,D)=>{console.error("Adyen Error:",n.name,n.message,n.stack,D),t("error",n)}},g={showPayButton:!0,paymentMethodComponents:[b,f,k,E,r],paymentMethodsConfiguration:{card:{hasHolderName:!0,holderNameRequired:!0,billingAddressRequired:!1,enableStoreDetails:!1},applePay:{showPayButton:!0},googlePay:{showPayButton:!0},klarna:{useKlarnaWidget:!0},blik:{}}},s=await y(h);console.log("Adyen Checkout created:",s),console.log("Available payment methods from session:",(u=s.paymentMethodsResponse)==null?void 0:u.paymentMethods);const d=new c(s,g);console.log("Adyen Drop-in created with session payment methods"),o.value&&(d.mount(o.value),console.log("Adyen Drop-in mounted successfully"),t("ready"))}catch(y){console.error("Error creating Adyen Drop-in:",y),t("error",y)}};return e.onMounted(()=>{p()}),e.watch(()=>i.clientData,()=>{o.value&&(o.value.innerHTML="",p())}),(a,u)=>(e.openBlock(),e.createElementBlock("div",{ref_key:"dropinContainer",ref:o,class:"payment-dropin"},null,512))}}),H=_(O,[["__scopeId","data-v-ef2ec054"]]),T={class:"delayed-payment"},z={class:"payment-form"},L={class:"amount-display"},j={class:"amount-value"},q={key:0,class:"session-info"},J={key:0,class:"info-row"},G={class:"value"},W={key:1,class:"info-row"},X={class:"value"},Z={key:1,class:"error-message"},Q={class:"button-container"},Y=["disabled"],ee=e.defineComponent({__name:"DelayedPayment",props:{paymentId:{default:void 0},clientData:{default:void 0},amount:{},currency:{},tenantId:{default:void 0}},emits:["submit","success","error","ready"],setup(l,{expose:m,emit:i}){const t=l,o=i,v=e.ref(!1),p=e.ref(""),a=e.ref({}),u=e.computed(()=>({EUR:"€",USD:"$",GBP:"£",CHF:"CHF",NOK:"kr",SEK:"kr",DKK:"kr",PLN:"zł"})[t.currency]||t.currency),y=e.computed(()=>t.amount.toFixed(2)),b=e.computed(()=>a.value.transactionNumber&&a.value.confirmationUrl),f=()=>{if(!t.clientData){console.error("No clientData provided for delayed payment");return}try{const r=JSON.parse(t.clientData);console.log("Parsed delayed payment session data:",r),a.value={transactionNumber:r.transactionNumber,merchantReference:r.merchantReference,providerUid:r.providerUid,paymentId:r.paymentId,confirmationUrl:r.confirmationUrl},o("ready")}catch(r){console.error("Failed to parse clientData:",r),p.value="Invalid session data",o("error",r)}},k=async()=>{if(!(!b.value||v.value)){v.value=!0,p.value="";try{const r={provider:"delayed-payment",amount:t.amount,currency:t.currency,transactionNumber:a.value.transactionNumber,merchantReference:a.value.merchantReference,timestamp:new Date().toISOString()};if(o("submit",r),!a.value.confirmationUrl)throw new Error("Confirmation URL not provided");const c={"Content-Type":"application/json",Accept:"application/json"};t.tenantId&&(c["X-Tenant-ID"]=t.tenantId);const h=await fetch(a.value.confirmationUrl,{method:"POST",headers:c,credentials:"include"});if(!h.ok){const s=await h.json();throw new Error(s.message||"Failed to confirm payment")}const g=await h.json();o("success",{status:"succeeded",message:g.message,paymentId:g.paymentId,transactionNumber:a.value.transactionNumber})}catch(r){p.value=r instanceof Error?r.message:"Failed to confirm payment",o("error",r)}finally{v.value=!1}}},E=()=>{p.value=""};return e.onMounted(()=>{f()}),m({clearError:E}),(r,c)=>(e.openBlock(),e.createElementBlock("div",T,[e.createElementVNode("div",z,[c[4]||(c[4]=e.createElementVNode("div",{class:"info-section"},[e.createElementVNode("div",{class:"info-icon"}," 📄 "),e.createElementVNode("h3",{class:"info-title"}," Delayed Payment "),e.createElementVNode("p",{class:"info-description"}," Payment will be processed manually via invoice or bank transfer ")],-1)),e.createElementVNode("div",L,[c[0]||(c[0]=e.createElementVNode("span",{class:"amount-label"},"Amount to pay:",-1)),e.createElementVNode("span",j,e.toDisplayString(u.value)+e.toDisplayString(y.value),1)]),b.value?(e.openBlock(),e.createElementBlock("div",q,[a.value.transactionNumber?(e.openBlock(),e.createElementBlock("div",J,[c[1]||(c[1]=e.createElementVNode("span",{class:"label"},"Transaction Number:",-1)),e.createElementVNode("span",G,e.toDisplayString(a.value.transactionNumber),1)])):e.createCommentVNode("",!0),a.value.merchantReference?(e.openBlock(),e.createElementBlock("div",W,[c[2]||(c[2]=e.createElementVNode("span",{class:"label"},"Reference:",-1)),e.createElementVNode("span",X,e.toDisplayString(a.value.merchantReference),1)])):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0),p.value?(e.openBlock(),e.createElementBlock("div",Z,[c[3]||(c[3]=e.createElementVNode("div",{class:"error-icon"}," ⚠️ ",-1)),e.createElementVNode("p",null,e.toDisplayString(p.value),1)])):e.createCommentVNode("",!0),e.createElementVNode("div",Q,[e.createElementVNode("button",{disabled:v.value||!b.value,class:"submit-button",onClick:k},e.toDisplayString(v.value?"Processing...":`Confirm Payment ${u.value}${y.value}`),9,Y)])])]))}}),te=_(ee,[["__scopeId","data-v-ebc5d9c9"]]);exports.AdyenPayment=H;exports.DelayedPayment=te;exports.StripePayment=M;
|
|
1
|
+
"use strict";var N=Object.create;var S=Object.defineProperty;var w=Object.getOwnPropertyDescriptor;var B=Object.getOwnPropertyNames;var K=Object.getPrototypeOf,U=Object.prototype.hasOwnProperty;var A=(c,d,l,t)=>{if(d&&typeof d=="object"||typeof d=="function")for(let a of B(d))!U.call(c,a)&&a!==l&&S(c,a,{get:()=>d[a],enumerable:!(t=w(d,a))||t.enumerable});return c};var E=(c,d,l)=>(l=c!=null?N(K(c)):{},A(d||!c||!c.__esModule?S(l,"default",{value:c,enumerable:!0}):l,c));Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),F={class:"stripe-elements"},R={key:0,class:"elements-loading"},V={key:1,class:"elements-error"},I={key:2,class:"payment-button-container"},x=["disabled"],M=e.defineComponent({__name:"StripePayment",props:{paymentId:{},clientData:{default:void 0},clientKey:{default:void 0},amount:{},currency:{},publishableKey:{default:void 0},appearance:{default:void 0},showPayButton:{type:Boolean,default:!0},locale:{default:"en"},loader:{default:"auto"},returnUrl:{default:void 0}},emits:["submit","success","error","ready"],setup(c,{expose:d,emit:l}){const t=c,a=l,v=e.ref(),m=e.ref(!0),o=e.ref(!1),u=e.ref("");let p=null,b=null,f=null;const P=e.computed(()=>({EUR:"€",USD:"$",GBP:"£",CHF:"CHF",NOK:"kr",SEK:"kr",DKK:"kr",PLN:"zł",CZK:"Kč",HUF:"Ft"})[t.currency]||t.currency),k=e.computed(()=>t.amount.toFixed(2)),i=e.computed(()=>{if(t.clientData)try{const s=JSON.parse(t.clientData);return s.clientSecret||s.client_secret}catch{return}}),y=async()=>{if(!v.value)return;let s=t.publishableKey;if(!s&&t.clientData)try{const r=JSON.parse(t.clientData);s=r.publishableKey||r.publishable_key}catch{}if(!s){u.value="Publishable key is required",m.value=!1;return}try{m.value=!0,u.value="";const{loadStripe:r}=await import("@stripe/stripe-js");if(p=await r(s),!p)throw new Error("Failed to load Stripe");const n=i.value,D={appearance:t.appearance||{theme:"stripe",variables:{colorPrimary:"#0570de",colorBackground:"#ffffff",colorText:"#30313d",colorDanger:"#df1b41",fontFamily:'system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif',spacingUnit:"4px",borderRadius:"4px"}},loader:t.loader,locale:t.locale};n&&(D.clientSecret=n),b=p.elements(D),f=b.create("payment",{layout:"tabs",defaultValues:{billingDetails:{name:"",email:"",phone:""}}}),f.mount(v.value),f.on("ready",()=>{m.value=!1,a("ready")}),f.on("change",C=>{C.error?(u.value=C.error.message,a("error",C.error)):u.value=""})}catch(r){u.value=r instanceof Error?r.message:"Failed to initialize payment form",m.value=!1,a("error",r)}},h=async()=>{if(!(!p||!f)){o.value=!0,u.value="";try{const s=t.returnUrl||`${window.location.origin}/payment/return`,{error:r,paymentIntent:n}=await p.confirmPayment({elements:b,confirmParams:{return_url:s},redirect:"if_required"});r?(u.value=r.message||"Payment failed",a("error",r)):n?n.status==="succeeded"?a("success",{paymentIntent:n,status:"succeeded",message:"Payment completed successfully!"}):n.status==="processing"?a("success",{paymentIntent:n,status:"processing",message:"Payment is being processed..."}):a("submit",{paymentIntent:n,status:n.status}):a("submit",f)}catch(s){u.value=s instanceof Error?s.message:"Payment failed",a("error",s)}finally{o.value=!1}}},g=()=>{f&&(f.destroy(),f=null),b&&(b=null),p&&(p=null)};return e.onMounted(()=>{y()}),e.onUnmounted(()=>{g()}),e.watch(()=>t.currency,()=>{g(),y()}),e.watch([()=>t.publishableKey,()=>t.clientData],()=>{(t.publishableKey||t.clientData)&&(g(),y())}),d({destroyElements:g}),(s,r)=>(e.openBlock(),e.createElementBlock("div",F,[e.createElementVNode("div",{ref_key:"elementsContainer",ref:v,class:"elements-container"},null,512),m.value?(e.openBlock(),e.createElementBlock("div",R,[...r[0]||(r[0]=[e.createElementVNode("div",{class:"loading-spinner"},null,-1),e.createElementVNode("p",null,"Loading payment form...",-1)])])):e.createCommentVNode("",!0),u.value?(e.openBlock(),e.createElementBlock("div",V,[r[1]||(r[1]=e.createElementVNode("div",{class:"error-icon"}," ⚠️ ",-1)),e.createElementVNode("p",null,e.toDisplayString(u.value),1),e.createElementVNode("button",{class:"retry-btn",onClick:y}," Retry ")])):e.createCommentVNode("",!0),c.showPayButton&&!m.value&&!u.value?(e.openBlock(),e.createElementBlock("div",I,[e.createElementVNode("button",{disabled:o.value,class:"payment-button",onClick:h},e.toDisplayString(o.value?"Processing...":`Pay ${P.value}${k.value}`),9,x)])):e.createCommentVNode("",!0)]))}}),_=(c,d)=>{const l=c.__vccOpts||c;for(const[t,a]of d)l[t]=a;return l},$=_(M,[["__scopeId","data-v-adbdf3c5"]]),O=e.defineComponent({__name:"AdyenPayment",props:{paymentId:{},clientData:{},clientKey:{},environment:{},amount:{},currency:{},paymentData:{},onCancel:{type:Function}},emits:["submit","additionalDetails","error","ready","success"],setup(c,{emit:d}){const l=c,t=d,a=e.ref(null),v=()=>{if(!l.clientData)return console.error("No clientData provided"),null;try{const o=JSON.parse(l.clientData);return console.log("Parsed Adyen session data:",o),{id:o.id,sessionData:o.sessionData,amount:o.amount,reference:o.reference,returnUrl:o.returnUrl,merchantAccount:o.merchantAccount}}catch(o){return console.error("Failed to parse clientData:",o),null}},m=async()=>{var u;if(!l.clientKey||!a.value){console.error("Initialization failed: Missing clientKey or container.");return}const o=v();if(!o){console.error("Failed to parse session data"),t("error",new Error("Failed to parse session data"));return}try{const{AdyenCheckout:p,Card:b,ApplePay:f,GooglePay:P,Klarna:k,Blik:i,Dropin:y}=await import("@adyen/adyen-web"),h={environment:l.environment||"test",clientKey:l.clientKey,session:o,onPaymentCompleted:(n,D)=>{console.info("Payment Completed:",n,D),t("submit",n),n.resultCode==="Authorised"||n.resultCode==="Received"?(console.info("Payment Successful:",n),t("success",{status:"succeeded",message:"Payment completed successfully",resultCode:n.resultCode,pspReference:n.pspReference,paymentData:n})):n.resultCode==="Pending"?(console.info("Payment Pending:",n),t("success",{status:"processing",message:"Payment is being processed",resultCode:n.resultCode,pspReference:n.pspReference,paymentData:n})):(n.resultCode==="Refused"||n.resultCode==="Error")&&(console.error("Payment Failed:",n),t("error",{message:n.refusalReason||"Payment was declined",resultCode:n.resultCode,paymentData:n}))},onError:(n,D)=>{console.error("Adyen Error:",n.name,n.message,n.stack,D),t("error",n)}},g={showPayButton:!0,paymentMethodComponents:[b,f,P,k,i],paymentMethodsConfiguration:{card:{hasHolderName:!0,holderNameRequired:!0,billingAddressRequired:!1,enableStoreDetails:!1},applePay:{showPayButton:!0},googlePay:{showPayButton:!0},klarna:{useKlarnaWidget:!0},blik:{}}},s=await p(h);console.log("Adyen Checkout created:",s),console.log("Available payment methods from session:",(u=s.paymentMethodsResponse)==null?void 0:u.paymentMethods);const r=new y(s,g);console.log("Adyen Drop-in created with session payment methods"),a.value&&(r.mount(a.value),console.log("Adyen Drop-in mounted successfully"),t("ready"))}catch(p){console.error("Error creating Adyen Drop-in:",p),t("error",p)}};return e.onMounted(()=>{m()}),e.watch(()=>l.clientData,()=>{a.value&&(a.value.innerHTML="",m())}),(o,u)=>(e.openBlock(),e.createElementBlock("div",{ref_key:"dropinContainer",ref:a,class:"payment-dropin"},null,512))}}),H=_(O,[["__scopeId","data-v-ef2ec054"]]),T={class:"delayed-payment-card"},j=["disabled"],z={key:0,class:"mt-2 text-sm text-red-600"},q=e.defineComponent({__name:"DelayedPayment",props:{paymentId:{default:void 0},clientData:{default:void 0},amount:{},currency:{},tenantId:{default:void 0}},emits:["submit","success","error","ready"],setup(c,{expose:d,emit:l}){const t=c,a=l,v=e.ref(!1),m=e.ref(""),o=e.ref({}),u=e.computed(()=>({EUR:"€",USD:"$",GBP:"£",CHF:"CHF",NOK:"kr",SEK:"kr",DKK:"kr",PLN:"zł"})[t.currency]||t.currency),p=e.computed(()=>t.amount.toFixed(2)),b=e.computed(()=>o.value.transactionNumber&&o.value.confirmationUrl),f=()=>{if(!t.clientData){console.error("No clientData provided for delayed payment");return}try{const i=JSON.parse(t.clientData);o.value={transactionNumber:i.transactionNumber,merchantReference:i.merchantReference,providerUid:i.providerUid,paymentUid:i.paymentUid,confirmationUrl:i.confirmationUrl},a("ready")}catch(i){m.value="Invalid session data",a("error",i)}},P=async()=>{if(!(!b.value||v.value)){v.value=!0,m.value="";try{const i={provider:"delayed-payment",amount:t.amount,currency:t.currency,transactionNumber:o.value.transactionNumber,merchantReference:o.value.merchantReference,timestamp:new Date().toISOString()};a("submit",i);const y={"Content-Type":"application/json",Accept:"application/json"};t.tenantId&&(y["X-Tenant-ID"]=t.tenantId);const h=await fetch(o.value.confirmationUrl,{method:"POST",headers:y,credentials:"include"});if(!h.ok){let s="Failed to confirm payment";try{const r=await h.json();r&&typeof r=="object"&&"message"in r&&(s=r.message||s)}catch{try{const r=await h.text();r&&(s=r)}catch{}}throw new Error(s)}const g=await h.json();a("success",{status:"succeeded",message:g.message,paymentId:g.paymentId,transactionNumber:o.value.transactionNumber})}catch(i){m.value=i instanceof Error?i.message:"Failed to confirm payment",a("error",i)}finally{v.value=!1}}},k=()=>{m.value=""};return e.onMounted(()=>{f()}),d({clearError:k}),(i,y)=>(e.openBlock(),e.createElementBlock("div",T,[y[0]||(y[0]=e.createElementVNode("div",{class:"header-row"},[e.createElementVNode("span",{class:"header-icon"},"💳"),e.createElementVNode("span",{class:"header-title"},"Delayed payment")],-1)),y[1]||(y[1]=e.createElementVNode("div",{class:"header-description"}," Payment will be processed manually via invoice or bank transfer ",-1)),e.createElementVNode("button",{disabled:v.value||!b.value,class:"confirm-btn",onClick:P},e.toDisplayString(v.value?"Processing...":`Confirm payment ${p.value}${u.value}`),9,j),m.value?(e.openBlock(),e.createElementBlock("p",z,e.toDisplayString(m.value),1)):e.createCommentVNode("",!0)]))}}),L=_(q,[["__scopeId","data-v-5f2f9c67"]]);exports.AdyenPayment=H;exports.DelayedPayment=L;exports.StripePayment=$;
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
const
|
|
1
|
+
import { defineComponent as A, ref as g, computed as S, onMounted as F, onUnmounted as I, watch as U, createElementBlock as P, openBlock as _, createElementVNode as y, createCommentVNode as K, toDisplayString as E } from "vue";
|
|
2
|
+
const x = { class: "stripe-elements" }, B = {
|
|
3
3
|
key: 0,
|
|
4
4
|
class: "elements-loading"
|
|
5
|
-
},
|
|
5
|
+
}, $ = {
|
|
6
6
|
key: 1,
|
|
7
7
|
class: "elements-error"
|
|
8
|
-
},
|
|
8
|
+
}, M = {
|
|
9
9
|
key: 2,
|
|
10
10
|
class: "payment-button-container"
|
|
11
|
-
},
|
|
11
|
+
}, O = ["disabled"], H = /* @__PURE__ */ A({
|
|
12
12
|
__name: "StripePayment",
|
|
13
13
|
props: {
|
|
14
14
|
paymentId: {},
|
|
@@ -24,10 +24,10 @@ const $ = { class: "stripe-elements" }, B = {
|
|
|
24
24
|
returnUrl: { default: void 0 }
|
|
25
25
|
},
|
|
26
26
|
emits: ["submit", "success", "error", "ready"],
|
|
27
|
-
setup(
|
|
28
|
-
const e =
|
|
29
|
-
let
|
|
30
|
-
const
|
|
27
|
+
setup(v, { expose: D, emit: d }) {
|
|
28
|
+
const e = v, r = d, p = g(), l = g(!0), a = g(!1), i = g("");
|
|
29
|
+
let c = null, f = null, m = null;
|
|
30
|
+
const k = S(() => ({
|
|
31
31
|
EUR: "€",
|
|
32
32
|
USD: "$",
|
|
33
33
|
GBP: "£",
|
|
@@ -38,33 +38,33 @@ const $ = { class: "stripe-elements" }, B = {
|
|
|
38
38
|
PLN: "zł",
|
|
39
39
|
CZK: "Kč",
|
|
40
40
|
HUF: "Ft"
|
|
41
|
-
})[e.currency] || e.currency),
|
|
41
|
+
})[e.currency] || e.currency), w = S(() => e.amount.toFixed(2)), s = S(() => {
|
|
42
42
|
if (e.clientData)
|
|
43
43
|
try {
|
|
44
|
-
const
|
|
45
|
-
return
|
|
44
|
+
const o = JSON.parse(e.clientData);
|
|
45
|
+
return o.clientSecret || o.client_secret;
|
|
46
46
|
} catch {
|
|
47
47
|
return;
|
|
48
48
|
}
|
|
49
|
-
}),
|
|
49
|
+
}), u = async () => {
|
|
50
50
|
if (!p.value) return;
|
|
51
|
-
let
|
|
52
|
-
if (!
|
|
51
|
+
let o = e.publishableKey;
|
|
52
|
+
if (!o && e.clientData)
|
|
53
53
|
try {
|
|
54
|
-
const
|
|
55
|
-
|
|
54
|
+
const n = JSON.parse(e.clientData);
|
|
55
|
+
o = n.publishableKey || n.publishable_key;
|
|
56
56
|
} catch {
|
|
57
57
|
}
|
|
58
|
-
if (!
|
|
59
|
-
|
|
58
|
+
if (!o) {
|
|
59
|
+
i.value = "Publishable key is required", l.value = !1;
|
|
60
60
|
return;
|
|
61
61
|
}
|
|
62
62
|
try {
|
|
63
|
-
|
|
64
|
-
const { loadStripe:
|
|
65
|
-
if (
|
|
63
|
+
l.value = !0, i.value = "";
|
|
64
|
+
const { loadStripe: n } = await import("@stripe/stripe-js");
|
|
65
|
+
if (c = await n(o), !c)
|
|
66
66
|
throw new Error("Failed to load Stripe");
|
|
67
|
-
const t =
|
|
67
|
+
const t = s.value, C = {
|
|
68
68
|
appearance: e.appearance || {
|
|
69
69
|
theme: "stripe",
|
|
70
70
|
variables: {
|
|
@@ -80,7 +80,7 @@ const $ = { class: "stripe-elements" }, B = {
|
|
|
80
80
|
loader: e.loader,
|
|
81
81
|
locale: e.locale
|
|
82
82
|
};
|
|
83
|
-
t && (
|
|
83
|
+
t && (C.clientSecret = t), f = c.elements(C), m = f.create("payment", {
|
|
84
84
|
layout: "tabs",
|
|
85
85
|
defaultValues: {
|
|
86
86
|
billingDetails: {
|
|
@@ -89,86 +89,86 @@ const $ = { class: "stripe-elements" }, B = {
|
|
|
89
89
|
phone: ""
|
|
90
90
|
}
|
|
91
91
|
}
|
|
92
|
-
}),
|
|
93
|
-
|
|
94
|
-
}),
|
|
95
|
-
|
|
92
|
+
}), m.mount(p.value), m.on("ready", () => {
|
|
93
|
+
l.value = !1, r("ready");
|
|
94
|
+
}), m.on("change", (N) => {
|
|
95
|
+
N.error ? (i.value = N.error.message, r("error", N.error)) : i.value = "";
|
|
96
96
|
});
|
|
97
|
-
} catch (
|
|
98
|
-
|
|
97
|
+
} catch (n) {
|
|
98
|
+
i.value = n instanceof Error ? n.message : "Failed to initialize payment form", l.value = !1, r("error", n);
|
|
99
99
|
}
|
|
100
|
-
},
|
|
101
|
-
if (!(!
|
|
102
|
-
|
|
100
|
+
}, h = async () => {
|
|
101
|
+
if (!(!c || !m)) {
|
|
102
|
+
a.value = !0, i.value = "";
|
|
103
103
|
try {
|
|
104
|
-
const
|
|
104
|
+
const o = e.returnUrl || `${window.location.origin}/payment/return`, { error: n, paymentIntent: t } = await c.confirmPayment({
|
|
105
105
|
elements: f,
|
|
106
106
|
confirmParams: {
|
|
107
|
-
return_url:
|
|
107
|
+
return_url: o
|
|
108
108
|
},
|
|
109
109
|
redirect: "if_required"
|
|
110
110
|
});
|
|
111
|
-
|
|
111
|
+
n ? (i.value = n.message || "Payment failed", r("error", n)) : t ? t.status === "succeeded" ? r("success", {
|
|
112
112
|
paymentIntent: t,
|
|
113
113
|
status: "succeeded",
|
|
114
114
|
message: "Payment completed successfully!"
|
|
115
|
-
}) : t.status === "processing" ?
|
|
115
|
+
}) : t.status === "processing" ? r("success", {
|
|
116
116
|
paymentIntent: t,
|
|
117
117
|
status: "processing",
|
|
118
118
|
message: "Payment is being processed..."
|
|
119
|
-
}) :
|
|
120
|
-
} catch (
|
|
121
|
-
|
|
119
|
+
}) : r("submit", { paymentIntent: t, status: t.status }) : r("submit", m);
|
|
120
|
+
} catch (o) {
|
|
121
|
+
i.value = o instanceof Error ? o.message : "Payment failed", r("error", o);
|
|
122
122
|
} finally {
|
|
123
|
-
|
|
123
|
+
a.value = !1;
|
|
124
124
|
}
|
|
125
125
|
}
|
|
126
|
-
},
|
|
127
|
-
|
|
126
|
+
}, b = () => {
|
|
127
|
+
m && (m.destroy(), m = null), f && (f = null), c && (c = null);
|
|
128
128
|
};
|
|
129
|
-
return
|
|
130
|
-
|
|
129
|
+
return F(() => {
|
|
130
|
+
u();
|
|
131
131
|
}), I(() => {
|
|
132
|
-
|
|
133
|
-
}),
|
|
134
|
-
|
|
135
|
-
}),
|
|
136
|
-
(e.publishableKey || e.clientData) && (
|
|
137
|
-
}),
|
|
138
|
-
destroyElements:
|
|
139
|
-
}), (
|
|
140
|
-
|
|
132
|
+
b();
|
|
133
|
+
}), U(() => e.currency, () => {
|
|
134
|
+
b(), u();
|
|
135
|
+
}), U([() => e.publishableKey, () => e.clientData], () => {
|
|
136
|
+
(e.publishableKey || e.clientData) && (b(), u());
|
|
137
|
+
}), D({
|
|
138
|
+
destroyElements: b
|
|
139
|
+
}), (o, n) => (_(), P("div", x, [
|
|
140
|
+
y("div", {
|
|
141
141
|
ref_key: "elementsContainer",
|
|
142
142
|
ref: p,
|
|
143
143
|
class: "elements-container"
|
|
144
144
|
}, null, 512),
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
])])) :
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
145
|
+
l.value ? (_(), P("div", B, [...n[0] || (n[0] = [
|
|
146
|
+
y("div", { class: "loading-spinner" }, null, -1),
|
|
147
|
+
y("p", null, "Loading payment form...", -1)
|
|
148
|
+
])])) : K("", !0),
|
|
149
|
+
i.value ? (_(), P("div", $, [
|
|
150
|
+
n[1] || (n[1] = y("div", { class: "error-icon" }, " ⚠️ ", -1)),
|
|
151
|
+
y("p", null, E(i.value), 1),
|
|
152
|
+
y("button", {
|
|
153
153
|
class: "retry-btn",
|
|
154
|
-
onClick:
|
|
154
|
+
onClick: u
|
|
155
155
|
}, " Retry ")
|
|
156
|
-
])) :
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
disabled:
|
|
156
|
+
])) : K("", !0),
|
|
157
|
+
v.showPayButton && !l.value && !i.value ? (_(), P("div", M, [
|
|
158
|
+
y("button", {
|
|
159
|
+
disabled: a.value,
|
|
160
160
|
class: "payment-button",
|
|
161
|
-
onClick:
|
|
162
|
-
},
|
|
163
|
-
])) :
|
|
161
|
+
onClick: h
|
|
162
|
+
}, E(a.value ? "Processing..." : `Pay ${k.value}${w.value}`), 9, O)
|
|
163
|
+
])) : K("", !0)
|
|
164
164
|
]));
|
|
165
165
|
}
|
|
166
|
-
}),
|
|
167
|
-
const
|
|
168
|
-
for (const [e,
|
|
169
|
-
|
|
170
|
-
return
|
|
171
|
-
},
|
|
166
|
+
}), R = (v, D) => {
|
|
167
|
+
const d = v.__vccOpts || v;
|
|
168
|
+
for (const [e, r] of D)
|
|
169
|
+
d[e] = r;
|
|
170
|
+
return d;
|
|
171
|
+
}, V = /* @__PURE__ */ R(H, [["__scopeId", "data-v-adbdf3c5"]]), z = /* @__PURE__ */ A({
|
|
172
172
|
__name: "AdyenPayment",
|
|
173
173
|
props: {
|
|
174
174
|
paymentId: {},
|
|
@@ -181,41 +181,41 @@ const $ = { class: "stripe-elements" }, B = {
|
|
|
181
181
|
onCancel: { type: Function }
|
|
182
182
|
},
|
|
183
183
|
emits: ["submit", "additionalDetails", "error", "ready", "success"],
|
|
184
|
-
setup(
|
|
185
|
-
const
|
|
186
|
-
if (!
|
|
184
|
+
setup(v, { emit: D }) {
|
|
185
|
+
const d = v, e = D, r = g(null), p = () => {
|
|
186
|
+
if (!d.clientData)
|
|
187
187
|
return console.error("No clientData provided"), null;
|
|
188
188
|
try {
|
|
189
|
-
const
|
|
190
|
-
return console.log("Parsed Adyen session data:",
|
|
191
|
-
id:
|
|
192
|
-
sessionData:
|
|
193
|
-
amount:
|
|
194
|
-
reference:
|
|
195
|
-
returnUrl:
|
|
196
|
-
merchantAccount:
|
|
189
|
+
const a = JSON.parse(d.clientData);
|
|
190
|
+
return console.log("Parsed Adyen session data:", a), {
|
|
191
|
+
id: a.id,
|
|
192
|
+
sessionData: a.sessionData,
|
|
193
|
+
amount: a.amount,
|
|
194
|
+
reference: a.reference,
|
|
195
|
+
returnUrl: a.returnUrl,
|
|
196
|
+
merchantAccount: a.merchantAccount
|
|
197
197
|
};
|
|
198
|
-
} catch (
|
|
199
|
-
return console.error("Failed to parse clientData:",
|
|
198
|
+
} catch (a) {
|
|
199
|
+
return console.error("Failed to parse clientData:", a), null;
|
|
200
200
|
}
|
|
201
|
-
},
|
|
202
|
-
var
|
|
203
|
-
if (!
|
|
201
|
+
}, l = async () => {
|
|
202
|
+
var i;
|
|
203
|
+
if (!d.clientKey || !r.value) {
|
|
204
204
|
console.error("Initialization failed: Missing clientKey or container.");
|
|
205
205
|
return;
|
|
206
206
|
}
|
|
207
|
-
const
|
|
208
|
-
if (!
|
|
207
|
+
const a = p();
|
|
208
|
+
if (!a) {
|
|
209
209
|
console.error("Failed to parse session data"), e("error", new Error("Failed to parse session data"));
|
|
210
210
|
return;
|
|
211
211
|
}
|
|
212
212
|
try {
|
|
213
|
-
const { AdyenCheckout:
|
|
214
|
-
environment:
|
|
215
|
-
clientKey:
|
|
216
|
-
session:
|
|
217
|
-
onPaymentCompleted: (t,
|
|
218
|
-
console.info("Payment Completed:", t,
|
|
213
|
+
const { AdyenCheckout: c, Card: f, ApplePay: m, GooglePay: k, Klarna: w, Blik: s, Dropin: u } = await import("@adyen/adyen-web"), h = {
|
|
214
|
+
environment: d.environment || "test",
|
|
215
|
+
clientKey: d.clientKey,
|
|
216
|
+
session: a,
|
|
217
|
+
onPaymentCompleted: (t, C) => {
|
|
218
|
+
console.info("Payment Completed:", t, C), e("submit", t), t.resultCode === "Authorised" || t.resultCode === "Received" ? (console.info("Payment Successful:", t), e("success", {
|
|
219
219
|
status: "succeeded",
|
|
220
220
|
message: "Payment completed successfully",
|
|
221
221
|
resultCode: t.resultCode,
|
|
@@ -233,12 +233,12 @@ const $ = { class: "stripe-elements" }, B = {
|
|
|
233
233
|
paymentData: t
|
|
234
234
|
}));
|
|
235
235
|
},
|
|
236
|
-
onError: (t,
|
|
237
|
-
console.error("Adyen Error:", t.name, t.message, t.stack,
|
|
236
|
+
onError: (t, C) => {
|
|
237
|
+
console.error("Adyen Error:", t.name, t.message, t.stack, C), e("error", t);
|
|
238
238
|
}
|
|
239
|
-
},
|
|
239
|
+
}, b = {
|
|
240
240
|
showPayButton: !0,
|
|
241
|
-
paymentMethodComponents: [f,
|
|
241
|
+
paymentMethodComponents: [f, m, k, w, s],
|
|
242
242
|
paymentMethodsConfiguration: {
|
|
243
243
|
card: {
|
|
244
244
|
hasHolderName: !0,
|
|
@@ -259,37 +259,28 @@ const $ = { class: "stripe-elements" }, B = {
|
|
|
259
259
|
// BLIK configuration for Polish market
|
|
260
260
|
}
|
|
261
261
|
}
|
|
262
|
-
},
|
|
263
|
-
console.log("Adyen Checkout created:",
|
|
264
|
-
const
|
|
265
|
-
console.log("Adyen Drop-in created with session payment methods"),
|
|
266
|
-
} catch (
|
|
267
|
-
console.error("Error creating Adyen Drop-in:",
|
|
262
|
+
}, o = await c(h);
|
|
263
|
+
console.log("Adyen Checkout created:", o), console.log("Available payment methods from session:", (i = o.paymentMethodsResponse) == null ? void 0 : i.paymentMethods);
|
|
264
|
+
const n = new u(o, b);
|
|
265
|
+
console.log("Adyen Drop-in created with session payment methods"), r.value && (n.mount(r.value), console.log("Adyen Drop-in mounted successfully"), e("ready"));
|
|
266
|
+
} catch (c) {
|
|
267
|
+
console.error("Error creating Adyen Drop-in:", c), e("error", c);
|
|
268
268
|
}
|
|
269
269
|
};
|
|
270
|
-
return
|
|
271
|
-
|
|
272
|
-
}),
|
|
273
|
-
|
|
274
|
-
}), (
|
|
270
|
+
return F(() => {
|
|
271
|
+
l();
|
|
272
|
+
}), U(() => d.clientData, () => {
|
|
273
|
+
r.value && (r.value.innerHTML = "", l());
|
|
274
|
+
}), (a, i) => (_(), P("div", {
|
|
275
275
|
ref_key: "dropinContainer",
|
|
276
|
-
ref:
|
|
276
|
+
ref: r,
|
|
277
277
|
class: "payment-dropin"
|
|
278
278
|
}, null, 512));
|
|
279
279
|
}
|
|
280
|
-
}),
|
|
280
|
+
}), G = /* @__PURE__ */ R(z, [["__scopeId", "data-v-ef2ec054"]]), T = { class: "delayed-payment-card" }, j = ["disabled"], L = {
|
|
281
281
|
key: 0,
|
|
282
|
-
class: "
|
|
283
|
-
},
|
|
284
|
-
key: 0,
|
|
285
|
-
class: "info-row"
|
|
286
|
-
}, G = { class: "value" }, W = {
|
|
287
|
-
key: 1,
|
|
288
|
-
class: "info-row"
|
|
289
|
-
}, X = { class: "value" }, Z = {
|
|
290
|
-
key: 1,
|
|
291
|
-
class: "error-message"
|
|
292
|
-
}, Q = { class: "button-container" }, Y = ["disabled"], ee = /* @__PURE__ */ U({
|
|
282
|
+
class: "mt-2 text-sm text-red-600"
|
|
283
|
+
}, q = /* @__PURE__ */ A({
|
|
293
284
|
__name: "DelayedPayment",
|
|
294
285
|
props: {
|
|
295
286
|
paymentId: { default: void 0 },
|
|
@@ -299,8 +290,8 @@ const $ = { class: "stripe-elements" }, B = {
|
|
|
299
290
|
tenantId: { default: void 0 }
|
|
300
291
|
},
|
|
301
292
|
emits: ["submit", "success", "error", "ready"],
|
|
302
|
-
setup(
|
|
303
|
-
const e =
|
|
293
|
+
setup(v, { expose: D, emit: d }) {
|
|
294
|
+
const e = v, r = d, p = g(!1), l = g(""), a = g({}), i = S(() => ({
|
|
304
295
|
EUR: "€",
|
|
305
296
|
USD: "$",
|
|
306
297
|
GBP: "£",
|
|
@@ -309,109 +300,97 @@ const $ = { class: "stripe-elements" }, B = {
|
|
|
309
300
|
SEK: "kr",
|
|
310
301
|
DKK: "kr",
|
|
311
302
|
PLN: "zł"
|
|
312
|
-
})[e.currency] || e.currency),
|
|
303
|
+
})[e.currency] || e.currency), c = S(() => e.amount.toFixed(2)), f = S(() => a.value.transactionNumber && a.value.confirmationUrl), m = () => {
|
|
313
304
|
if (!e.clientData) {
|
|
314
305
|
console.error("No clientData provided for delayed payment");
|
|
315
306
|
return;
|
|
316
307
|
}
|
|
317
308
|
try {
|
|
318
|
-
const
|
|
319
|
-
|
|
320
|
-
transactionNumber:
|
|
321
|
-
merchantReference:
|
|
322
|
-
providerUid:
|
|
323
|
-
|
|
324
|
-
confirmationUrl:
|
|
325
|
-
},
|
|
326
|
-
} catch (
|
|
327
|
-
|
|
309
|
+
const s = JSON.parse(e.clientData);
|
|
310
|
+
a.value = {
|
|
311
|
+
transactionNumber: s.transactionNumber,
|
|
312
|
+
merchantReference: s.merchantReference,
|
|
313
|
+
providerUid: s.providerUid,
|
|
314
|
+
paymentUid: s.paymentUid,
|
|
315
|
+
confirmationUrl: s.confirmationUrl
|
|
316
|
+
}, r("ready");
|
|
317
|
+
} catch (s) {
|
|
318
|
+
l.value = "Invalid session data", r("error", s);
|
|
328
319
|
}
|
|
329
|
-
},
|
|
320
|
+
}, k = async () => {
|
|
330
321
|
if (!(!f.value || p.value)) {
|
|
331
|
-
p.value = !0,
|
|
322
|
+
p.value = !0, l.value = "";
|
|
332
323
|
try {
|
|
333
|
-
const
|
|
324
|
+
const s = {
|
|
334
325
|
provider: "delayed-payment",
|
|
335
326
|
amount: e.amount,
|
|
336
327
|
currency: e.currency,
|
|
337
|
-
transactionNumber:
|
|
338
|
-
merchantReference:
|
|
328
|
+
transactionNumber: a.value.transactionNumber,
|
|
329
|
+
merchantReference: a.value.merchantReference,
|
|
339
330
|
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
340
331
|
};
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
const i = {
|
|
332
|
+
r("submit", s);
|
|
333
|
+
const u = {
|
|
344
334
|
"Content-Type": "application/json",
|
|
345
335
|
Accept: "application/json"
|
|
346
336
|
};
|
|
347
|
-
e.tenantId && (
|
|
348
|
-
const
|
|
337
|
+
e.tenantId && (u["X-Tenant-ID"] = e.tenantId);
|
|
338
|
+
const h = await fetch(a.value.confirmationUrl, {
|
|
349
339
|
method: "POST",
|
|
350
|
-
headers:
|
|
340
|
+
headers: u,
|
|
351
341
|
credentials: "include"
|
|
352
342
|
});
|
|
353
|
-
if (!
|
|
354
|
-
|
|
355
|
-
|
|
343
|
+
if (!h.ok) {
|
|
344
|
+
let o = "Failed to confirm payment";
|
|
345
|
+
try {
|
|
346
|
+
const n = await h.json();
|
|
347
|
+
n && typeof n == "object" && "message" in n && (o = n.message || o);
|
|
348
|
+
} catch {
|
|
349
|
+
try {
|
|
350
|
+
const n = await h.text();
|
|
351
|
+
n && (o = n);
|
|
352
|
+
} catch {
|
|
353
|
+
}
|
|
354
|
+
}
|
|
355
|
+
throw new Error(o);
|
|
356
356
|
}
|
|
357
|
-
const
|
|
358
|
-
|
|
357
|
+
const b = await h.json();
|
|
358
|
+
r("success", {
|
|
359
359
|
status: "succeeded",
|
|
360
|
-
message:
|
|
361
|
-
paymentId:
|
|
362
|
-
transactionNumber:
|
|
360
|
+
message: b.message,
|
|
361
|
+
paymentId: b.paymentId,
|
|
362
|
+
transactionNumber: a.value.transactionNumber
|
|
363
363
|
});
|
|
364
|
-
} catch (
|
|
365
|
-
|
|
364
|
+
} catch (s) {
|
|
365
|
+
l.value = s instanceof Error ? s.message : "Failed to confirm payment", r("error", s);
|
|
366
366
|
} finally {
|
|
367
367
|
p.value = !1;
|
|
368
368
|
}
|
|
369
369
|
}
|
|
370
|
-
},
|
|
371
|
-
|
|
370
|
+
}, w = () => {
|
|
371
|
+
l.value = "";
|
|
372
372
|
};
|
|
373
|
-
return
|
|
374
|
-
|
|
375
|
-
}),
|
|
376
|
-
clearError:
|
|
377
|
-
}), (
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
n.value.transactionNumber ? (b(), v("div", V, [
|
|
390
|
-
i[1] || (i[1] = s("span", { class: "label" }, "Transaction Number:", -1)),
|
|
391
|
-
s("span", G, _(n.value.transactionNumber), 1)
|
|
392
|
-
])) : k("", !0),
|
|
393
|
-
n.value.merchantReference ? (b(), v("div", W, [
|
|
394
|
-
i[2] || (i[2] = s("span", { class: "label" }, "Reference:", -1)),
|
|
395
|
-
s("span", X, _(n.value.merchantReference), 1)
|
|
396
|
-
])) : k("", !0)
|
|
397
|
-
])) : k("", !0),
|
|
398
|
-
u.value ? (b(), v("div", Z, [
|
|
399
|
-
i[3] || (i[3] = s("div", { class: "error-icon" }, " ⚠️ ", -1)),
|
|
400
|
-
s("p", null, _(u.value), 1)
|
|
401
|
-
])) : k("", !0),
|
|
402
|
-
s("div", Q, [
|
|
403
|
-
s("button", {
|
|
404
|
-
disabled: p.value || !f.value,
|
|
405
|
-
class: "submit-button",
|
|
406
|
-
onClick: K
|
|
407
|
-
}, _(p.value ? "Processing..." : `Confirm Payment ${c.value}${d.value}`), 9, Y)
|
|
408
|
-
])
|
|
409
|
-
])
|
|
373
|
+
return F(() => {
|
|
374
|
+
m();
|
|
375
|
+
}), D({
|
|
376
|
+
clearError: w
|
|
377
|
+
}), (s, u) => (_(), P("div", T, [
|
|
378
|
+
u[0] || (u[0] = y("div", { class: "header-row" }, [
|
|
379
|
+
y("span", { class: "header-icon" }, "💳"),
|
|
380
|
+
y("span", { class: "header-title" }, "Delayed payment")
|
|
381
|
+
], -1)),
|
|
382
|
+
u[1] || (u[1] = y("div", { class: "header-description" }, " Payment will be processed manually via invoice or bank transfer ", -1)),
|
|
383
|
+
y("button", {
|
|
384
|
+
disabled: p.value || !f.value,
|
|
385
|
+
class: "confirm-btn",
|
|
386
|
+
onClick: k
|
|
387
|
+
}, E(p.value ? "Processing..." : `Confirm payment ${c.value}${i.value}`), 9, j),
|
|
388
|
+
l.value ? (_(), P("p", L, E(l.value), 1)) : K("", !0)
|
|
410
389
|
]));
|
|
411
390
|
}
|
|
412
|
-
}),
|
|
391
|
+
}), W = /* @__PURE__ */ R(q, [["__scopeId", "data-v-5f2f9c67"]]);
|
|
413
392
|
export {
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
393
|
+
G as AdyenPayment,
|
|
394
|
+
W as DelayedPayment,
|
|
395
|
+
V as StripePayment
|
|
417
396
|
};
|