@bcc-code/payment-client 1.2.5 → 1.2.7
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 +116 -116
- package/dist/index.d.mts +20 -2
- package/dist/index.d.ts +20 -2
- package/dist/styles/adyen.css +1 -1
- package/package.json +1 -1
package/dist/components/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
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-469f1c48"]]);exports.AdyenPayment=H;exports.DelayedPayment=L;exports.StripePayment=$;
|
|
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 n of B(d))!U.call(c,n)&&n!==l&&S(c,n,{get:()=>d[n],enumerable:!(t=w(d,n))||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"),R={class:"stripe-elements"},F={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,n=l,b=e.ref(),m=e.ref(!0),o=e.ref(!1),u=e.ref("");let p=null,g=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),C=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(!b.value)return;let s=t.publishableKey;if(!s&&t.clientData)try{const a=JSON.parse(t.clientData);s=a.publishableKey||a.publishable_key}catch{}if(!s){u.value="Publishable key is required",m.value=!1;return}try{m.value=!0,u.value="";const{loadStripe:a}=await import("@stripe/stripe-js");if(p=await a(s),!p)throw new Error("Failed to load Stripe");const v=i.value,r={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};v&&(r.clientSecret=v),g=p.elements(r),f=g.create("payment",{layout:"tabs",defaultValues:{billingDetails:{name:"",email:"",phone:""}}}),f.mount(b.value),f.on("ready",()=>{m.value=!1,n("ready")}),f.on("change",P=>{P.error?(u.value=P.error.message,n("error",P.error)):u.value=""})}catch(a){u.value=a instanceof Error?a.message:"Failed to initialize payment form",m.value=!1,n("error",a)}},D=async()=>{if(!(!p||!f)){o.value=!0,u.value="";try{const s=t.returnUrl||`${window.location.origin}/payment/return`,{error:a,paymentIntent:v}=await p.confirmPayment({elements:g,confirmParams:{return_url:s},redirect:"if_required"});a?(u.value=a.message||"Payment failed",n("error",a)):v?v.status==="succeeded"?n("success",{paymentIntent:v,status:"succeeded",message:"Payment completed successfully!"}):v.status==="processing"?n("success",{paymentIntent:v,status:"processing",message:"Payment is being processed..."}):n("submit",{paymentIntent:v,status:v.status}):n("submit",f)}catch(s){u.value=s instanceof Error?s.message:"Payment failed",n("error",s)}finally{o.value=!1}}},h=()=>{f&&(f.destroy(),f=null),g&&(g=null),p&&(p=null)};return e.onMounted(()=>{y()}),e.onUnmounted(()=>{h()}),e.watch(()=>t.currency,()=>{h(),y()}),e.watch([()=>t.publishableKey,()=>t.clientData],()=>{(t.publishableKey||t.clientData)&&(h(),y())}),d({destroyElements:h}),(s,a)=>(e.openBlock(),e.createElementBlock("div",R,[e.createElementVNode("div",{ref_key:"elementsContainer",ref:b,class:"elements-container"},null,512),m.value?(e.openBlock(),e.createElementBlock("div",F,[...a[0]||(a[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,[a[1]||(a[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:D},e.toDisplayString(o.value?"Processing...":`Pay ${k.value}${C.value}`),9,x)])):e.createCommentVNode("",!0)]))}}),_=(c,d)=>{const l=c.__vccOpts||c;for(const[t,n]of d)l[t]=n;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,n=e.ref(null),b=()=>{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||!n.value){console.error("Initialization failed: Missing clientKey or container.");return}const o=b();if(!o){console.error("Failed to parse session data"),t("error",new Error("Failed to parse session data"));return}try{const{AdyenCheckout:p,Card:g,ApplePay:f,GooglePay:k,Klarna:C,Blik:i,Redirect:y,Dropin:D}=await import("@adyen/adyen-web"),h={environment:l.environment||"test",clientKey:l.clientKey,session:o,onPaymentCompleted:(r,P)=>{console.info("Payment Completed:",r,P),t("submit",r),r.resultCode==="Authorised"||r.resultCode==="Received"?(console.info("Payment Successful:",r),t("success",{status:"succeeded",message:"Payment completed successfully",resultCode:r.resultCode,pspReference:r.pspReference,paymentData:r})):r.resultCode==="Pending"?(console.info("Payment Pending:",r),t("success",{status:"processing",message:"Payment is being processed",resultCode:r.resultCode,pspReference:r.pspReference,paymentData:r})):(r.resultCode==="Refused"||r.resultCode==="Error")&&(console.error("Payment Failed:",r),t("error",{message:r.refusalReason||"Payment was declined",resultCode:r.resultCode,paymentData:r}))},onError:(r,P)=>{console.error("Adyen Error:",r.name,r.message,r.stack,P),t("error",r)}},s={showPayButton:!0,paymentMethodComponents:[g,f,k,C,i,y],paymentMethodsConfiguration:{card:{hasHolderName:!0,holderNameRequired:!0,billingAddressRequired:!1,enableStoreDetails:!1},applePay:{showPayButton:!0},googlePay:{showPayButton:!0},klarna:{useKlarnaWidget:!0},blik:{}}},a=await p(h);console.log("Adyen Checkout created:",a),console.log("Available payment methods from session:",(u=a.paymentMethodsResponse)==null?void 0:u.paymentMethods);const v=new D(a,s);console.log("Adyen Drop-in created with session payment methods"),n.value&&(v.mount(n.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,()=>{n.value&&(n.value.innerHTML="",m())}),(o,u)=>(e.openBlock(),e.createElementBlock("div",{ref_key:"dropinContainer",ref:n,class:"payment-dropin"},null,512))}}),H=_(O,[["__scopeId","data-v-f0b79c68"]]),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,n=l,b=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)),g=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},n("ready")}catch(i){m.value="Invalid session data",n("error",i)}},k=async()=>{if(!(!g.value||b.value)){b.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()};n("submit",i);const y={"Content-Type":"application/json",Accept:"application/json"};t.tenantId&&(y["X-Tenant-ID"]=t.tenantId);const D=await fetch(o.value.confirmationUrl,{method:"POST",headers:y,credentials:"include"});if(!D.ok){let s="Failed to confirm payment";try{const a=await D.json();a&&typeof a=="object"&&"message"in a&&(s=a.message||s)}catch{try{const a=await D.text();a&&(s=a)}catch{}}throw new Error(s)}const h=await D.json();n("success",{status:"succeeded",message:h.message,paymentId:h.paymentId,transactionNumber:o.value.transactionNumber})}catch(i){m.value=i instanceof Error?i.message:"Failed to confirm payment",n("error",i)}finally{b.value=!1}}},C=()=>{m.value=""};return e.onMounted(()=>{f()}),d({clearError:C}),(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:b.value||!g.value,class:"confirm-btn",onClick:k},e.toDisplayString(b.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-469f1c48"]]);exports.AdyenPayment=H;exports.DelayedPayment=L;exports.StripePayment=$;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineComponent as
|
|
1
|
+
import { defineComponent as R, ref as D, computed as k, onMounted as A, onUnmounted as I, watch as U, createElementBlock as C, openBlock as S, createElementVNode as p, createCommentVNode as E, toDisplayString as N } from "vue";
|
|
2
2
|
const x = { class: "stripe-elements" }, B = {
|
|
3
3
|
key: 0,
|
|
4
4
|
class: "elements-loading"
|
|
@@ -8,7 +8,7 @@ const x = { class: "stripe-elements" }, B = {
|
|
|
8
8
|
}, M = {
|
|
9
9
|
key: 2,
|
|
10
10
|
class: "payment-button-container"
|
|
11
|
-
}, O = ["disabled"], H = /* @__PURE__ */
|
|
11
|
+
}, O = ["disabled"], H = /* @__PURE__ */ R({
|
|
12
12
|
__name: "StripePayment",
|
|
13
13
|
props: {
|
|
14
14
|
paymentId: {},
|
|
@@ -24,10 +24,10 @@ const x = { 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 c = null,
|
|
30
|
-
const
|
|
27
|
+
setup(b, { expose: P, emit: d }) {
|
|
28
|
+
const e = b, r = d, f = D(), l = D(!0), a = D(!1), i = D("");
|
|
29
|
+
let c = null, v = null, m = null;
|
|
30
|
+
const w = k(() => ({
|
|
31
31
|
EUR: "€",
|
|
32
32
|
USD: "$",
|
|
33
33
|
GBP: "£",
|
|
@@ -38,7 +38,7 @@ const x = { 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), K = k(() => e.amount.toFixed(2)), s = k(() => {
|
|
42
42
|
if (e.clientData)
|
|
43
43
|
try {
|
|
44
44
|
const o = JSON.parse(e.clientData);
|
|
@@ -47,12 +47,12 @@ const x = { class: "stripe-elements" }, B = {
|
|
|
47
47
|
return;
|
|
48
48
|
}
|
|
49
49
|
}), u = async () => {
|
|
50
|
-
if (!
|
|
50
|
+
if (!f.value) return;
|
|
51
51
|
let o = e.publishableKey;
|
|
52
52
|
if (!o && e.clientData)
|
|
53
53
|
try {
|
|
54
|
-
const
|
|
55
|
-
o =
|
|
54
|
+
const t = JSON.parse(e.clientData);
|
|
55
|
+
o = t.publishableKey || t.publishable_key;
|
|
56
56
|
} catch {
|
|
57
57
|
}
|
|
58
58
|
if (!o) {
|
|
@@ -61,10 +61,10 @@ const x = { class: "stripe-elements" }, B = {
|
|
|
61
61
|
}
|
|
62
62
|
try {
|
|
63
63
|
l.value = !0, i.value = "";
|
|
64
|
-
const { loadStripe:
|
|
65
|
-
if (c = await
|
|
64
|
+
const { loadStripe: t } = await import("@stripe/stripe-js");
|
|
65
|
+
if (c = await t(o), !c)
|
|
66
66
|
throw new Error("Failed to load Stripe");
|
|
67
|
-
const
|
|
67
|
+
const y = s.value, n = {
|
|
68
68
|
appearance: e.appearance || {
|
|
69
69
|
theme: "stripe",
|
|
70
70
|
variables: {
|
|
@@ -80,7 +80,7 @@ const x = { class: "stripe-elements" }, B = {
|
|
|
80
80
|
loader: e.loader,
|
|
81
81
|
locale: e.locale
|
|
82
82
|
};
|
|
83
|
-
|
|
83
|
+
y && (n.clientSecret = y), v = c.elements(n), m = v.create("payment", {
|
|
84
84
|
layout: "tabs",
|
|
85
85
|
defaultValues: {
|
|
86
86
|
billingDetails: {
|
|
@@ -89,86 +89,86 @@ const x = { class: "stripe-elements" }, B = {
|
|
|
89
89
|
phone: ""
|
|
90
90
|
}
|
|
91
91
|
}
|
|
92
|
-
}), m.mount(
|
|
92
|
+
}), m.mount(f.value), m.on("ready", () => {
|
|
93
93
|
l.value = !1, r("ready");
|
|
94
|
-
}), m.on("change", (
|
|
95
|
-
|
|
94
|
+
}), m.on("change", (_) => {
|
|
95
|
+
_.error ? (i.value = _.error.message, r("error", _.error)) : i.value = "";
|
|
96
96
|
});
|
|
97
|
-
} catch (
|
|
98
|
-
i.value =
|
|
97
|
+
} catch (t) {
|
|
98
|
+
i.value = t instanceof Error ? t.message : "Failed to initialize payment form", l.value = !1, r("error", t);
|
|
99
99
|
}
|
|
100
|
-
},
|
|
100
|
+
}, g = async () => {
|
|
101
101
|
if (!(!c || !m)) {
|
|
102
102
|
a.value = !0, i.value = "";
|
|
103
103
|
try {
|
|
104
|
-
const o = e.returnUrl || `${window.location.origin}/payment/return`, { error:
|
|
105
|
-
elements:
|
|
104
|
+
const o = e.returnUrl || `${window.location.origin}/payment/return`, { error: t, paymentIntent: y } = await c.confirmPayment({
|
|
105
|
+
elements: v,
|
|
106
106
|
confirmParams: {
|
|
107
107
|
return_url: o
|
|
108
108
|
},
|
|
109
109
|
redirect: "if_required"
|
|
110
110
|
});
|
|
111
|
-
|
|
112
|
-
paymentIntent:
|
|
111
|
+
t ? (i.value = t.message || "Payment failed", r("error", t)) : y ? y.status === "succeeded" ? r("success", {
|
|
112
|
+
paymentIntent: y,
|
|
113
113
|
status: "succeeded",
|
|
114
114
|
message: "Payment completed successfully!"
|
|
115
|
-
}) :
|
|
116
|
-
paymentIntent:
|
|
115
|
+
}) : y.status === "processing" ? r("success", {
|
|
116
|
+
paymentIntent: y,
|
|
117
117
|
status: "processing",
|
|
118
118
|
message: "Payment is being processed..."
|
|
119
|
-
}) : r("submit", { paymentIntent:
|
|
119
|
+
}) : r("submit", { paymentIntent: y, status: y.status }) : r("submit", m);
|
|
120
120
|
} catch (o) {
|
|
121
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
|
-
m && (m.destroy(), m = null),
|
|
126
|
+
}, h = () => {
|
|
127
|
+
m && (m.destroy(), m = null), v && (v = null), c && (c = null);
|
|
128
128
|
};
|
|
129
|
-
return
|
|
129
|
+
return A(() => {
|
|
130
130
|
u();
|
|
131
131
|
}), I(() => {
|
|
132
|
-
|
|
132
|
+
h();
|
|
133
133
|
}), U(() => e.currency, () => {
|
|
134
|
-
|
|
134
|
+
h(), u();
|
|
135
135
|
}), U([() => e.publishableKey, () => e.clientData], () => {
|
|
136
|
-
(e.publishableKey || e.clientData) && (
|
|
137
|
-
}),
|
|
138
|
-
destroyElements:
|
|
139
|
-
}), (o,
|
|
140
|
-
|
|
136
|
+
(e.publishableKey || e.clientData) && (h(), u());
|
|
137
|
+
}), P({
|
|
138
|
+
destroyElements: h
|
|
139
|
+
}), (o, t) => (S(), C("div", x, [
|
|
140
|
+
p("div", {
|
|
141
141
|
ref_key: "elementsContainer",
|
|
142
|
-
ref:
|
|
142
|
+
ref: f,
|
|
143
143
|
class: "elements-container"
|
|
144
144
|
}, null, 512),
|
|
145
|
-
l.value ? (
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
])])) :
|
|
149
|
-
i.value ? (
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
145
|
+
l.value ? (S(), C("div", B, [...t[0] || (t[0] = [
|
|
146
|
+
p("div", { class: "loading-spinner" }, null, -1),
|
|
147
|
+
p("p", null, "Loading payment form...", -1)
|
|
148
|
+
])])) : E("", !0),
|
|
149
|
+
i.value ? (S(), C("div", $, [
|
|
150
|
+
t[1] || (t[1] = p("div", { class: "error-icon" }, " ⚠️ ", -1)),
|
|
151
|
+
p("p", null, N(i.value), 1),
|
|
152
|
+
p("button", {
|
|
153
153
|
class: "retry-btn",
|
|
154
154
|
onClick: u
|
|
155
155
|
}, " Retry ")
|
|
156
|
-
])) :
|
|
157
|
-
|
|
158
|
-
|
|
156
|
+
])) : E("", !0),
|
|
157
|
+
b.showPayButton && !l.value && !i.value ? (S(), C("div", M, [
|
|
158
|
+
p("button", {
|
|
159
159
|
disabled: a.value,
|
|
160
160
|
class: "payment-button",
|
|
161
|
-
onClick:
|
|
162
|
-
},
|
|
163
|
-
])) :
|
|
161
|
+
onClick: g
|
|
162
|
+
}, N(a.value ? "Processing..." : `Pay ${w.value}${K.value}`), 9, O)
|
|
163
|
+
])) : E("", !0)
|
|
164
164
|
]));
|
|
165
165
|
}
|
|
166
|
-
}),
|
|
167
|
-
const d =
|
|
168
|
-
for (const [e, r] of
|
|
166
|
+
}), F = (b, P) => {
|
|
167
|
+
const d = b.__vccOpts || b;
|
|
168
|
+
for (const [e, r] of P)
|
|
169
169
|
d[e] = r;
|
|
170
170
|
return d;
|
|
171
|
-
}, V = /* @__PURE__ */
|
|
171
|
+
}, V = /* @__PURE__ */ F(H, [["__scopeId", "data-v-adbdf3c5"]]), z = /* @__PURE__ */ R({
|
|
172
172
|
__name: "AdyenPayment",
|
|
173
173
|
props: {
|
|
174
174
|
paymentId: {},
|
|
@@ -181,8 +181,8 @@ const x = { class: "stripe-elements" }, B = {
|
|
|
181
181
|
onCancel: { type: Function }
|
|
182
182
|
},
|
|
183
183
|
emits: ["submit", "additionalDetails", "error", "ready", "success"],
|
|
184
|
-
setup(
|
|
185
|
-
const d =
|
|
184
|
+
setup(b, { emit: P }) {
|
|
185
|
+
const d = b, e = P, r = D(null), f = () => {
|
|
186
186
|
if (!d.clientData)
|
|
187
187
|
return console.error("No clientData provided"), null;
|
|
188
188
|
try {
|
|
@@ -204,41 +204,41 @@ const x = { class: "stripe-elements" }, B = {
|
|
|
204
204
|
console.error("Initialization failed: Missing clientKey or container.");
|
|
205
205
|
return;
|
|
206
206
|
}
|
|
207
|
-
const a =
|
|
207
|
+
const a = f();
|
|
208
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: c, Card:
|
|
213
|
+
const { AdyenCheckout: c, Card: v, ApplePay: m, GooglePay: w, Klarna: K, Blik: s, Redirect: u, Dropin: g } = await import("@adyen/adyen-web"), h = {
|
|
214
214
|
environment: d.environment || "test",
|
|
215
215
|
clientKey: d.clientKey,
|
|
216
216
|
session: a,
|
|
217
|
-
onPaymentCompleted: (
|
|
218
|
-
console.info("Payment Completed:",
|
|
217
|
+
onPaymentCompleted: (n, _) => {
|
|
218
|
+
console.info("Payment Completed:", n, _), e("submit", n), n.resultCode === "Authorised" || n.resultCode === "Received" ? (console.info("Payment Successful:", n), e("success", {
|
|
219
219
|
status: "succeeded",
|
|
220
220
|
message: "Payment completed successfully",
|
|
221
|
-
resultCode:
|
|
222
|
-
pspReference:
|
|
223
|
-
paymentData:
|
|
224
|
-
})) :
|
|
221
|
+
resultCode: n.resultCode,
|
|
222
|
+
pspReference: n.pspReference,
|
|
223
|
+
paymentData: n
|
|
224
|
+
})) : n.resultCode === "Pending" ? (console.info("Payment Pending:", n), e("success", {
|
|
225
225
|
status: "processing",
|
|
226
226
|
message: "Payment is being processed",
|
|
227
|
-
resultCode:
|
|
228
|
-
pspReference:
|
|
229
|
-
paymentData:
|
|
230
|
-
})) : (
|
|
231
|
-
message:
|
|
232
|
-
resultCode:
|
|
233
|
-
paymentData:
|
|
227
|
+
resultCode: n.resultCode,
|
|
228
|
+
pspReference: n.pspReference,
|
|
229
|
+
paymentData: n
|
|
230
|
+
})) : (n.resultCode === "Refused" || n.resultCode === "Error") && (console.error("Payment Failed:", n), e("error", {
|
|
231
|
+
message: n.refusalReason || "Payment was declined",
|
|
232
|
+
resultCode: n.resultCode,
|
|
233
|
+
paymentData: n
|
|
234
234
|
}));
|
|
235
235
|
},
|
|
236
|
-
onError: (
|
|
237
|
-
console.error("Adyen Error:",
|
|
236
|
+
onError: (n, _) => {
|
|
237
|
+
console.error("Adyen Error:", n.name, n.message, n.stack, _), e("error", n);
|
|
238
238
|
}
|
|
239
|
-
},
|
|
239
|
+
}, o = {
|
|
240
240
|
showPayButton: !0,
|
|
241
|
-
paymentMethodComponents: [
|
|
241
|
+
paymentMethodComponents: [v, m, w, K, s, u],
|
|
242
242
|
paymentMethodsConfiguration: {
|
|
243
243
|
card: {
|
|
244
244
|
hasHolderName: !0,
|
|
@@ -259,28 +259,28 @@ const x = { 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"), r.value && (
|
|
262
|
+
}, t = await c(h);
|
|
263
|
+
console.log("Adyen Checkout created:", t), console.log("Available payment methods from session:", (i = t.paymentMethodsResponse) == null ? void 0 : i.paymentMethods);
|
|
264
|
+
const y = new g(t, o);
|
|
265
|
+
console.log("Adyen Drop-in created with session payment methods"), r.value && (y.mount(r.value), console.log("Adyen Drop-in mounted successfully"), e("ready"));
|
|
266
266
|
} catch (c) {
|
|
267
267
|
console.error("Error creating Adyen Drop-in:", c), e("error", c);
|
|
268
268
|
}
|
|
269
269
|
};
|
|
270
|
-
return
|
|
270
|
+
return A(() => {
|
|
271
271
|
l();
|
|
272
272
|
}), U(() => d.clientData, () => {
|
|
273
273
|
r.value && (r.value.innerHTML = "", l());
|
|
274
|
-
}), (a, i) => (
|
|
274
|
+
}), (a, i) => (S(), C("div", {
|
|
275
275
|
ref_key: "dropinContainer",
|
|
276
276
|
ref: r,
|
|
277
277
|
class: "payment-dropin"
|
|
278
278
|
}, null, 512));
|
|
279
279
|
}
|
|
280
|
-
}), G = /* @__PURE__ */
|
|
280
|
+
}), G = /* @__PURE__ */ F(z, [["__scopeId", "data-v-f0b79c68"]]), T = { class: "delayed-payment-card" }, j = ["disabled"], L = {
|
|
281
281
|
key: 0,
|
|
282
282
|
class: "mt-2 text-sm text-red-600"
|
|
283
|
-
}, q = /* @__PURE__ */
|
|
283
|
+
}, q = /* @__PURE__ */ R({
|
|
284
284
|
__name: "DelayedPayment",
|
|
285
285
|
props: {
|
|
286
286
|
paymentId: { default: void 0 },
|
|
@@ -290,8 +290,8 @@ const x = { class: "stripe-elements" }, B = {
|
|
|
290
290
|
tenantId: { default: void 0 }
|
|
291
291
|
},
|
|
292
292
|
emits: ["submit", "success", "error", "ready"],
|
|
293
|
-
setup(
|
|
294
|
-
const e =
|
|
293
|
+
setup(b, { expose: P, emit: d }) {
|
|
294
|
+
const e = b, r = d, f = D(!1), l = D(""), a = D({}), i = k(() => ({
|
|
295
295
|
EUR: "€",
|
|
296
296
|
USD: "$",
|
|
297
297
|
GBP: "£",
|
|
@@ -300,7 +300,7 @@ const x = { class: "stripe-elements" }, B = {
|
|
|
300
300
|
SEK: "kr",
|
|
301
301
|
DKK: "kr",
|
|
302
302
|
PLN: "zł"
|
|
303
|
-
})[e.currency] || e.currency), c =
|
|
303
|
+
})[e.currency] || e.currency), c = k(() => e.amount.toFixed(2)), v = k(() => a.value.transactionNumber && a.value.confirmationUrl), m = () => {
|
|
304
304
|
if (!e.clientData) {
|
|
305
305
|
console.error("No clientData provided for delayed payment");
|
|
306
306
|
return;
|
|
@@ -317,9 +317,9 @@ const x = { class: "stripe-elements" }, B = {
|
|
|
317
317
|
} catch (s) {
|
|
318
318
|
l.value = "Invalid session data", r("error", s);
|
|
319
319
|
}
|
|
320
|
-
},
|
|
321
|
-
if (!(!
|
|
322
|
-
|
|
320
|
+
}, w = async () => {
|
|
321
|
+
if (!(!v.value || f.value)) {
|
|
322
|
+
f.value = !0, l.value = "";
|
|
323
323
|
try {
|
|
324
324
|
const s = {
|
|
325
325
|
provider: "delayed-payment",
|
|
@@ -335,60 +335,60 @@ const x = { class: "stripe-elements" }, B = {
|
|
|
335
335
|
Accept: "application/json"
|
|
336
336
|
};
|
|
337
337
|
e.tenantId && (u["X-Tenant-ID"] = e.tenantId);
|
|
338
|
-
const
|
|
338
|
+
const g = await fetch(a.value.confirmationUrl, {
|
|
339
339
|
method: "POST",
|
|
340
340
|
headers: u,
|
|
341
341
|
credentials: "include"
|
|
342
342
|
});
|
|
343
|
-
if (!
|
|
343
|
+
if (!g.ok) {
|
|
344
344
|
let o = "Failed to confirm payment";
|
|
345
345
|
try {
|
|
346
|
-
const
|
|
347
|
-
|
|
346
|
+
const t = await g.json();
|
|
347
|
+
t && typeof t == "object" && "message" in t && (o = t.message || o);
|
|
348
348
|
} catch {
|
|
349
349
|
try {
|
|
350
|
-
const
|
|
351
|
-
|
|
350
|
+
const t = await g.text();
|
|
351
|
+
t && (o = t);
|
|
352
352
|
} catch {
|
|
353
353
|
}
|
|
354
354
|
}
|
|
355
355
|
throw new Error(o);
|
|
356
356
|
}
|
|
357
|
-
const
|
|
357
|
+
const h = await g.json();
|
|
358
358
|
r("success", {
|
|
359
359
|
status: "succeeded",
|
|
360
|
-
message:
|
|
361
|
-
paymentId:
|
|
360
|
+
message: h.message,
|
|
361
|
+
paymentId: h.paymentId,
|
|
362
362
|
transactionNumber: a.value.transactionNumber
|
|
363
363
|
});
|
|
364
364
|
} catch (s) {
|
|
365
365
|
l.value = s instanceof Error ? s.message : "Failed to confirm payment", r("error", s);
|
|
366
366
|
} finally {
|
|
367
|
-
|
|
367
|
+
f.value = !1;
|
|
368
368
|
}
|
|
369
369
|
}
|
|
370
|
-
},
|
|
370
|
+
}, K = () => {
|
|
371
371
|
l.value = "";
|
|
372
372
|
};
|
|
373
|
-
return
|
|
373
|
+
return A(() => {
|
|
374
374
|
m();
|
|
375
|
-
}),
|
|
376
|
-
clearError:
|
|
377
|
-
}), (s, u) => (
|
|
378
|
-
u[0] || (u[0] =
|
|
379
|
-
|
|
380
|
-
|
|
375
|
+
}), P({
|
|
376
|
+
clearError: K
|
|
377
|
+
}), (s, u) => (S(), C("div", T, [
|
|
378
|
+
u[0] || (u[0] = p("div", { class: "header-row" }, [
|
|
379
|
+
p("span", { class: "header-icon" }, "💳"),
|
|
380
|
+
p("span", { class: "header-title" }, "Delayed payment")
|
|
381
381
|
], -1)),
|
|
382
|
-
u[1] || (u[1] =
|
|
383
|
-
|
|
384
|
-
disabled:
|
|
382
|
+
u[1] || (u[1] = p("div", { class: "header-description" }, " Payment will be processed manually via invoice or bank transfer ", -1)),
|
|
383
|
+
p("button", {
|
|
384
|
+
disabled: f.value || !v.value,
|
|
385
385
|
class: "confirm-btn",
|
|
386
|
-
onClick:
|
|
387
|
-
},
|
|
388
|
-
l.value ? (
|
|
386
|
+
onClick: w
|
|
387
|
+
}, N(f.value ? "Processing..." : `Confirm payment ${c.value}${i.value}`), 9, j),
|
|
388
|
+
l.value ? (S(), C("p", L, N(l.value), 1)) : E("", !0)
|
|
389
389
|
]));
|
|
390
390
|
}
|
|
391
|
-
}), W = /* @__PURE__ */
|
|
391
|
+
}), W = /* @__PURE__ */ F(q, [["__scopeId", "data-v-469f1c48"]]);
|
|
392
392
|
export {
|
|
393
393
|
G as AdyenPayment,
|
|
394
394
|
W as DelayedPayment,
|
package/dist/index.d.mts
CHANGED
|
@@ -129,6 +129,24 @@ interface GetPaymentMethodsOptions {
|
|
|
129
129
|
churchId?: string;
|
|
130
130
|
isCompany?: boolean;
|
|
131
131
|
}
|
|
132
|
+
/** A single provider's available methods from the configuration API. */
|
|
133
|
+
interface PaymentProviderMethods {
|
|
134
|
+
provider: string;
|
|
135
|
+
environment: string;
|
|
136
|
+
countryCode: string | null;
|
|
137
|
+
methods: string[];
|
|
138
|
+
}
|
|
139
|
+
/** Response from GET /api/v1/configuration/payment-methods. */
|
|
140
|
+
interface PaymentMethodsConfigResponse {
|
|
141
|
+
tenantId: string;
|
|
142
|
+
currency: string;
|
|
143
|
+
amount: number;
|
|
144
|
+
countryCode: string | null;
|
|
145
|
+
churchId: string | null;
|
|
146
|
+
payerType: string;
|
|
147
|
+
paymentMethods: Record<string, PaymentProviderMethods>;
|
|
148
|
+
timestamp: string;
|
|
149
|
+
}
|
|
132
150
|
|
|
133
151
|
interface PaymentClientOptions {
|
|
134
152
|
baseUrl: string;
|
|
@@ -147,7 +165,7 @@ declare class PaymentClient {
|
|
|
147
165
|
getPayment(paymentId: string): Promise<PaymentResponse | null>;
|
|
148
166
|
getReceipt(paymentId: string): Promise<PaymentReceiptResponse | null>;
|
|
149
167
|
getTotalAmountByPrefix(prefix: string): Promise<number>;
|
|
150
|
-
getPaymentMethods(options?: GetPaymentMethodsOptions): Promise<
|
|
168
|
+
getPaymentMethods(options?: GetPaymentMethodsOptions): Promise<PaymentMethodsConfigResponse>;
|
|
151
169
|
}
|
|
152
170
|
|
|
153
171
|
interface StripePaymentProps {
|
|
@@ -173,4 +191,4 @@ interface AdyenPaymentProps {
|
|
|
173
191
|
onCancel?: () => void;
|
|
174
192
|
}
|
|
175
193
|
|
|
176
|
-
export { type AdyenPaymentProps, type CreatePaymentRequest, type CreatePaymentResponse, type GetPaymentMethodsOptions, type InvoiceRecipientRequest, type LineItemRequest, type LineItemResponse, PaymentClient, type PaymentClientOptions, type PaymentReceiptResponse, type PaymentResponse, type PaymentSucceededNotification, type PersonInfoRequest, type StripePaymentProps };
|
|
194
|
+
export { type AdyenPaymentProps, type CreatePaymentRequest, type CreatePaymentResponse, type GetPaymentMethodsOptions, type InvoiceRecipientRequest, type LineItemRequest, type LineItemResponse, PaymentClient, type PaymentClientOptions, type PaymentMethodsConfigResponse, type PaymentProviderMethods, type PaymentReceiptResponse, type PaymentResponse, type PaymentSucceededNotification, type PersonInfoRequest, type StripePaymentProps };
|
package/dist/index.d.ts
CHANGED
|
@@ -129,6 +129,24 @@ interface GetPaymentMethodsOptions {
|
|
|
129
129
|
churchId?: string;
|
|
130
130
|
isCompany?: boolean;
|
|
131
131
|
}
|
|
132
|
+
/** A single provider's available methods from the configuration API. */
|
|
133
|
+
interface PaymentProviderMethods {
|
|
134
|
+
provider: string;
|
|
135
|
+
environment: string;
|
|
136
|
+
countryCode: string | null;
|
|
137
|
+
methods: string[];
|
|
138
|
+
}
|
|
139
|
+
/** Response from GET /api/v1/configuration/payment-methods. */
|
|
140
|
+
interface PaymentMethodsConfigResponse {
|
|
141
|
+
tenantId: string;
|
|
142
|
+
currency: string;
|
|
143
|
+
amount: number;
|
|
144
|
+
countryCode: string | null;
|
|
145
|
+
churchId: string | null;
|
|
146
|
+
payerType: string;
|
|
147
|
+
paymentMethods: Record<string, PaymentProviderMethods>;
|
|
148
|
+
timestamp: string;
|
|
149
|
+
}
|
|
132
150
|
|
|
133
151
|
interface PaymentClientOptions {
|
|
134
152
|
baseUrl: string;
|
|
@@ -147,7 +165,7 @@ declare class PaymentClient {
|
|
|
147
165
|
getPayment(paymentId: string): Promise<PaymentResponse | null>;
|
|
148
166
|
getReceipt(paymentId: string): Promise<PaymentReceiptResponse | null>;
|
|
149
167
|
getTotalAmountByPrefix(prefix: string): Promise<number>;
|
|
150
|
-
getPaymentMethods(options?: GetPaymentMethodsOptions): Promise<
|
|
168
|
+
getPaymentMethods(options?: GetPaymentMethodsOptions): Promise<PaymentMethodsConfigResponse>;
|
|
151
169
|
}
|
|
152
170
|
|
|
153
171
|
interface StripePaymentProps {
|
|
@@ -173,4 +191,4 @@ interface AdyenPaymentProps {
|
|
|
173
191
|
onCancel?: () => void;
|
|
174
192
|
}
|
|
175
193
|
|
|
176
|
-
export { type AdyenPaymentProps, type CreatePaymentRequest, type CreatePaymentResponse, type GetPaymentMethodsOptions, type InvoiceRecipientRequest, type LineItemRequest, type LineItemResponse, PaymentClient, type PaymentClientOptions, type PaymentReceiptResponse, type PaymentResponse, type PaymentSucceededNotification, type PersonInfoRequest, type StripePaymentProps };
|
|
194
|
+
export { type AdyenPaymentProps, type CreatePaymentRequest, type CreatePaymentResponse, type GetPaymentMethodsOptions, type InvoiceRecipientRequest, type LineItemRequest, type LineItemResponse, PaymentClient, type PaymentClientOptions, type PaymentMethodsConfigResponse, type PaymentProviderMethods, type PaymentReceiptResponse, type PaymentResponse, type PaymentSucceededNotification, type PersonInfoRequest, type StripePaymentProps };
|