@solvimon/solvimon-web 0.1.0-alpha.14 → 0.1.0-alpha.16
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/{BillingInformation.vue_vue_type_script_setup_true_lang-0_VYW5Wu.js → BillingInformation.vue_vue_type_script_setup_true_lang-BI3Lg7nO.js} +1 -1
- package/dist/{BillingInformation.vue_vue_type_script_setup_true_lang-D8ZeVBWO.mjs → BillingInformation.vue_vue_type_script_setup_true_lang-BYBAO4Au.mjs} +2 -2
- package/dist/ContentWithAsideLayout-DHpnJfGA.js +1 -0
- package/dist/{ContentWithAsideLayout-DhfUkZZg.mjs → ContentWithAsideLayout-Dy9xgxuF.mjs} +6 -3
- package/dist/{CustomerPaymentMethods.vue_vue_type_script_setup_true_lang-DEqfojR8.mjs → CustomerPaymentMethods.vue_vue_type_script_setup_true_lang-CTnn1gkW.mjs} +8 -23
- package/dist/CustomerPaymentMethods.vue_vue_type_script_setup_true_lang-C_uHr21N.js +1 -0
- package/dist/{InvoiceDetailsBlock.vue_vue_type_script_setup_true_lang-CFLR4ptB.js → InvoiceDetailsBlock.vue_vue_type_script_setup_true_lang-DU6X3zxr.js} +1 -1
- package/dist/{InvoiceDetailsBlock.vue_vue_type_script_setup_true_lang-COnrD4ew.mjs → InvoiceDetailsBlock.vue_vue_type_script_setup_true_lang-ryvFEQMV.mjs} +1 -1
- package/dist/InvoiceHeader.vue_vue_type_script_setup_true_lang-DdpPrYxi.js +1 -0
- package/dist/InvoiceHeader.vue_vue_type_script_setup_true_lang-bAiAbtMi.mjs +27 -0
- package/dist/{PaymentHistoryBlock-DUeSRR3k.js → PaymentHistoryBlock-BGbTy4Se.js} +1 -1
- package/dist/{PaymentHistoryBlock-BTRFc4ki.mjs → PaymentHistoryBlock-BKMttUyk.mjs} +1 -1
- package/dist/{PaymentHistoryBlock.vue_vue_type_script_setup_true_lang-TgZYSSQe.js → PaymentHistoryBlock.vue_vue_type_script_setup_true_lang-CixdxEGm.js} +1 -1
- package/dist/{PaymentHistoryBlock.vue_vue_type_script_setup_true_lang-GeyErAW6.mjs → PaymentHistoryBlock.vue_vue_type_script_setup_true_lang-tM7f_fQS.mjs} +1 -1
- package/dist/{PaymentIntegrationForm-DX6kv0_v.mjs → PaymentIntegrationForm-CypW6fZY.mjs} +1 -1
- package/dist/{PaymentIntegrationForm-CQntx0TH.js → PaymentIntegrationForm-D4QupHWl.js} +1 -1
- package/dist/PaymentIntegrationForm.vue_vue_type_script_setup_true_lang-BBEM-YPz.js +1 -0
- package/dist/{PaymentIntegrationForm.vue_vue_type_script_setup_true_lang-Dkd-Cp8c.mjs → PaymentIntegrationForm.vue_vue_type_script_setup_true_lang-CrGSfZZs.mjs} +736 -162
- package/dist/PaymentMethodForm.vue_vue_type_script_setup_true_lang-B8eNptZp.mjs +145 -0
- package/dist/PaymentMethodForm.vue_vue_type_script_setup_true_lang-eWmC5GOT.js +1 -0
- package/dist/PaymentMethodsList.vue_vue_type_script_setup_true_lang-BUTqn4Ey.mjs +139 -0
- package/dist/PaymentMethodsList.vue_vue_type_script_setup_true_lang-Be_fF-R_.js +1 -0
- package/dist/SecurePaymentsKPI.vue_vue_type_script_setup_true_lang-BVoS3ZXS.js +1 -0
- package/dist/{SecurePaymentsKPI.vue_vue_type_script_setup_true_lang-D-BFQZiM.mjs → SecurePaymentsKPI.vue_vue_type_script_setup_true_lang-Cqk-vonA.mjs} +24 -23
- package/dist/{SubscriptionsList.vue_vue_type_script_setup_true_lang-D-hpJL8I.js → SubscriptionsList.vue_vue_type_script_setup_true_lang-56vu59V4.js} +1 -1
- package/dist/{SubscriptionsList.vue_vue_type_script_setup_true_lang-B7IOIy-v.mjs → SubscriptionsList.vue_vue_type_script_setup_true_lang-DB1p61kZ.mjs} +4 -4
- package/dist/component-Bg2JVC_O.mjs +933 -0
- package/dist/component-Bs8oszfD.js +1 -0
- package/dist/components/BillingInformation/BillingInformation.cjs.js +1 -1
- package/dist/components/BillingInformation/BillingInformation.es.js +4 -4
- package/dist/components/BillingInformationForm/BillingInformationForm.cjs.js +1 -1
- package/dist/components/BillingInformationForm/BillingInformationForm.es.js +3 -3
- package/dist/components/CustomerPaymentMethods/CustomerPaymentMethods.cjs.js +1 -1
- package/dist/components/CustomerPaymentMethods/CustomerPaymentMethods.es.js +4 -4
- package/dist/components/Invoice/Invoice.cjs.js +1 -1
- package/dist/components/Invoice/Invoice.es.js +14 -13
- package/dist/components/InvoiceDetails/InvoiceDetails.cjs.js +1 -1
- package/dist/components/InvoiceDetails/InvoiceDetails.es.js +3 -3
- package/dist/components/InvoiceHeader/InvoiceHeader.ce.d.ts +3 -0
- package/dist/components/InvoiceHeader/InvoiceHeader.cjs.js +1 -0
- package/dist/components/InvoiceHeader/InvoiceHeader.es.js +123 -0
- package/dist/components/InvoicesList/InvoicesList.cjs.js +1 -1
- package/dist/components/InvoicesList/InvoicesList.es.js +3 -3
- package/dist/components/PaymentHistory/PaymentHistory.cjs.js +1 -1
- package/dist/components/PaymentHistory/PaymentHistory.es.js +3 -3
- package/dist/components/PaymentMethodForm/PaymentMethodForm.cjs.js +1 -1
- package/dist/components/PaymentMethodForm/PaymentMethodForm.es.js +11 -110
- package/dist/components/SubscriptionSchedules/SubscriptionSchedules.cjs.js +1 -1
- package/dist/components/SubscriptionSchedules/SubscriptionSchedules.es.js +5 -5
- package/dist/components/SubscriptionsList/SubscriptionsList.cjs.js +1 -1
- package/dist/components/SubscriptionsList/SubscriptionsList.es.js +5 -5
- package/dist/components/WalletBalances/WalletBalances.cjs.js +1 -1
- package/dist/components/WalletBalances/WalletBalances.es.js +3 -3
- package/dist/core/index.cjs.js +1 -1
- package/dist/core/index.es.js +1 -1
- package/dist/core/types.d.ts +4 -0
- package/dist/{customer-Bn6GdxP8.mjs → customer-Bv_fqXzO.mjs} +1 -1
- package/dist/{customer-CGyZojAB.js → customer-_W8gIX5m.js} +1 -1
- package/dist/{en-US-G2HBHqjq.js → en-US-C0gIE4Q1.js} +1 -1
- package/dist/{en-US-BKhsdJQ2.mjs → en-US-DAgOSlgv.mjs} +19 -12
- package/dist/index.cjs.js +1 -1
- package/dist/index.es.js +1 -1
- package/dist/{invoices-Rs-QBUGS.mjs → invoices-BGb0AwVF.mjs} +2 -2
- package/dist/{invoices-DDeL8tvI.js → invoices-D-OKipCg.js} +1 -1
- package/dist/{nl-NL-DvVsMfhA.js → nl-NL-Br7muSHK.js} +1 -1
- package/dist/{nl-NL-BdeAy1tY.mjs → nl-NL-DCsmrA8A.mjs} +9 -2
- package/dist/paymentMethods-DIbB759g.js +1 -0
- package/dist/{paymentMethods-DOH9-6M1.mjs → paymentMethods-DvqlWe96.mjs} +11 -3
- package/dist/{payments-DGPENXiS.mjs → payments-CpzTVrQM.mjs} +1 -1
- package/dist/{payments-C0vYbn5Q.js → payments-DMDDI3MK.js} +1 -1
- package/dist/{registry-7UKVW93Q.mjs → registry-B-If1W_u.mjs} +9 -3
- package/dist/registry-uG2isab0.js +1 -0
- package/dist/screens/Checkout/Checkout.cjs.js +1 -1
- package/dist/screens/Checkout/Checkout.es.js +103 -70
- package/dist/screens/CustomerOverview/CustomerOverview.cjs.js +1 -1
- package/dist/screens/CustomerOverview/CustomerOverview.es.js +13 -13
- package/dist/screens/PayInvoice/PayInvoice.cjs.js +1 -1
- package/dist/screens/PayInvoice/PayInvoice.es.js +45 -34
- package/dist/screens/PaymentMethodsManagement/PaymentMethodsManagement.ce.d.ts +3 -0
- package/dist/screens/PaymentMethodsManagement/PaymentMethodsManagement.cjs.js +1 -0
- package/dist/screens/PaymentMethodsManagement/PaymentMethodsManagement.es.js +231 -0
- package/dist/screens/UpgradeSubscription/UpgradeSubscription.cjs.js +1 -1
- package/dist/screens/UpgradeSubscription/UpgradeSubscription.es.js +29 -34
- package/dist/solvimon-web.css +1 -1
- package/dist/{subscriptions-BIGqt2N0.mjs → subscriptions-BPYyv09M.mjs} +2 -2
- package/dist/{subscriptions-CcpEwubd.js → subscriptions-CC61I6Nj.js} +1 -1
- package/dist/{adyen-D0yvZvq5.mjs → url-1Lbg5Yni.mjs} +35 -35
- package/dist/url-B6-3PkW2.js +1 -0
- package/dist/{useActionDispatchProvider-aqYyqIdb.js → useActionDispatchProvider-BHTknMoH.js} +1 -1
- package/dist/{useActionDispatchProvider-Ca1YbU61.mjs → useActionDispatchProvider-Dz8-e4gZ.mjs} +1 -1
- package/dist/{useCustomer-DUA8Y-2I.mjs → useCustomer-VVJi8z2w.mjs} +2 -2
- package/dist/{useCustomer-D9ZrqMFY.js → useCustomer-Z24KchWC.js} +1 -1
- package/dist/useIncrementalLoading-CuSndpP2.js +1 -0
- package/dist/{useIncrementalLoading-C1LKdVP8.mjs → useIncrementalLoading-DmOT2MXH.mjs} +4 -4
- package/dist/{useInvoiceData-HNnt3703.js → useInvoiceData-Bl87gzIS.js} +1 -1
- package/dist/{useInvoiceData-Bz4a2Mfa.mjs → useInvoiceData-Di5pLPM0.mjs} +2 -2
- package/dist/{useInvoicesList-DXBTGdcI.js → useInvoicesList-CFk-_oVK.js} +1 -1
- package/dist/{useInvoicesList-b2_fiHsc.mjs → useInvoicesList-z19cteaD.mjs} +4 -4
- package/dist/{useLoadInitialData-D0t-Lk3k.js → useLoadInitialData-CTqfiMTN.js} +1 -1
- package/dist/{useLoadInitialData-Cyp1xpuv.mjs → useLoadInitialData-CkpryfjF.mjs} +1 -1
- package/dist/{usePaymentMethodOptions-r0Opz7BC.mjs → usePaymentMethodOptions-BoGHJjng.mjs} +2 -2
- package/dist/{usePaymentMethodOptions-DgGDcVeE.js → usePaymentMethodOptions-BsCZnCQW.js} +1 -1
- package/dist/{usePaymentMethods-BHLXXaCa.js → usePaymentMethods-AC-4rrR9.js} +1 -1
- package/dist/{usePaymentMethods-C-NCtOom.mjs → usePaymentMethods-ocHmNoP7.mjs} +2 -2
- package/dist/{usePayments-DADpdoI7.js → usePayments-CgXZeWrU.js} +1 -1
- package/dist/{usePayments-BtByiIMy.mjs → usePayments-D85eB5l4.mjs} +3 -3
- package/dist/{usePortal-CpW3EDD-.mjs → usePortal-B1O1zgdV.mjs} +1 -1
- package/dist/{usePortal-DhaZBAGi.js → usePortal-DVD7PcWI.js} +1 -1
- package/dist/{useService-C0h9UlQW.js → useService-CHrkefKd.js} +1 -1
- package/dist/{useService-BcYQRxPS.mjs → useService-DF57xuDd.mjs} +1 -1
- package/dist/{useWalletBalanceItems-COzKSpmt.js → useWalletBalanceItems-BL-R5foK.js} +1 -1
- package/dist/{useWalletBalanceItems-DKz-2vUy.mjs → useWalletBalanceItems-COQDLfoZ.mjs} +3 -3
- package/dist/{vendor-ui-CdOX_IS-.mjs → vendor-ui-B8IlviSs.mjs} +6483 -5867
- package/dist/vendor-ui-C3Tq-qY_.js +1 -0
- package/package.json +5 -4
- package/dist/ContentWithAsideLayout-B5B8Kwaw.js +0 -1
- package/dist/CustomerPaymentMethods.vue_vue_type_script_setup_true_lang-zdBaVj-K.js +0 -1
- package/dist/PaymentIntegrationForm.vue_vue_type_script_setup_true_lang-BhGQB-c9.js +0 -1
- package/dist/SecurePaymentsKPI.vue_vue_type_script_setup_true_lang-BuJGxitV.js +0 -1
- package/dist/adyen-BvNyYAg-.js +0 -1
- package/dist/component-By_A1VHh.js +0 -1
- package/dist/component-CGfjV_7z.mjs +0 -889
- package/dist/paymentMethods-BR9w3qy8.js +0 -1
- package/dist/registry-DrV0jFnM.js +0 -1
- package/dist/useIncrementalLoading-FNH4k4a3.js +0 -1
- package/dist/vendor-ui-1SHma7t1.js +0 -1
|
@@ -1,142 +1,295 @@
|
|
|
1
|
-
import { defineComponent,
|
|
2
|
-
import { u as useIntl,
|
|
3
|
-
import { _ as _sfc_main$
|
|
4
|
-
import { c as createPaymentsService } from "./payments-
|
|
5
|
-
import { c as createPaymentMethodsService } from "./paymentMethods-
|
|
6
|
-
import {
|
|
7
|
-
const
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
1
|
+
import { defineComponent, ref, onMounted, onBeforeUnmount, watch, openBlock, createElementBlock, computed, createBlock, withCtx, unref, createVNode, createTextVNode, toDisplayString, createCommentVNode, createElementVNode, inject, Fragment, renderList } from "vue";
|
|
2
|
+
import { n as isEqual, u as useIntl, e as _sfc_main$7, A as _sfc_main$8, B as formatAmount, c as _sfc_main$9, W as _sfc_main$a } from "./vendor-ui-B8IlviSs.mjs";
|
|
3
|
+
import { t as toMinorUnitAmount, _ as _sfc_main$6, c as createReturnUrl, g as getQueryParam, P as PAYMENT_ACCEPTOR_ID_QUERY_STRING, m as mapAdyenPaymentMethods, a as getAdyenEnvironmentFromPaymentMethodOptionsResponse, b as getAdyenClientKeyFromPaymentMethodOptionsResponse, R as REDIRECT_RESULT_QUERY_STRING, d as transformObjectToAdyenObject } from "./url-1Lbg5Yni.mjs";
|
|
4
|
+
import { c as createPaymentsService } from "./payments-CpzTVrQM.mjs";
|
|
5
|
+
import { c as createPaymentMethodsService } from "./paymentMethods-DvqlWe96.mjs";
|
|
6
|
+
import { a as useLogger, E as EXPERIMENTAL_FEATURE_INJECTION_KEY } from "./component-Bg2JVC_O.mjs";
|
|
7
|
+
const isAdyenPaymentIntegration = (paymentMethodOption) => {
|
|
8
|
+
var _a;
|
|
9
|
+
return ((_a = paymentMethodOption.integration.payment_gateway) == null ? void 0 : _a.variant) === "ADYEN";
|
|
10
|
+
};
|
|
11
|
+
const isStripePaymentIntegration = (paymentMethodOption) => {
|
|
12
|
+
var _a;
|
|
13
|
+
return ((_a = paymentMethodOption.integration.payment_gateway) == null ? void 0 : _a.variant) === "STRIPE";
|
|
14
|
+
};
|
|
15
|
+
const isSelectedIntegration = ({
|
|
16
|
+
selectedIntegration,
|
|
17
|
+
paymentMethodOption
|
|
18
|
+
}) => {
|
|
19
|
+
var _a, _b;
|
|
20
|
+
return selectedIntegration === ((_b = (_a = paymentMethodOption.integration) == null ? void 0 : _a.payment_gateway) == null ? void 0 : _b.variant);
|
|
21
|
+
};
|
|
22
|
+
const STRIPE_SCRIPT_URL = "https://js.stripe.com/dahlia/stripe.js";
|
|
23
|
+
const STRIPE_FRAME_SRCDOC = `<!DOCTYPE html>
|
|
24
|
+
<html>
|
|
25
|
+
<head>
|
|
26
|
+
<meta charset="UTF-8">
|
|
27
|
+
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
28
|
+
<style>
|
|
29
|
+
* { box-sizing: border-box; margin: 0; padding: 0; }
|
|
30
|
+
body { overflow: hidden; }
|
|
31
|
+
</style>
|
|
32
|
+
</head>
|
|
33
|
+
<body>
|
|
34
|
+
<div id="stripe-root"></div>
|
|
35
|
+
<script src="${STRIPE_SCRIPT_URL}"><\/script>
|
|
36
|
+
<script>
|
|
37
|
+
(function () {
|
|
38
|
+
let stripe, elements, countryCode, email, name, parentOrigin;
|
|
39
|
+
|
|
40
|
+
window.addEventListener('message', function (event) {
|
|
41
|
+
if (!event.data || typeof event.data !== 'object') return;
|
|
42
|
+
if (event.source !== window.parent) return;
|
|
43
|
+
|
|
44
|
+
if (event.data.type === 'stripe:init') {
|
|
45
|
+
parentOrigin = event.origin;
|
|
46
|
+
countryCode = event.data.countryCode;
|
|
47
|
+
email = event.data.email;
|
|
48
|
+
name = event.data.name;
|
|
49
|
+
stripe = Stripe(event.data.publicKey);
|
|
50
|
+
elements = stripe.elements(event.data.options);
|
|
51
|
+
const paymentElement = elements.create('payment', { layout: { type: 'accordion', defaultCollapsed: false }, wallets: event.data.options.wallets, fields: event.data.options.fields });
|
|
52
|
+
|
|
53
|
+
paymentElement.on('ready', function () {
|
|
54
|
+
parent.postMessage({ type: 'stripe:ready' }, parentOrigin);
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
paymentElement.on('change', function (e) {
|
|
58
|
+
parent.postMessage({ type: 'stripe:change', paymentMethodType: e.value.type }, parentOrigin);
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
paymentElement.on('loaderror', function (e) {
|
|
62
|
+
parent.postMessage({
|
|
63
|
+
type: 'stripe:loaderror',
|
|
64
|
+
error: { message: e.error.message, type: e.error.type }
|
|
65
|
+
}, parentOrigin);
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
paymentElement.mount('#stripe-root');
|
|
69
|
+
|
|
70
|
+
new ResizeObserver(function () {
|
|
71
|
+
parent.postMessage({
|
|
72
|
+
type: 'stripe:resize',
|
|
73
|
+
height: document.documentElement.scrollHeight
|
|
74
|
+
}, parentOrigin);
|
|
75
|
+
}).observe(document.documentElement);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
if (event.data.type === 'stripe:submit') {
|
|
79
|
+
if (!elements || !parentOrigin || event.origin !== parentOrigin) return;
|
|
80
|
+
const submitEmail = 'email' in event.data ? event.data.email : email;
|
|
81
|
+
const submitName = 'name' in event.data ? event.data.name : name;
|
|
82
|
+
elements.submit().then(function (submitResult) {
|
|
83
|
+
if (submitResult.error) {
|
|
84
|
+
parent.postMessage({
|
|
85
|
+
type: 'stripe:submit:error',
|
|
86
|
+
error: {
|
|
87
|
+
message: submitResult.error.message,
|
|
88
|
+
type: submitResult.error.type,
|
|
89
|
+
code: submitResult.error.code
|
|
90
|
+
}
|
|
91
|
+
}, parentOrigin);
|
|
92
|
+
return;
|
|
93
|
+
}
|
|
94
|
+
const billingDetails = {};
|
|
95
|
+
if (countryCode) billingDetails.address = { country: countryCode };
|
|
96
|
+
if (submitEmail) billingDetails.email = submitEmail;
|
|
97
|
+
if (submitName) billingDetails.name = submitName;
|
|
98
|
+
const tokenParams = Object.keys(billingDetails).length
|
|
99
|
+
? { payment_method_data: { billing_details: billingDetails } }
|
|
100
|
+
: {};
|
|
101
|
+
stripe.createConfirmationToken({ elements: elements, params: tokenParams }).then(function (tokenResult) {
|
|
102
|
+
if (tokenResult.error) {
|
|
103
|
+
parent.postMessage({
|
|
104
|
+
type: 'stripe:submit:error',
|
|
105
|
+
error: {
|
|
106
|
+
message: tokenResult.error.message,
|
|
107
|
+
type: tokenResult.error.type,
|
|
108
|
+
code: tokenResult.error.code
|
|
109
|
+
}
|
|
110
|
+
}, parentOrigin);
|
|
111
|
+
return;
|
|
112
|
+
}
|
|
113
|
+
parent.postMessage({
|
|
114
|
+
type: 'stripe:submit:success',
|
|
115
|
+
confirmationTokenId: tokenResult.confirmationToken.id
|
|
116
|
+
}, parentOrigin);
|
|
117
|
+
});
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
});
|
|
121
|
+
})();
|
|
122
|
+
<\/script>
|
|
123
|
+
</body>
|
|
124
|
+
</html>`;
|
|
125
|
+
const _hoisted_1$1 = ["src", "height"];
|
|
126
|
+
const _sfc_main$5 = /* @__PURE__ */ defineComponent({
|
|
127
|
+
__name: "PaymentIntegrationFormStripeFrame",
|
|
128
|
+
props: {
|
|
129
|
+
publicKey: { type: String },
|
|
130
|
+
options: { type: Object },
|
|
131
|
+
countryCode: { type: String },
|
|
132
|
+
email: { type: String },
|
|
133
|
+
name: { type: String }
|
|
134
|
+
},
|
|
135
|
+
emits: ["ready", "change", "loaderror", "submit-success", "submit-error"],
|
|
136
|
+
setup(__props, { expose: __expose, emit: __emit }) {
|
|
137
|
+
const props = __props;
|
|
138
|
+
const emit = __emit;
|
|
139
|
+
__expose({ triggerSubmit });
|
|
140
|
+
const iframeRef = ref();
|
|
141
|
+
const iframeHeight = ref(0);
|
|
142
|
+
const iframeSrc = ref();
|
|
143
|
+
function sendInit() {
|
|
144
|
+
var _a, _b;
|
|
145
|
+
(_b = (_a = iframeRef.value) == null ? void 0 : _a.contentWindow) == null ? void 0 : _b.postMessage(
|
|
146
|
+
{
|
|
147
|
+
type: "stripe:init",
|
|
148
|
+
publicKey: props.publicKey,
|
|
149
|
+
options: props.options,
|
|
150
|
+
countryCode: props.countryCode,
|
|
151
|
+
email: props.email,
|
|
152
|
+
name: props.name
|
|
153
|
+
},
|
|
154
|
+
"*"
|
|
155
|
+
);
|
|
156
|
+
}
|
|
157
|
+
function triggerSubmit() {
|
|
158
|
+
var _a, _b;
|
|
159
|
+
(_b = (_a = iframeRef.value) == null ? void 0 : _a.contentWindow) == null ? void 0 : _b.postMessage(
|
|
160
|
+
{ type: "stripe:submit", email: props.email, name: props.name },
|
|
161
|
+
"*"
|
|
162
|
+
);
|
|
163
|
+
}
|
|
164
|
+
function isRecord(value) {
|
|
165
|
+
return typeof value === "object" && value !== null;
|
|
166
|
+
}
|
|
167
|
+
function handleMessage(event) {
|
|
168
|
+
if (!iframeRef.value || event.source !== iframeRef.value.contentWindow) return;
|
|
169
|
+
if (!isRecord(event.data)) return;
|
|
170
|
+
const data = event.data;
|
|
171
|
+
const type = data["type"];
|
|
172
|
+
if (typeof type !== "string" || !type.startsWith("stripe:")) return;
|
|
173
|
+
switch (type) {
|
|
174
|
+
case "stripe:ready":
|
|
175
|
+
emit("ready");
|
|
176
|
+
break;
|
|
177
|
+
case "stripe:change":
|
|
178
|
+
emit(
|
|
179
|
+
"change",
|
|
180
|
+
typeof data["paymentMethodType"] === "string" ? data["paymentMethodType"] : "card"
|
|
181
|
+
);
|
|
182
|
+
break;
|
|
183
|
+
case "stripe:loaderror": {
|
|
184
|
+
const raw = isRecord(data["error"]) ? data["error"] : {};
|
|
185
|
+
emit("loaderror", {
|
|
186
|
+
message: typeof raw["message"] === "string" ? raw["message"] : void 0,
|
|
187
|
+
type: typeof raw["type"] === "string" ? raw["type"] : void 0
|
|
188
|
+
});
|
|
189
|
+
break;
|
|
190
|
+
}
|
|
191
|
+
case "stripe:resize":
|
|
192
|
+
if (typeof data["height"] === "number") {
|
|
193
|
+
iframeHeight.value = data["height"];
|
|
194
|
+
}
|
|
195
|
+
break;
|
|
196
|
+
case "stripe:submit:success":
|
|
197
|
+
if (typeof data["confirmationTokenId"] === "string") {
|
|
198
|
+
emit("submit-success", data["confirmationTokenId"]);
|
|
199
|
+
}
|
|
200
|
+
break;
|
|
201
|
+
case "stripe:submit:error": {
|
|
202
|
+
const raw = isRecord(data["error"]) ? data["error"] : {};
|
|
203
|
+
emit("submit-error", {
|
|
204
|
+
message: typeof raw["message"] === "string" ? raw["message"] : void 0,
|
|
205
|
+
type: typeof raw["type"] === "string" ? raw["type"] : void 0,
|
|
206
|
+
code: typeof raw["code"] === "string" ? raw["code"] : void 0
|
|
207
|
+
});
|
|
208
|
+
break;
|
|
209
|
+
}
|
|
134
210
|
}
|
|
211
|
+
}
|
|
212
|
+
onMounted(() => {
|
|
213
|
+
const blob = new Blob([STRIPE_FRAME_SRCDOC], { type: "text/html" });
|
|
214
|
+
iframeSrc.value = URL.createObjectURL(blob);
|
|
215
|
+
window.addEventListener("message", handleMessage);
|
|
216
|
+
});
|
|
217
|
+
onBeforeUnmount(() => {
|
|
218
|
+
window.removeEventListener("message", handleMessage);
|
|
219
|
+
if (iframeSrc.value) URL.revokeObjectURL(iframeSrc.value);
|
|
220
|
+
});
|
|
221
|
+
watch(
|
|
222
|
+
() => props.options,
|
|
223
|
+
(newOptions, oldOptions) => {
|
|
224
|
+
if (isEqual(newOptions, oldOptions)) return;
|
|
225
|
+
sendInit();
|
|
226
|
+
},
|
|
227
|
+
{ deep: true }
|
|
228
|
+
);
|
|
229
|
+
return (_ctx, _cache) => {
|
|
230
|
+
return openBlock(), createElementBlock("iframe", {
|
|
231
|
+
ref_key: "iframeRef",
|
|
232
|
+
ref: iframeRef,
|
|
233
|
+
src: iframeSrc.value,
|
|
234
|
+
height: iframeHeight.value || void 0,
|
|
235
|
+
frameborder: "0",
|
|
236
|
+
style: { "width": "100%", "display": "block", "border": "none" },
|
|
237
|
+
title: "Payment form",
|
|
238
|
+
onLoad: sendInit
|
|
239
|
+
}, null, 40, _hoisted_1$1);
|
|
135
240
|
};
|
|
136
241
|
}
|
|
137
|
-
|
|
242
|
+
});
|
|
243
|
+
const STRIPE_WALLETS = { link: "never" };
|
|
244
|
+
const STRIPE_APPEARANCE = {
|
|
245
|
+
variables: { borderRadius: "4px", colorBackground: "rgba(243, 244, 246, 0.5)" },
|
|
246
|
+
rules: {
|
|
247
|
+
".TermsText": { fontSize: "14px" },
|
|
248
|
+
".Input": {
|
|
249
|
+
backgroundColor: "rgba(243, 244, 246, 0.5)",
|
|
250
|
+
fontSize: "14px",
|
|
251
|
+
borderColor: "rgb(229, 231, 235)"
|
|
252
|
+
}
|
|
253
|
+
}
|
|
138
254
|
};
|
|
139
|
-
|
|
255
|
+
function getFields(email, name) {
|
|
256
|
+
return {
|
|
257
|
+
billingDetails: {
|
|
258
|
+
address: { country: "never" },
|
|
259
|
+
...email ? { email: "never" } : {},
|
|
260
|
+
...name ? { name: "never" } : {}
|
|
261
|
+
}
|
|
262
|
+
};
|
|
263
|
+
}
|
|
264
|
+
function getFrameOptions({
|
|
265
|
+
amount,
|
|
266
|
+
email,
|
|
267
|
+
name,
|
|
268
|
+
variant
|
|
269
|
+
}) {
|
|
270
|
+
const currency = amount.currency.toLowerCase();
|
|
271
|
+
const fields = getFields(email, name);
|
|
272
|
+
if (variant === "TOKENIZE") {
|
|
273
|
+
return {
|
|
274
|
+
mode: "setup",
|
|
275
|
+
currency,
|
|
276
|
+
setup_future_usage: "off_session",
|
|
277
|
+
wallets: STRIPE_WALLETS,
|
|
278
|
+
fields,
|
|
279
|
+
appearance: STRIPE_APPEARANCE
|
|
280
|
+
};
|
|
281
|
+
}
|
|
282
|
+
return {
|
|
283
|
+
mode: "payment",
|
|
284
|
+
currency,
|
|
285
|
+
amount: toMinorUnitAmount(amount).value,
|
|
286
|
+
setup_future_usage: "off_session",
|
|
287
|
+
wallets: STRIPE_WALLETS,
|
|
288
|
+
fields,
|
|
289
|
+
appearance: STRIPE_APPEARANCE
|
|
290
|
+
};
|
|
291
|
+
}
|
|
292
|
+
const _sfc_main$4 = /* @__PURE__ */ defineComponent({
|
|
140
293
|
__name: "PaymentCompletedCard",
|
|
141
294
|
props: {
|
|
142
295
|
amount: { type: Object },
|
|
@@ -157,23 +310,23 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
|
|
|
157
310
|
})
|
|
158
311
|
);
|
|
159
312
|
return (_ctx, _cache) => {
|
|
160
|
-
return openBlock(), createBlock(_sfc_main$
|
|
313
|
+
return openBlock(), createBlock(_sfc_main$6, {
|
|
161
314
|
status: "success",
|
|
162
315
|
title: title.value
|
|
163
316
|
}, {
|
|
164
317
|
default: withCtx(() => [
|
|
165
|
-
__props.amount ? (openBlock(), createBlock(unref(_sfc_main$
|
|
318
|
+
__props.amount ? (openBlock(), createBlock(unref(_sfc_main$7), {
|
|
166
319
|
key: 0,
|
|
167
320
|
variant: "body-sm",
|
|
168
321
|
class: "mt-1"
|
|
169
322
|
}, {
|
|
170
323
|
default: withCtx(() => [
|
|
171
|
-
createVNode(unref(_sfc_main$
|
|
324
|
+
createVNode(unref(_sfc_main$8), { icon: "check" }),
|
|
172
325
|
createTextVNode(toDisplayString(unref(formatAmount)(__props.amount)), 1)
|
|
173
326
|
]),
|
|
174
327
|
_: 1
|
|
175
328
|
})) : createCommentVNode("", true),
|
|
176
|
-
createVNode(unref(_sfc_main$
|
|
329
|
+
createVNode(unref(_sfc_main$7), {
|
|
177
330
|
variant: "body-xs",
|
|
178
331
|
shade: "lighter"
|
|
179
332
|
}, {
|
|
@@ -230,7 +383,7 @@ const ErrorMap = {
|
|
|
230
383
|
}
|
|
231
384
|
};
|
|
232
385
|
const _hoisted_1 = { class: "flex flex-col items-center gap-6" };
|
|
233
|
-
const _sfc_main$
|
|
386
|
+
const _sfc_main$3 = /* @__PURE__ */ defineComponent({
|
|
234
387
|
__name: "PaymentErrorCard",
|
|
235
388
|
props: {
|
|
236
389
|
error: { type: Object }
|
|
@@ -243,13 +396,13 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
|
243
396
|
window.location.reload();
|
|
244
397
|
};
|
|
245
398
|
return (_ctx, _cache) => {
|
|
246
|
-
return openBlock(), createBlock(_sfc_main$
|
|
399
|
+
return openBlock(), createBlock(_sfc_main$6, {
|
|
247
400
|
status: "error",
|
|
248
401
|
title: errorConfig.value.title
|
|
249
402
|
}, {
|
|
250
403
|
default: withCtx(() => [
|
|
251
404
|
createElementVNode("div", _hoisted_1, [
|
|
252
|
-
createVNode(unref(_sfc_main$
|
|
405
|
+
createVNode(unref(_sfc_main$7), {
|
|
253
406
|
variant: "body-xs",
|
|
254
407
|
shade: "lighter",
|
|
255
408
|
class: "mt-3"
|
|
@@ -259,7 +412,7 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
|
259
412
|
]),
|
|
260
413
|
_: 1
|
|
261
414
|
}),
|
|
262
|
-
errorConfig.value.isReloadButtonVisible ? (openBlock(), createBlock(unref(_sfc_main$
|
|
415
|
+
errorConfig.value.isReloadButtonVisible ? (openBlock(), createBlock(unref(_sfc_main$9), {
|
|
263
416
|
key: 0,
|
|
264
417
|
type: "button",
|
|
265
418
|
color: "gray",
|
|
@@ -282,6 +435,398 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
|
282
435
|
};
|
|
283
436
|
}
|
|
284
437
|
});
|
|
438
|
+
const PAYMENT_GATEWAY_VARIANT_STRIPE = "STRIPE";
|
|
439
|
+
const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
440
|
+
__name: "PaymentIntegrationFormStripe",
|
|
441
|
+
props: {
|
|
442
|
+
countryCode: { type: String },
|
|
443
|
+
customerId: { type: String },
|
|
444
|
+
invoiceId: { type: String },
|
|
445
|
+
paymentMethodOptionResponseEntry: { type: Object },
|
|
446
|
+
variant: { type: String },
|
|
447
|
+
selected: { type: Boolean },
|
|
448
|
+
amount: { type: Object },
|
|
449
|
+
validateOnSubmit: { type: Function, default: () => Promise.resolve(true) },
|
|
450
|
+
context: { type: Object },
|
|
451
|
+
email: { type: String },
|
|
452
|
+
name: { type: String },
|
|
453
|
+
forceStorePaymentMethod: { type: Boolean }
|
|
454
|
+
},
|
|
455
|
+
emits: ["select", "payment-failed", "payment-success", "ready"],
|
|
456
|
+
setup(__props, { expose: __expose, emit: __emit }) {
|
|
457
|
+
const props = __props;
|
|
458
|
+
const emit = __emit;
|
|
459
|
+
__expose({ submit });
|
|
460
|
+
const showPaymentSuccess = ref(false);
|
|
461
|
+
const integrationError = ref();
|
|
462
|
+
const frameRef = ref();
|
|
463
|
+
const frameOptions = computed(
|
|
464
|
+
() => getFrameOptions({ amount: props.amount, email: props.email, name: props.name, variant: props.variant })
|
|
465
|
+
);
|
|
466
|
+
const stripeInstance = ref(null);
|
|
467
|
+
const logger = useLogger();
|
|
468
|
+
const { authorizePayment } = createPaymentsService();
|
|
469
|
+
const { tokenizePaymentMethod } = createPaymentMethodsService();
|
|
470
|
+
const publicKey = computed(
|
|
471
|
+
() => {
|
|
472
|
+
var _a, _b;
|
|
473
|
+
return (_b = (_a = props.paymentMethodOptionResponseEntry.integration.payment_gateway) == null ? void 0 : _a.stripe) == null ? void 0 : _b.public_key;
|
|
474
|
+
}
|
|
475
|
+
);
|
|
476
|
+
function submit() {
|
|
477
|
+
handleSubmit().catch((error) => {
|
|
478
|
+
logger.error(
|
|
479
|
+
"STRIPE_SUBMIT_FAILED",
|
|
480
|
+
"Unexpected error during Stripe submission",
|
|
481
|
+
{},
|
|
482
|
+
error
|
|
483
|
+
);
|
|
484
|
+
});
|
|
485
|
+
}
|
|
486
|
+
async function handleSubmit() {
|
|
487
|
+
var _a;
|
|
488
|
+
const isValid = await props.validateOnSubmit();
|
|
489
|
+
if (!isValid) {
|
|
490
|
+
return;
|
|
491
|
+
}
|
|
492
|
+
(_a = frameRef.value) == null ? void 0 : _a.triggerSubmit();
|
|
493
|
+
}
|
|
494
|
+
function loadStripeDahlia(key) {
|
|
495
|
+
return new Promise((resolve, reject) => {
|
|
496
|
+
if (window.Stripe) {
|
|
497
|
+
resolve(window.Stripe(key));
|
|
498
|
+
return;
|
|
499
|
+
}
|
|
500
|
+
const script = document.createElement("script");
|
|
501
|
+
script.src = STRIPE_SCRIPT_URL;
|
|
502
|
+
script.onload = () => {
|
|
503
|
+
if (!window.Stripe) {
|
|
504
|
+
reject(new Error("Stripe not available after script load"));
|
|
505
|
+
return;
|
|
506
|
+
}
|
|
507
|
+
resolve(window.Stripe(key));
|
|
508
|
+
};
|
|
509
|
+
script.onerror = () => reject(new Error("Failed to load Stripe.js"));
|
|
510
|
+
document.head.appendChild(script);
|
|
511
|
+
});
|
|
512
|
+
}
|
|
513
|
+
async function getStripeInstance() {
|
|
514
|
+
if (stripeInstance.value) {
|
|
515
|
+
return stripeInstance.value;
|
|
516
|
+
}
|
|
517
|
+
const key = publicKey.value;
|
|
518
|
+
if (!key) {
|
|
519
|
+
throw new Error("Missing Stripe public key");
|
|
520
|
+
}
|
|
521
|
+
const stripe = await loadStripeDahlia(key);
|
|
522
|
+
stripeInstance.value = stripe;
|
|
523
|
+
return stripe;
|
|
524
|
+
}
|
|
525
|
+
async function handleConfirmationToken(confirmationTokenId) {
|
|
526
|
+
const paymentAcceptorId = props.paymentMethodOptionResponseEntry.payment_acceptor.id;
|
|
527
|
+
const returnUrl = createReturnUrl({
|
|
528
|
+
paymentAcceptorId,
|
|
529
|
+
redirectUrl: window.location.href
|
|
530
|
+
});
|
|
531
|
+
if (props.variant === "AUTHORIZE") {
|
|
532
|
+
try {
|
|
533
|
+
const result = await authorizePayment({
|
|
534
|
+
payment_acceptor_id: paymentAcceptorId,
|
|
535
|
+
...props.customerId ? { customer_id: props.customerId } : {},
|
|
536
|
+
payment_gateway_variant: PAYMENT_GATEWAY_VARIANT_STRIPE,
|
|
537
|
+
stripe: { confirmation_token_id: confirmationTokenId },
|
|
538
|
+
amount: props.amount,
|
|
539
|
+
...props.context && props.context.type !== "CHARGE_ON_DEMAND" ? { context: props.context } : {},
|
|
540
|
+
return_url: returnUrl
|
|
541
|
+
});
|
|
542
|
+
await handlePaymentResult(result);
|
|
543
|
+
} catch (error) {
|
|
544
|
+
logger.error(
|
|
545
|
+
"PAYMENT_AUTHORIZATION_FAILED",
|
|
546
|
+
`Failed payment authorization for payment acceptor with id ${paymentAcceptorId}`,
|
|
547
|
+
{ error }
|
|
548
|
+
);
|
|
549
|
+
emitError({ code: "UNKNOWN_ERROR", message: "Payment authorization failed", error });
|
|
550
|
+
}
|
|
551
|
+
return;
|
|
552
|
+
}
|
|
553
|
+
if (props.variant === "TOKENIZE") {
|
|
554
|
+
if (!props.customerId) {
|
|
555
|
+
logger.error(
|
|
556
|
+
"TOKENIZATION_FAILED",
|
|
557
|
+
`Missing customer id for payment acceptor with id ${paymentAcceptorId}`
|
|
558
|
+
);
|
|
559
|
+
return;
|
|
560
|
+
}
|
|
561
|
+
try {
|
|
562
|
+
const result = await tokenizePaymentMethod({
|
|
563
|
+
customer_id: props.customerId,
|
|
564
|
+
payment_acceptor_id: paymentAcceptorId,
|
|
565
|
+
payment_gateway_variant: PAYMENT_GATEWAY_VARIANT_STRIPE,
|
|
566
|
+
stripe: { confirmation_token_id: confirmationTokenId },
|
|
567
|
+
return_url: returnUrl
|
|
568
|
+
});
|
|
569
|
+
await handlePaymentResult(result);
|
|
570
|
+
} catch (error) {
|
|
571
|
+
logger.error(
|
|
572
|
+
"TOKENIZATION_FAILED",
|
|
573
|
+
`Tokenization failed for payment acceptor with id ${paymentAcceptorId}`,
|
|
574
|
+
{ error }
|
|
575
|
+
);
|
|
576
|
+
emitError({ code: "UNKNOWN_ERROR", message: "Tokenization failed", error });
|
|
577
|
+
}
|
|
578
|
+
}
|
|
579
|
+
}
|
|
580
|
+
async function handlePaymentResult(result) {
|
|
581
|
+
var _a;
|
|
582
|
+
if (result.status === "ACTION_REQUIRED" && result.action.payment_gateway_variant === PAYMENT_GATEWAY_VARIANT_STRIPE) {
|
|
583
|
+
const clientSecret = result.action.client_secret || ((_a = result.action.data) == null ? void 0 : _a.client_secret);
|
|
584
|
+
if (!clientSecret) {
|
|
585
|
+
logger.error(
|
|
586
|
+
"STRIPE_ACTION_FAILED",
|
|
587
|
+
"Missing client_secret in Stripe ACTION_REQUIRED response"
|
|
588
|
+
);
|
|
589
|
+
emitError({ code: "UNKNOWN_ERROR", message: "Payment action failed", error: result });
|
|
590
|
+
return;
|
|
591
|
+
}
|
|
592
|
+
let stripe;
|
|
593
|
+
try {
|
|
594
|
+
stripe = await getStripeInstance();
|
|
595
|
+
} catch (error2) {
|
|
596
|
+
logger.error("STRIPE_ACTION_FAILED", "Failed to load Stripe.js", { error: error2 });
|
|
597
|
+
emitError({ code: "UNKNOWN_ERROR", message: "Payment action failed", error: error2 });
|
|
598
|
+
return;
|
|
599
|
+
}
|
|
600
|
+
const { error } = await stripe.handleNextAction({ clientSecret });
|
|
601
|
+
if (error) {
|
|
602
|
+
logger.error("STRIPE_ACTION_FAILED", "Stripe handleNextAction failed", { error });
|
|
603
|
+
emitError({ code: "UNKNOWN_ERROR", message: "Payment action failed", error });
|
|
604
|
+
return;
|
|
605
|
+
}
|
|
606
|
+
showPaymentSuccess.value = true;
|
|
607
|
+
emit("payment-success");
|
|
608
|
+
return;
|
|
609
|
+
}
|
|
610
|
+
if (result.status === "SUCCESS") {
|
|
611
|
+
showPaymentSuccess.value = true;
|
|
612
|
+
emit("payment-success");
|
|
613
|
+
return;
|
|
614
|
+
}
|
|
615
|
+
logger.error("STRIPE_ACTION_FAILED", "Unexpected payment result status", { error: result });
|
|
616
|
+
emitError({ code: "UNKNOWN_ERROR", message: "Payment failed", error: result });
|
|
617
|
+
}
|
|
618
|
+
async function handleRedirectReturn() {
|
|
619
|
+
const paymentAcceptorId = props.paymentMethodOptionResponseEntry.payment_acceptor.id;
|
|
620
|
+
const urlPaymentAcceptorId = getQueryParam(PAYMENT_ACCEPTOR_ID_QUERY_STRING);
|
|
621
|
+
if (urlPaymentAcceptorId !== paymentAcceptorId) return;
|
|
622
|
+
const redirectStatus = getQueryParam("redirect_status");
|
|
623
|
+
const paymentIntentClientSecret = getQueryParam("payment_intent_client_secret");
|
|
624
|
+
const setupIntentClientSecret = getQueryParam("setup_intent_client_secret");
|
|
625
|
+
if (!redirectStatus || !paymentIntentClientSecret && !setupIntentClientSecret) return;
|
|
626
|
+
if (redirectStatus === "succeeded") {
|
|
627
|
+
showPaymentSuccess.value = true;
|
|
628
|
+
emit("payment-success");
|
|
629
|
+
return;
|
|
630
|
+
}
|
|
631
|
+
logger.error("STRIPE_REDIRECT_RETURN_FAILED", "Stripe redirect returned non-succeeded status", {
|
|
632
|
+
redirectStatus
|
|
633
|
+
});
|
|
634
|
+
emitError({
|
|
635
|
+
code: "UNKNOWN_ERROR",
|
|
636
|
+
message: "Payment failed",
|
|
637
|
+
error: new globalThis.Error(`Stripe redirect returned status: ${redirectStatus}`)
|
|
638
|
+
});
|
|
639
|
+
}
|
|
640
|
+
function handleReady() {
|
|
641
|
+
emit("select", {
|
|
642
|
+
paymentMethodType: "card",
|
|
643
|
+
paymentGatewayVariant: PAYMENT_GATEWAY_VARIANT_STRIPE
|
|
644
|
+
});
|
|
645
|
+
emit("ready");
|
|
646
|
+
}
|
|
647
|
+
function handleLoadError(error) {
|
|
648
|
+
emitError({
|
|
649
|
+
code: "UNKNOWN_ERROR",
|
|
650
|
+
message: error.message ?? "Failed to load payment form",
|
|
651
|
+
error
|
|
652
|
+
});
|
|
653
|
+
}
|
|
654
|
+
function emitError(err) {
|
|
655
|
+
integrationError.value = err;
|
|
656
|
+
emit("payment-failed", err);
|
|
657
|
+
}
|
|
658
|
+
onMounted(() => {
|
|
659
|
+
handleRedirectReturn().catch((error) => {
|
|
660
|
+
logger.error("STRIPE_REDIRECT_RETURN_FAILED", "handleRedirectReturn threw unexpectedly", {
|
|
661
|
+
error
|
|
662
|
+
});
|
|
663
|
+
});
|
|
664
|
+
});
|
|
665
|
+
onBeforeUnmount(() => {
|
|
666
|
+
stripeInstance.value = null;
|
|
667
|
+
});
|
|
668
|
+
return (_ctx, _cache) => {
|
|
669
|
+
return showPaymentSuccess.value ? (openBlock(), createBlock(_sfc_main$4, {
|
|
670
|
+
key: 0,
|
|
671
|
+
variant: __props.variant
|
|
672
|
+
}, null, 8, ["variant"])) : integrationError.value ? (openBlock(), createBlock(_sfc_main$3, {
|
|
673
|
+
key: 1,
|
|
674
|
+
error: integrationError.value
|
|
675
|
+
}, null, 8, ["error"])) : publicKey.value ? (openBlock(), createBlock(_sfc_main$5, {
|
|
676
|
+
key: 2,
|
|
677
|
+
ref_key: "frameRef",
|
|
678
|
+
ref: frameRef,
|
|
679
|
+
"public-key": publicKey.value,
|
|
680
|
+
options: frameOptions.value,
|
|
681
|
+
"country-code": __props.countryCode,
|
|
682
|
+
email: __props.email,
|
|
683
|
+
name: __props.name,
|
|
684
|
+
onReady: handleReady,
|
|
685
|
+
onChange: _cache[0] || (_cache[0] = (type) => emit("select", {
|
|
686
|
+
paymentMethodType: type,
|
|
687
|
+
paymentGatewayVariant: PAYMENT_GATEWAY_VARIANT_STRIPE
|
|
688
|
+
})),
|
|
689
|
+
onLoaderror: handleLoadError,
|
|
690
|
+
onSubmitSuccess: handleConfirmationToken,
|
|
691
|
+
onSubmitError: _cache[1] || (_cache[1] = (error) => unref(logger).error("STRIPE_CONFIRMATION_TOKEN_FAILED", "Stripe submission failed", {
|
|
692
|
+
error
|
|
693
|
+
}))
|
|
694
|
+
}, null, 8, ["public-key", "options", "country-code", "email", "name"])) : createCommentVNode("", true);
|
|
695
|
+
};
|
|
696
|
+
}
|
|
697
|
+
});
|
|
698
|
+
const getOverriddenTranslations = (variant) => {
|
|
699
|
+
let result = {};
|
|
700
|
+
if (variant === "TOKENIZE") {
|
|
701
|
+
result = {
|
|
702
|
+
"en-US": {
|
|
703
|
+
payButton: "Add payment method",
|
|
704
|
+
confirmPurchase: "Add payment method"
|
|
705
|
+
},
|
|
706
|
+
"fr-FR": {
|
|
707
|
+
payButton: "Ajouter un moyen de paiement",
|
|
708
|
+
confirmPurchase: "Ajouter un moyen de paiement"
|
|
709
|
+
},
|
|
710
|
+
"de-DE": {
|
|
711
|
+
payButton: "Zahlungsmethode hinzufügen",
|
|
712
|
+
confirmPurchase: "Zahlungsmethode hinzufügen"
|
|
713
|
+
},
|
|
714
|
+
"it-IT": {
|
|
715
|
+
payButton: "Aggiungi metodo di pagamento",
|
|
716
|
+
confirmPurchase: "Aggiungi metodo di pagamento"
|
|
717
|
+
},
|
|
718
|
+
"es-ES": {
|
|
719
|
+
payButton: "Añadir método de pago",
|
|
720
|
+
confirmPurchase: "Añadir método de pago"
|
|
721
|
+
},
|
|
722
|
+
"nl-NL": {
|
|
723
|
+
payButton: "Betaalmethode toevoegen",
|
|
724
|
+
confirmPurchase: "Betaalmethode toevoegen"
|
|
725
|
+
},
|
|
726
|
+
"pt-BR": {
|
|
727
|
+
payButton: "Adicionar método de pagamento",
|
|
728
|
+
confirmPurchase: "Adicionar método de pagamento"
|
|
729
|
+
},
|
|
730
|
+
"pt-PT": {
|
|
731
|
+
payButton: "Adicionar método de pagamento",
|
|
732
|
+
confirmPurchase: "Adicionar método de pagamento"
|
|
733
|
+
},
|
|
734
|
+
"pl-PL": {
|
|
735
|
+
payButton: "Dodaj metodę płatności",
|
|
736
|
+
confirmPurchase: "Dodaj metodę płatności"
|
|
737
|
+
},
|
|
738
|
+
"ru-RU": {
|
|
739
|
+
payButton: "Добавить способ оплаты",
|
|
740
|
+
confirmPurchase: "Добавить способ оплаты"
|
|
741
|
+
},
|
|
742
|
+
"sv-SE": {
|
|
743
|
+
payButton: "Lägg till betalningsmetod",
|
|
744
|
+
confirmPurchase: "Lägg till betalningsmetod"
|
|
745
|
+
},
|
|
746
|
+
"da-DK": {
|
|
747
|
+
payButton: "Tilføj betalingsmetode",
|
|
748
|
+
confirmPurchase: "Tilføj betalingsmetode"
|
|
749
|
+
},
|
|
750
|
+
"fi-FI": {
|
|
751
|
+
payButton: "Lisää maksutapa",
|
|
752
|
+
confirmPurchase: "Lisää maksutapa"
|
|
753
|
+
},
|
|
754
|
+
"no-NO": {
|
|
755
|
+
payButton: "Legg til betalingsmetode",
|
|
756
|
+
confirmPurchase: "Legg til betalingsmetode"
|
|
757
|
+
},
|
|
758
|
+
"cs-CZ": {
|
|
759
|
+
payButton: "Přidat platební metodu",
|
|
760
|
+
confirmPurchase: "Přidat platební metodu"
|
|
761
|
+
},
|
|
762
|
+
"hu-HU": {
|
|
763
|
+
payButton: "Fizetési mód hozzáadása",
|
|
764
|
+
confirmPurchase: "Fizetési mód hozzáadása"
|
|
765
|
+
},
|
|
766
|
+
"ro-RO": {
|
|
767
|
+
payButton: "Adăugați metodă de plată",
|
|
768
|
+
confirmPurchase: "Adăugați metodă de plată"
|
|
769
|
+
},
|
|
770
|
+
"ja-JP": {
|
|
771
|
+
payButton: "支払い方法を追加",
|
|
772
|
+
confirmPurchase: "支払い方法を追加"
|
|
773
|
+
},
|
|
774
|
+
"ko-KR": {
|
|
775
|
+
payButton: "결제 수단 추가",
|
|
776
|
+
confirmPurchase: "결제 수단 추가"
|
|
777
|
+
},
|
|
778
|
+
"zh-CN": {
|
|
779
|
+
payButton: "添加支付方式",
|
|
780
|
+
confirmPurchase: "添加支付方式"
|
|
781
|
+
},
|
|
782
|
+
"zh-TW": {
|
|
783
|
+
payButton: "新增付款方式",
|
|
784
|
+
confirmPurchase: "新增付款方式"
|
|
785
|
+
},
|
|
786
|
+
ar: {
|
|
787
|
+
payButton: "إضافة وسيلة دفع",
|
|
788
|
+
confirmPurchase: "إضافة وسيلة دفع"
|
|
789
|
+
},
|
|
790
|
+
"hr-HR": {
|
|
791
|
+
payButton: "Dodajte način plačanja",
|
|
792
|
+
confirmPurchase: "Dodajte način plačanja"
|
|
793
|
+
},
|
|
794
|
+
"el-GR": {
|
|
795
|
+
payButton: "Προσθήκη μεθόδου πληρωμής",
|
|
796
|
+
confirmPurchase: "Προσθήκη μεθόδου πληρωμής"
|
|
797
|
+
},
|
|
798
|
+
"sk-SK": {
|
|
799
|
+
payButton: "Pridať spôsob platby",
|
|
800
|
+
confirmPurchase: "Pridať spôsob platby"
|
|
801
|
+
},
|
|
802
|
+
"sl-SI": {
|
|
803
|
+
payButton: "Dodajte način plačanja",
|
|
804
|
+
confirmPurchase: "Dodajte način plačanja"
|
|
805
|
+
},
|
|
806
|
+
"bg-BG": {
|
|
807
|
+
payButton: "Добавяне на начин на плащане",
|
|
808
|
+
confirmPurchase: "Добавяне на начин на плащане"
|
|
809
|
+
},
|
|
810
|
+
"ca-ES": {
|
|
811
|
+
payButton: "Afegir mètode de pagament",
|
|
812
|
+
confirmPurchase: "Afegir mètode de pagament"
|
|
813
|
+
},
|
|
814
|
+
"et-EE": {
|
|
815
|
+
payButton: "Lisa makseviis",
|
|
816
|
+
confirmPurchase: "Lisa makseviis"
|
|
817
|
+
},
|
|
818
|
+
"lv-LV": {
|
|
819
|
+
payButton: "Pievienot maksājuma veidu",
|
|
820
|
+
confirmPurchase: "Pievienot maksājuma veidu"
|
|
821
|
+
},
|
|
822
|
+
"lt-LT": {
|
|
823
|
+
payButton: "Pridėti mokėjimo metodą",
|
|
824
|
+
confirmPurchase: "Pridėti mokėjimo metodą"
|
|
825
|
+
}
|
|
826
|
+
};
|
|
827
|
+
}
|
|
828
|
+
return result;
|
|
829
|
+
};
|
|
285
830
|
const useExperimentalFeature = () => {
|
|
286
831
|
const experimentalFeature = inject(EXPERIMENTAL_FEATURE_INJECTION_KEY);
|
|
287
832
|
return experimentalFeature;
|
|
@@ -325,7 +870,6 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
325
870
|
const { authorizePayment, getPaymentDetails } = createPaymentsService();
|
|
326
871
|
const { tokenizePaymentMethod } = createPaymentMethodsService();
|
|
327
872
|
const experimentalFeatures = useExperimentalFeature();
|
|
328
|
-
const showPayButton = computed(() => props.variant === "TOKENIZE");
|
|
329
873
|
function submit() {
|
|
330
874
|
try {
|
|
331
875
|
dropInInstance == null ? void 0 : dropInInstance.submit();
|
|
@@ -335,7 +879,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
335
879
|
}
|
|
336
880
|
async function getConfiguration() {
|
|
337
881
|
var _a;
|
|
338
|
-
const adyenAmount =
|
|
882
|
+
const adyenAmount = toMinorUnitAmount(props.amount);
|
|
339
883
|
const paymentMethods = ((_a = experimentalFeatures == null ? void 0 : experimentalFeatures.value) == null ? void 0 : _a["express-checkout"]) ? filterOutExpressPaymentMethods(
|
|
340
884
|
mapAdyenPaymentMethods(props.paymentMethodOptionResponseEntry)
|
|
341
885
|
) : mapAdyenPaymentMethods(props.paymentMethodOptionResponseEntry);
|
|
@@ -359,7 +903,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
359
903
|
onPaymentCompleted: handleOnPaymentCompleted,
|
|
360
904
|
onPaymentFailed: handleOnPaymentFailed,
|
|
361
905
|
onError: handleOnError,
|
|
362
|
-
showPayButton:
|
|
906
|
+
showPayButton: false
|
|
363
907
|
},
|
|
364
908
|
dropInConfig: {
|
|
365
909
|
disableFinalAnimation: true,
|
|
@@ -855,10 +1399,10 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
855
1399
|
);
|
|
856
1400
|
return (_ctx, _cache) => {
|
|
857
1401
|
return openBlock(), createElementBlock(Fragment, null, [
|
|
858
|
-
showPaymentSuccess.value ? (openBlock(), createBlock(_sfc_main$
|
|
1402
|
+
showPaymentSuccess.value ? (openBlock(), createBlock(_sfc_main$4, {
|
|
859
1403
|
key: 0,
|
|
860
1404
|
variant: __props.variant
|
|
861
|
-
}, null, 8, ["variant"])) : integrationError.value ? (openBlock(), createBlock(_sfc_main$
|
|
1405
|
+
}, null, 8, ["variant"])) : integrationError.value ? (openBlock(), createBlock(_sfc_main$3, {
|
|
862
1406
|
key: 1,
|
|
863
1407
|
error: integrationError.value
|
|
864
1408
|
}, null, 8, ["error"])) : createCommentVNode("", true),
|
|
@@ -881,6 +1425,8 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
881
1425
|
invoiceId: { type: String },
|
|
882
1426
|
amount: { type: Object },
|
|
883
1427
|
selectedOption: { type: String },
|
|
1428
|
+
email: { type: String },
|
|
1429
|
+
name: { type: String },
|
|
884
1430
|
validateOnSubmit: { type: Function },
|
|
885
1431
|
forceStorePaymentMethod: { type: Boolean }
|
|
886
1432
|
},
|
|
@@ -890,17 +1436,29 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
890
1436
|
const emit = __emit;
|
|
891
1437
|
__expose({ submit });
|
|
892
1438
|
const { $t } = useIntl();
|
|
893
|
-
const
|
|
1439
|
+
const userSelectedIntegration = ref();
|
|
1440
|
+
const selectedIntegration = computed(
|
|
1441
|
+
() => {
|
|
1442
|
+
var _a, _b;
|
|
1443
|
+
return userSelectedIntegration.value ?? ((_b = (_a = props.paymentMethodOptions[0]) == null ? void 0 : _a.integration.payment_gateway) == null ? void 0 : _b.variant);
|
|
1444
|
+
}
|
|
1445
|
+
);
|
|
894
1446
|
const integrationRefs = ref(/* @__PURE__ */ new Map());
|
|
895
1447
|
const showIntegrationError = ref(false);
|
|
896
|
-
|
|
1448
|
+
const handleSelect = ({
|
|
897
1449
|
paymentGatewayVariant,
|
|
898
1450
|
paymentMethodType
|
|
899
|
-
}) {
|
|
1451
|
+
}) => {
|
|
900
1452
|
showIntegrationError.value = false;
|
|
901
|
-
|
|
1453
|
+
userSelectedIntegration.value = paymentGatewayVariant;
|
|
902
1454
|
emit("select", { paymentGatewayVariant, paymentMethodType });
|
|
903
|
-
}
|
|
1455
|
+
};
|
|
1456
|
+
const setIntegrationRef = (paymentMethodOption) => {
|
|
1457
|
+
return (el) => {
|
|
1458
|
+
var _a;
|
|
1459
|
+
return integrationRefs.value.set((_a = paymentMethodOption.integration.payment_gateway) == null ? void 0 : _a.variant, el);
|
|
1460
|
+
};
|
|
1461
|
+
};
|
|
904
1462
|
function submit() {
|
|
905
1463
|
var _a, _b;
|
|
906
1464
|
if (!selectedIntegration.value) {
|
|
@@ -912,17 +1470,13 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
912
1470
|
return (_ctx, _cache) => {
|
|
913
1471
|
return openBlock(), createElementBlock(Fragment, null, [
|
|
914
1472
|
(openBlock(true), createElementBlock(Fragment, null, renderList(__props.paymentMethodOptions, (paymentMethodOption) => {
|
|
915
|
-
var _a;
|
|
916
1473
|
return openBlock(), createElementBlock(Fragment, {
|
|
917
1474
|
key: paymentMethodOption.integration.id
|
|
918
1475
|
}, [
|
|
919
|
-
((
|
|
1476
|
+
unref(isAdyenPaymentIntegration)(paymentMethodOption) ? (openBlock(), createBlock(_sfc_main$1, {
|
|
920
1477
|
key: 0,
|
|
921
1478
|
ref_for: true,
|
|
922
|
-
ref: (
|
|
923
|
-
paymentMethodOption.integration.payment_gateway.variant,
|
|
924
|
-
el
|
|
925
|
-
),
|
|
1479
|
+
ref: setIntegrationRef(paymentMethodOption),
|
|
926
1480
|
context: __props.context,
|
|
927
1481
|
"payment-method-option-response-entry": paymentMethodOption,
|
|
928
1482
|
"country-code": __props.countryCode,
|
|
@@ -930,17 +1484,37 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
930
1484
|
variant: __props.variant,
|
|
931
1485
|
amount: __props.amount,
|
|
932
1486
|
"invoice-id": __props.invoiceId,
|
|
933
|
-
selected: selectedIntegration.value
|
|
1487
|
+
selected: unref(isSelectedIntegration)({ selectedIntegration: selectedIntegration.value, paymentMethodOption }),
|
|
934
1488
|
"validate-on-submit": __props.validateOnSubmit,
|
|
935
1489
|
"force-store-payment-method": __props.forceStorePaymentMethod,
|
|
936
1490
|
onSelect: handleSelect,
|
|
937
1491
|
onPaymentFailed: _cache[0] || (_cache[0] = ($event) => _ctx.$emit("payment-failed", $event)),
|
|
938
1492
|
onPaymentSuccess: _cache[1] || (_cache[1] = ($event) => _ctx.$emit("payment-success")),
|
|
939
1493
|
onReady: _cache[2] || (_cache[2] = ($event) => _ctx.$emit("ready"))
|
|
940
|
-
}, null, 8, ["context", "payment-method-option-response-entry", "country-code", "customer-id", "variant", "amount", "invoice-id", "selected", "validate-on-submit", "force-store-payment-method"])) :
|
|
1494
|
+
}, null, 8, ["context", "payment-method-option-response-entry", "country-code", "customer-id", "variant", "amount", "invoice-id", "selected", "validate-on-submit", "force-store-payment-method"])) : unref(isStripePaymentIntegration)(paymentMethodOption) ? (openBlock(), createBlock(_sfc_main$2, {
|
|
1495
|
+
key: 1,
|
|
1496
|
+
ref_for: true,
|
|
1497
|
+
ref: setIntegrationRef(paymentMethodOption),
|
|
1498
|
+
context: __props.context,
|
|
1499
|
+
"payment-method-option-response-entry": paymentMethodOption,
|
|
1500
|
+
"country-code": __props.countryCode,
|
|
1501
|
+
"customer-id": __props.customerId,
|
|
1502
|
+
variant: __props.variant,
|
|
1503
|
+
amount: __props.amount,
|
|
1504
|
+
"invoice-id": __props.invoiceId,
|
|
1505
|
+
selected: unref(isSelectedIntegration)({ selectedIntegration: selectedIntegration.value, paymentMethodOption }),
|
|
1506
|
+
email: __props.email,
|
|
1507
|
+
name: __props.name,
|
|
1508
|
+
"validate-on-submit": __props.validateOnSubmit,
|
|
1509
|
+
"force-store-payment-method": __props.forceStorePaymentMethod,
|
|
1510
|
+
onSelect: handleSelect,
|
|
1511
|
+
onPaymentFailed: _cache[3] || (_cache[3] = ($event) => _ctx.$emit("payment-failed", $event)),
|
|
1512
|
+
onPaymentSuccess: _cache[4] || (_cache[4] = ($event) => _ctx.$emit("payment-success")),
|
|
1513
|
+
onReady: _cache[5] || (_cache[5] = ($event) => _ctx.$emit("ready"))
|
|
1514
|
+
}, null, 8, ["context", "payment-method-option-response-entry", "country-code", "customer-id", "variant", "amount", "invoice-id", "selected", "email", "name", "validate-on-submit", "force-store-payment-method"])) : createCommentVNode("", true)
|
|
941
1515
|
], 64);
|
|
942
1516
|
}), 128)),
|
|
943
|
-
showIntegrationError.value ? (openBlock(), createBlock(unref(_sfc_main$
|
|
1517
|
+
showIntegrationError.value ? (openBlock(), createBlock(unref(_sfc_main$a), {
|
|
944
1518
|
key: 0,
|
|
945
1519
|
variant: "error",
|
|
946
1520
|
class: "mt-2"
|