@bcc-code/payment-client 1.0.8 → 1.1.1
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/README.md +89 -6
- package/dist/components/index.js +1 -1
- package/dist/components/index.mjs +274 -139
- package/dist/index.d.mts +9 -1
- package/dist/index.d.ts +9 -1
- package/dist/index.js +30 -0
- package/dist/index.mjs +30 -0
- package/dist/styles/adyen.css +1 -1
- package/package.json +1 -1
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { defineComponent as R, ref as
|
|
2
|
-
const
|
|
1
|
+
import { defineComponent as R, ref as D, computed as S, onMounted as A, onUnmounted as I, watch as E, createElementBlock as v, openBlock as b, createElementVNode as o, createCommentVNode as C, toDisplayString as _ } from "vue";
|
|
2
|
+
const $ = { class: "stripe-elements" }, x = {
|
|
3
3
|
key: 0,
|
|
4
4
|
class: "elements-loading"
|
|
5
|
-
},
|
|
5
|
+
}, B = {
|
|
6
6
|
key: 1,
|
|
7
7
|
class: "elements-error"
|
|
8
|
-
},
|
|
8
|
+
}, O = {
|
|
9
9
|
key: 2,
|
|
10
10
|
class: "payment-button-container"
|
|
11
|
-
},
|
|
11
|
+
}, M = ["disabled"], H = /* @__PURE__ */ R({
|
|
12
12
|
__name: "StripePayment",
|
|
13
13
|
props: {
|
|
14
14
|
paymentId: {},
|
|
@@ -24,10 +24,10 @@ const x = { class: "stripe-elements" }, M = {
|
|
|
24
24
|
returnUrl: { default: void 0 }
|
|
25
25
|
},
|
|
26
26
|
emits: ["submit", "success", "error", "ready"],
|
|
27
|
-
setup(
|
|
28
|
-
const
|
|
29
|
-
let
|
|
30
|
-
const
|
|
27
|
+
setup(h, { expose: P, emit: m }) {
|
|
28
|
+
const e = h, a = m, p = D(), u = D(!0), n = D(!1), c = D("");
|
|
29
|
+
let d = null, f = null, y = null;
|
|
30
|
+
const K = S(() => ({
|
|
31
31
|
EUR: "€",
|
|
32
32
|
USD: "$",
|
|
33
33
|
GBP: "£",
|
|
@@ -38,34 +38,34 @@ const x = { class: "stripe-elements" }, M = {
|
|
|
38
38
|
PLN: "zł",
|
|
39
39
|
CZK: "Kč",
|
|
40
40
|
HUF: "Ft"
|
|
41
|
-
})[
|
|
42
|
-
if (
|
|
41
|
+
})[e.currency] || e.currency), N = S(() => e.amount.toFixed(2)), s = S(() => {
|
|
42
|
+
if (e.clientData)
|
|
43
43
|
try {
|
|
44
|
-
const
|
|
45
|
-
return
|
|
44
|
+
const r = JSON.parse(e.clientData);
|
|
45
|
+
return r.clientSecret || r.client_secret;
|
|
46
46
|
} catch {
|
|
47
47
|
return;
|
|
48
48
|
}
|
|
49
|
-
}),
|
|
50
|
-
if (!
|
|
51
|
-
let
|
|
52
|
-
if (!
|
|
49
|
+
}), i = async () => {
|
|
50
|
+
if (!p.value) return;
|
|
51
|
+
let r = e.publishableKey;
|
|
52
|
+
if (!r && e.clientData)
|
|
53
53
|
try {
|
|
54
|
-
const
|
|
55
|
-
|
|
54
|
+
const l = JSON.parse(e.clientData);
|
|
55
|
+
r = l.publishableKey || l.publishable_key;
|
|
56
56
|
} catch {
|
|
57
57
|
}
|
|
58
|
-
if (!
|
|
59
|
-
|
|
58
|
+
if (!r) {
|
|
59
|
+
c.value = "Publishable key is required", u.value = !1;
|
|
60
60
|
return;
|
|
61
61
|
}
|
|
62
62
|
try {
|
|
63
|
-
u.value = !0,
|
|
64
|
-
const { loadStripe:
|
|
65
|
-
if (
|
|
63
|
+
u.value = !0, c.value = "";
|
|
64
|
+
const { loadStripe: l } = await import("@stripe/stripe-js");
|
|
65
|
+
if (d = await l(r), !d)
|
|
66
66
|
throw new Error("Failed to load Stripe");
|
|
67
|
-
const
|
|
68
|
-
appearance:
|
|
67
|
+
const t = s.value, w = {
|
|
68
|
+
appearance: e.appearance || {
|
|
69
69
|
theme: "stripe",
|
|
70
70
|
variables: {
|
|
71
71
|
colorPrimary: "#0570de",
|
|
@@ -77,10 +77,10 @@ const x = { class: "stripe-elements" }, M = {
|
|
|
77
77
|
borderRadius: "4px"
|
|
78
78
|
}
|
|
79
79
|
},
|
|
80
|
-
loader:
|
|
81
|
-
locale:
|
|
80
|
+
loader: e.loader,
|
|
81
|
+
locale: e.locale
|
|
82
82
|
};
|
|
83
|
-
|
|
83
|
+
t && (w.clientSecret = t), f = d.elements(w), y = f.create("payment", {
|
|
84
84
|
layout: "tabs",
|
|
85
85
|
defaultValues: {
|
|
86
86
|
billingDetails: {
|
|
@@ -89,86 +89,86 @@ const x = { class: "stripe-elements" }, M = {
|
|
|
89
89
|
phone: ""
|
|
90
90
|
}
|
|
91
91
|
}
|
|
92
|
-
}),
|
|
93
|
-
u.value = !1,
|
|
94
|
-
}),
|
|
95
|
-
|
|
92
|
+
}), y.mount(p.value), y.on("ready", () => {
|
|
93
|
+
u.value = !1, a("ready");
|
|
94
|
+
}), y.on("change", (U) => {
|
|
95
|
+
U.error ? (c.value = U.error.message, a("error", U.error)) : c.value = "";
|
|
96
96
|
});
|
|
97
|
-
} catch (
|
|
98
|
-
|
|
97
|
+
} catch (l) {
|
|
98
|
+
c.value = l instanceof Error ? l.message : "Failed to initialize payment form", u.value = !1, a("error", l);
|
|
99
99
|
}
|
|
100
|
-
},
|
|
101
|
-
if (!(!
|
|
102
|
-
|
|
100
|
+
}, k = async () => {
|
|
101
|
+
if (!(!d || !y)) {
|
|
102
|
+
n.value = !0, c.value = "";
|
|
103
103
|
try {
|
|
104
|
-
const
|
|
105
|
-
elements:
|
|
104
|
+
const r = e.returnUrl || `${window.location.origin}/payment/return`, { error: l, paymentIntent: t } = await d.confirmPayment({
|
|
105
|
+
elements: f,
|
|
106
106
|
confirmParams: {
|
|
107
|
-
return_url:
|
|
107
|
+
return_url: r
|
|
108
108
|
},
|
|
109
109
|
redirect: "if_required"
|
|
110
110
|
});
|
|
111
|
-
|
|
112
|
-
paymentIntent:
|
|
111
|
+
l ? (c.value = l.message || "Payment failed", a("error", l)) : t ? t.status === "succeeded" ? a("success", {
|
|
112
|
+
paymentIntent: t,
|
|
113
113
|
status: "succeeded",
|
|
114
114
|
message: "Payment completed successfully!"
|
|
115
|
-
}) :
|
|
116
|
-
paymentIntent:
|
|
115
|
+
}) : t.status === "processing" ? a("success", {
|
|
116
|
+
paymentIntent: t,
|
|
117
117
|
status: "processing",
|
|
118
118
|
message: "Payment is being processed..."
|
|
119
|
-
}) :
|
|
120
|
-
} catch (
|
|
121
|
-
|
|
119
|
+
}) : a("submit", { paymentIntent: t, status: t.status }) : a("submit", y);
|
|
120
|
+
} catch (r) {
|
|
121
|
+
c.value = r instanceof Error ? r.message : "Payment failed", a("error", r);
|
|
122
122
|
} finally {
|
|
123
|
-
|
|
123
|
+
n.value = !1;
|
|
124
124
|
}
|
|
125
125
|
}
|
|
126
|
-
},
|
|
127
|
-
|
|
126
|
+
}, g = () => {
|
|
127
|
+
y && (y.destroy(), y = null), f && (f = null), d && (d = null);
|
|
128
128
|
};
|
|
129
|
-
return
|
|
130
|
-
|
|
131
|
-
}),
|
|
132
|
-
|
|
133
|
-
}), E(() =>
|
|
134
|
-
|
|
135
|
-
}), E([() =>
|
|
136
|
-
(
|
|
137
|
-
}),
|
|
138
|
-
destroyElements:
|
|
139
|
-
}), (
|
|
140
|
-
|
|
129
|
+
return A(() => {
|
|
130
|
+
i();
|
|
131
|
+
}), I(() => {
|
|
132
|
+
g();
|
|
133
|
+
}), E(() => e.currency, () => {
|
|
134
|
+
g(), i();
|
|
135
|
+
}), E([() => e.publishableKey, () => e.clientData], () => {
|
|
136
|
+
(e.publishableKey || e.clientData) && (g(), i());
|
|
137
|
+
}), P({
|
|
138
|
+
destroyElements: g
|
|
139
|
+
}), (r, l) => (b(), v("div", $, [
|
|
140
|
+
o("div", {
|
|
141
141
|
ref_key: "elementsContainer",
|
|
142
|
-
ref:
|
|
142
|
+
ref: p,
|
|
143
143
|
class: "elements-container"
|
|
144
144
|
}, null, 512),
|
|
145
|
-
u.value ? (
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
])])) :
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
145
|
+
u.value ? (b(), v("div", x, [...l[0] || (l[0] = [
|
|
146
|
+
o("div", { class: "loading-spinner" }, null, -1),
|
|
147
|
+
o("p", null, "Loading payment form...", -1)
|
|
148
|
+
])])) : C("", !0),
|
|
149
|
+
c.value ? (b(), v("div", B, [
|
|
150
|
+
l[1] || (l[1] = o("div", { class: "error-icon" }, " ⚠️ ", -1)),
|
|
151
|
+
o("p", null, _(c.value), 1),
|
|
152
|
+
o("button", {
|
|
153
153
|
class: "retry-btn",
|
|
154
|
-
onClick:
|
|
154
|
+
onClick: i
|
|
155
155
|
}, " Retry ")
|
|
156
|
-
])) :
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
disabled:
|
|
156
|
+
])) : C("", !0),
|
|
157
|
+
h.showPayButton && !u.value && !c.value ? (b(), v("div", O, [
|
|
158
|
+
o("button", {
|
|
159
|
+
disabled: n.value,
|
|
160
160
|
class: "payment-button",
|
|
161
|
-
onClick:
|
|
162
|
-
},
|
|
163
|
-
])) :
|
|
161
|
+
onClick: k
|
|
162
|
+
}, _(n.value ? "Processing..." : `Pay ${K.value}${N.value}`), 9, M)
|
|
163
|
+
])) : C("", !0)
|
|
164
164
|
]));
|
|
165
165
|
}
|
|
166
|
-
}),
|
|
167
|
-
const
|
|
168
|
-
for (const [
|
|
169
|
-
|
|
170
|
-
return
|
|
171
|
-
},
|
|
166
|
+
}), F = (h, P) => {
|
|
167
|
+
const m = h.__vccOpts || h;
|
|
168
|
+
for (const [e, a] of P)
|
|
169
|
+
m[e] = a;
|
|
170
|
+
return m;
|
|
171
|
+
}, ne = /* @__PURE__ */ F(H, [["__scopeId", "data-v-adbdf3c5"]]), z = /* @__PURE__ */ R({
|
|
172
172
|
__name: "AdyenPayment",
|
|
173
173
|
props: {
|
|
174
174
|
paymentId: {},
|
|
@@ -181,64 +181,64 @@ const x = { class: "stripe-elements" }, M = {
|
|
|
181
181
|
onCancel: { type: Function }
|
|
182
182
|
},
|
|
183
183
|
emits: ["submit", "additionalDetails", "error", "ready", "success"],
|
|
184
|
-
setup(
|
|
185
|
-
const
|
|
186
|
-
if (!
|
|
184
|
+
setup(h, { emit: P }) {
|
|
185
|
+
const m = h, e = P, a = D(null), p = () => {
|
|
186
|
+
if (!m.clientData)
|
|
187
187
|
return console.error("No clientData provided"), null;
|
|
188
188
|
try {
|
|
189
|
-
const
|
|
190
|
-
return console.log("Parsed Adyen session data:",
|
|
191
|
-
id:
|
|
192
|
-
sessionData:
|
|
193
|
-
amount:
|
|
194
|
-
reference:
|
|
195
|
-
returnUrl:
|
|
196
|
-
merchantAccount:
|
|
189
|
+
const n = JSON.parse(m.clientData);
|
|
190
|
+
return console.log("Parsed Adyen session data:", n), {
|
|
191
|
+
id: n.id,
|
|
192
|
+
sessionData: n.sessionData,
|
|
193
|
+
amount: n.amount,
|
|
194
|
+
reference: n.reference,
|
|
195
|
+
returnUrl: n.returnUrl,
|
|
196
|
+
merchantAccount: n.merchantAccount
|
|
197
197
|
};
|
|
198
|
-
} catch (
|
|
199
|
-
return console.error("Failed to parse clientData:",
|
|
198
|
+
} catch (n) {
|
|
199
|
+
return console.error("Failed to parse clientData:", n), null;
|
|
200
200
|
}
|
|
201
201
|
}, u = async () => {
|
|
202
|
-
var
|
|
203
|
-
if (!
|
|
202
|
+
var c;
|
|
203
|
+
if (!m.clientKey || !a.value) {
|
|
204
204
|
console.error("Initialization failed: Missing clientKey or container.");
|
|
205
205
|
return;
|
|
206
206
|
}
|
|
207
|
-
const
|
|
208
|
-
if (!
|
|
209
|
-
console.error("Failed to parse session data"),
|
|
207
|
+
const n = p();
|
|
208
|
+
if (!n) {
|
|
209
|
+
console.error("Failed to parse session data"), e("error", new Error("Failed to parse session data"));
|
|
210
210
|
return;
|
|
211
211
|
}
|
|
212
212
|
try {
|
|
213
|
-
const { AdyenCheckout:
|
|
214
|
-
environment:
|
|
215
|
-
clientKey:
|
|
216
|
-
session:
|
|
217
|
-
onPaymentCompleted: (
|
|
218
|
-
console.info("Payment Completed:",
|
|
213
|
+
const { AdyenCheckout: d, Card: f, ApplePay: y, GooglePay: K, Klarna: N, Blik: s, Dropin: i } = await import("@adyen/adyen-web"), k = {
|
|
214
|
+
environment: m.environment || "test",
|
|
215
|
+
clientKey: m.clientKey,
|
|
216
|
+
session: n,
|
|
217
|
+
onPaymentCompleted: (t, w) => {
|
|
218
|
+
console.info("Payment Completed:", t, w), e("submit", t), t.resultCode === "Authorised" || t.resultCode === "Received" ? (console.info("Payment Successful:", t), e("success", {
|
|
219
219
|
status: "succeeded",
|
|
220
220
|
message: "Payment completed successfully",
|
|
221
|
-
resultCode:
|
|
222
|
-
pspReference:
|
|
223
|
-
paymentData:
|
|
224
|
-
})) :
|
|
221
|
+
resultCode: t.resultCode,
|
|
222
|
+
pspReference: t.pspReference,
|
|
223
|
+
paymentData: t
|
|
224
|
+
})) : t.resultCode === "Pending" ? (console.info("Payment Pending:", t), 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: t.resultCode,
|
|
228
|
+
pspReference: t.pspReference,
|
|
229
|
+
paymentData: t
|
|
230
|
+
})) : (t.resultCode === "Refused" || t.resultCode === "Error") && (console.error("Payment Failed:", t), e("error", {
|
|
231
|
+
message: t.refusalReason || "Payment was declined",
|
|
232
|
+
resultCode: t.resultCode,
|
|
233
|
+
paymentData: t
|
|
234
234
|
}));
|
|
235
235
|
},
|
|
236
|
-
onError: (
|
|
237
|
-
console.error("Adyen Error:",
|
|
236
|
+
onError: (t, w) => {
|
|
237
|
+
console.error("Adyen Error:", t.name, t.message, t.stack, w), e("error", t);
|
|
238
238
|
}
|
|
239
|
-
},
|
|
239
|
+
}, g = {
|
|
240
240
|
showPayButton: !0,
|
|
241
|
-
paymentMethodComponents: [
|
|
241
|
+
paymentMethodComponents: [f, y, K, N, s],
|
|
242
242
|
paymentMethodsConfiguration: {
|
|
243
243
|
card: {
|
|
244
244
|
hasHolderName: !0,
|
|
@@ -259,26 +259,161 @@ const x = { class: "stripe-elements" }, M = {
|
|
|
259
259
|
// BLIK configuration for Polish market
|
|
260
260
|
}
|
|
261
261
|
}
|
|
262
|
-
},
|
|
263
|
-
console.log("Adyen Checkout created:",
|
|
264
|
-
const
|
|
265
|
-
console.log("Adyen Drop-in created with session payment methods"),
|
|
266
|
-
} catch (
|
|
267
|
-
console.error("Error creating Adyen Drop-in:",
|
|
262
|
+
}, r = await d(k);
|
|
263
|
+
console.log("Adyen Checkout created:", r), console.log("Available payment methods from session:", (c = r.paymentMethodsResponse) == null ? void 0 : c.paymentMethods);
|
|
264
|
+
const l = new i(r, g);
|
|
265
|
+
console.log("Adyen Drop-in created with session payment methods"), a.value && (l.mount(a.value), console.log("Adyen Drop-in mounted successfully"), e("ready"));
|
|
266
|
+
} catch (d) {
|
|
267
|
+
console.error("Error creating Adyen Drop-in:", d), e("error", d);
|
|
268
268
|
}
|
|
269
269
|
};
|
|
270
|
-
return
|
|
270
|
+
return A(() => {
|
|
271
271
|
u();
|
|
272
|
-
}), E(() =>
|
|
273
|
-
|
|
274
|
-
}), (
|
|
272
|
+
}), E(() => m.clientData, () => {
|
|
273
|
+
a.value && (a.value.innerHTML = "", u());
|
|
274
|
+
}), (n, c) => (b(), v("div", {
|
|
275
275
|
ref_key: "dropinContainer",
|
|
276
|
-
ref:
|
|
276
|
+
ref: a,
|
|
277
277
|
class: "payment-dropin"
|
|
278
278
|
}, null, 512));
|
|
279
279
|
}
|
|
280
|
-
}),
|
|
280
|
+
}), ae = /* @__PURE__ */ F(z, [["__scopeId", "data-v-ef2ec054"]]), T = { class: "delayed-payment" }, L = { class: "payment-form" }, q = { class: "amount-display" }, J = { class: "amount-value" }, V = {
|
|
281
|
+
key: 0,
|
|
282
|
+
class: "session-info"
|
|
283
|
+
}, G = {
|
|
284
|
+
key: 0,
|
|
285
|
+
class: "info-row"
|
|
286
|
+
}, j = { class: "value" }, W = {
|
|
287
|
+
key: 1,
|
|
288
|
+
class: "info-row"
|
|
289
|
+
}, X = { class: "value" }, Y = {
|
|
290
|
+
key: 1,
|
|
291
|
+
class: "error-message"
|
|
292
|
+
}, Z = { class: "button-container" }, Q = ["disabled"], ee = /* @__PURE__ */ R({
|
|
293
|
+
__name: "DelayedPayment",
|
|
294
|
+
props: {
|
|
295
|
+
paymentId: { default: void 0 },
|
|
296
|
+
clientData: { default: void 0 },
|
|
297
|
+
amount: {},
|
|
298
|
+
currency: {},
|
|
299
|
+
tenantId: { default: void 0 }
|
|
300
|
+
},
|
|
301
|
+
emits: ["submit", "success", "error", "ready"],
|
|
302
|
+
setup(h, { expose: P, emit: m }) {
|
|
303
|
+
const e = h, a = m, p = D(!1), u = D(""), n = D({}), c = S(() => ({
|
|
304
|
+
EUR: "€",
|
|
305
|
+
USD: "$",
|
|
306
|
+
GBP: "£",
|
|
307
|
+
CHF: "CHF",
|
|
308
|
+
NOK: "kr",
|
|
309
|
+
SEK: "kr",
|
|
310
|
+
DKK: "kr",
|
|
311
|
+
PLN: "zł"
|
|
312
|
+
})[e.currency] || e.currency), d = S(() => e.amount.toFixed(2)), f = S(() => n.value.invoiceNumber && n.value.providerUid), y = () => {
|
|
313
|
+
if (!e.clientData) {
|
|
314
|
+
console.error("No clientData provided for delayed payment");
|
|
315
|
+
return;
|
|
316
|
+
}
|
|
317
|
+
try {
|
|
318
|
+
const s = JSON.parse(e.clientData);
|
|
319
|
+
console.log("Parsed delayed payment session data:", s), n.value = {
|
|
320
|
+
invoiceNumber: s.invoiceNumber,
|
|
321
|
+
merchantReference: s.merchantReference,
|
|
322
|
+
providerUid: s.providerUid,
|
|
323
|
+
paymentUid: s.paymentUid
|
|
324
|
+
}, a("ready");
|
|
325
|
+
} catch (s) {
|
|
326
|
+
console.error("Failed to parse clientData:", s), u.value = "Invalid session data", a("error", s);
|
|
327
|
+
}
|
|
328
|
+
}, K = async () => {
|
|
329
|
+
if (!(!f.value || p.value)) {
|
|
330
|
+
p.value = !0, u.value = "";
|
|
331
|
+
try {
|
|
332
|
+
const s = {
|
|
333
|
+
provider: "delayed-payment",
|
|
334
|
+
amount: e.amount,
|
|
335
|
+
currency: e.currency,
|
|
336
|
+
invoiceNumber: n.value.invoiceNumber,
|
|
337
|
+
merchantReference: n.value.merchantReference,
|
|
338
|
+
providerUid: n.value.providerUid,
|
|
339
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
340
|
+
};
|
|
341
|
+
if (a("submit", s), !e.paymentId)
|
|
342
|
+
throw new Error("Payment ID not provided");
|
|
343
|
+
const i = window.location.origin, k = {
|
|
344
|
+
"Content-Type": "application/json"
|
|
345
|
+
};
|
|
346
|
+
e.tenantId && (k["X-Tenant-ID"] = e.tenantId);
|
|
347
|
+
const g = await fetch(
|
|
348
|
+
`${i}/api/v1/webhooks/delayed-payments/confirm/${e.paymentId}`,
|
|
349
|
+
{
|
|
350
|
+
method: "POST",
|
|
351
|
+
headers: k
|
|
352
|
+
}
|
|
353
|
+
);
|
|
354
|
+
if (!g.ok) {
|
|
355
|
+
const r = await g.text();
|
|
356
|
+
throw new Error(`Failed to confirm payment: ${r}`);
|
|
357
|
+
}
|
|
358
|
+
a("success", {
|
|
359
|
+
status: "succeeded",
|
|
360
|
+
message: "Payment confirmed successfully. You will receive a receipt shortly.",
|
|
361
|
+
resultCode: "Authorised",
|
|
362
|
+
invoiceNumber: n.value.invoiceNumber,
|
|
363
|
+
providerUid: n.value.providerUid,
|
|
364
|
+
paymentData: s
|
|
365
|
+
});
|
|
366
|
+
} catch (s) {
|
|
367
|
+
u.value = s instanceof Error ? s.message : "Failed to confirm payment", a("error", s);
|
|
368
|
+
} finally {
|
|
369
|
+
p.value = !1;
|
|
370
|
+
}
|
|
371
|
+
}
|
|
372
|
+
}, N = () => {
|
|
373
|
+
u.value = "";
|
|
374
|
+
};
|
|
375
|
+
return A(() => {
|
|
376
|
+
y();
|
|
377
|
+
}), P({
|
|
378
|
+
clearError: N
|
|
379
|
+
}), (s, i) => (b(), v("div", T, [
|
|
380
|
+
o("div", L, [
|
|
381
|
+
i[4] || (i[4] = o("div", { class: "info-section" }, [
|
|
382
|
+
o("div", { class: "info-icon" }, " 📄 "),
|
|
383
|
+
o("h3", { class: "info-title" }, " Delayed Payment "),
|
|
384
|
+
o("p", { class: "info-description" }, " Payment will be processed manually via invoice or bank transfer ")
|
|
385
|
+
], -1)),
|
|
386
|
+
o("div", q, [
|
|
387
|
+
i[0] || (i[0] = o("span", { class: "amount-label" }, "Amount to pay:", -1)),
|
|
388
|
+
o("span", J, _(c.value) + _(d.value), 1)
|
|
389
|
+
]),
|
|
390
|
+
f.value ? (b(), v("div", V, [
|
|
391
|
+
n.value.invoiceNumber ? (b(), v("div", G, [
|
|
392
|
+
i[1] || (i[1] = o("span", { class: "label" }, "Invoice Number:", -1)),
|
|
393
|
+
o("span", j, _(n.value.invoiceNumber), 1)
|
|
394
|
+
])) : C("", !0),
|
|
395
|
+
n.value.merchantReference ? (b(), v("div", W, [
|
|
396
|
+
i[2] || (i[2] = o("span", { class: "label" }, "Reference:", -1)),
|
|
397
|
+
o("span", X, _(n.value.merchantReference), 1)
|
|
398
|
+
])) : C("", !0)
|
|
399
|
+
])) : C("", !0),
|
|
400
|
+
u.value ? (b(), v("div", Y, [
|
|
401
|
+
i[3] || (i[3] = o("div", { class: "error-icon" }, " ⚠️ ", -1)),
|
|
402
|
+
o("p", null, _(u.value), 1)
|
|
403
|
+
])) : C("", !0),
|
|
404
|
+
o("div", Z, [
|
|
405
|
+
o("button", {
|
|
406
|
+
disabled: p.value || !f.value,
|
|
407
|
+
class: "submit-button",
|
|
408
|
+
onClick: K
|
|
409
|
+
}, _(p.value ? "Processing..." : `Confirm Payment ${c.value}${d.value}`), 9, Q)
|
|
410
|
+
])
|
|
411
|
+
])
|
|
412
|
+
]));
|
|
413
|
+
}
|
|
414
|
+
}), oe = /* @__PURE__ */ F(ee, [["__scopeId", "data-v-4d12cc1a"]]);
|
|
281
415
|
export {
|
|
282
|
-
|
|
283
|
-
|
|
416
|
+
ae as AdyenPayment,
|
|
417
|
+
oe as DelayedPayment,
|
|
418
|
+
ne as StripePayment
|
|
284
419
|
};
|
package/dist/index.d.mts
CHANGED
|
@@ -115,6 +115,13 @@ interface PaymentSucceededNotification {
|
|
|
115
115
|
status: string;
|
|
116
116
|
timestamp: string;
|
|
117
117
|
}
|
|
118
|
+
interface GetPaymentMethodsOptions {
|
|
119
|
+
provider?: string;
|
|
120
|
+
currency?: string;
|
|
121
|
+
amount?: number;
|
|
122
|
+
churchId?: string;
|
|
123
|
+
isCompany?: boolean;
|
|
124
|
+
}
|
|
118
125
|
|
|
119
126
|
interface PaymentClientOptions {
|
|
120
127
|
baseUrl: string;
|
|
@@ -133,6 +140,7 @@ declare class PaymentClient {
|
|
|
133
140
|
getPayment(paymentId: string): Promise<PaymentResponse | null>;
|
|
134
141
|
getReceipt(paymentId: string): Promise<PaymentReceiptResponse | null>;
|
|
135
142
|
getTotalAmountByPrefix(prefix: string): Promise<number>;
|
|
143
|
+
getPaymentMethods(options?: GetPaymentMethodsOptions): Promise<unknown>;
|
|
136
144
|
}
|
|
137
145
|
|
|
138
146
|
interface StripePaymentProps {
|
|
@@ -158,4 +166,4 @@ interface AdyenPaymentProps {
|
|
|
158
166
|
onCancel?: () => void;
|
|
159
167
|
}
|
|
160
168
|
|
|
161
|
-
export { type AdyenPaymentProps, type CreatePaymentRequest, type CreatePaymentResponse, type InvoiceRecipientRequest, type LineItemRequest, type LineItemResponse, PaymentClient, type PaymentClientOptions, type PaymentReceiptResponse, type PaymentResponse, type PaymentSucceededNotification, type PersonInfoRequest, type StripePaymentProps };
|
|
169
|
+
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 };
|
package/dist/index.d.ts
CHANGED
|
@@ -115,6 +115,13 @@ interface PaymentSucceededNotification {
|
|
|
115
115
|
status: string;
|
|
116
116
|
timestamp: string;
|
|
117
117
|
}
|
|
118
|
+
interface GetPaymentMethodsOptions {
|
|
119
|
+
provider?: string;
|
|
120
|
+
currency?: string;
|
|
121
|
+
amount?: number;
|
|
122
|
+
churchId?: string;
|
|
123
|
+
isCompany?: boolean;
|
|
124
|
+
}
|
|
118
125
|
|
|
119
126
|
interface PaymentClientOptions {
|
|
120
127
|
baseUrl: string;
|
|
@@ -133,6 +140,7 @@ declare class PaymentClient {
|
|
|
133
140
|
getPayment(paymentId: string): Promise<PaymentResponse | null>;
|
|
134
141
|
getReceipt(paymentId: string): Promise<PaymentReceiptResponse | null>;
|
|
135
142
|
getTotalAmountByPrefix(prefix: string): Promise<number>;
|
|
143
|
+
getPaymentMethods(options?: GetPaymentMethodsOptions): Promise<unknown>;
|
|
136
144
|
}
|
|
137
145
|
|
|
138
146
|
interface StripePaymentProps {
|
|
@@ -158,4 +166,4 @@ interface AdyenPaymentProps {
|
|
|
158
166
|
onCancel?: () => void;
|
|
159
167
|
}
|
|
160
168
|
|
|
161
|
-
export { type AdyenPaymentProps, type CreatePaymentRequest, type CreatePaymentResponse, type InvoiceRecipientRequest, type LineItemRequest, type LineItemResponse, PaymentClient, type PaymentClientOptions, type PaymentReceiptResponse, type PaymentResponse, type PaymentSucceededNotification, type PersonInfoRequest, type StripePaymentProps };
|
|
169
|
+
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 };
|
package/dist/index.js
CHANGED
|
@@ -131,6 +131,36 @@ var PaymentClient = class {
|
|
|
131
131
|
}
|
|
132
132
|
return await response.json();
|
|
133
133
|
}
|
|
134
|
+
async getPaymentMethods(options = {}) {
|
|
135
|
+
const token = await this.getAuthToken();
|
|
136
|
+
const params = new URLSearchParams();
|
|
137
|
+
if (options.provider) params.set("provider", options.provider);
|
|
138
|
+
if (options.currency) params.set("currency", options.currency);
|
|
139
|
+
if (options.amount != null) params.set("amount", options.amount.toString());
|
|
140
|
+
if (options.churchId) params.set("churchId", options.churchId);
|
|
141
|
+
if (options.isCompany != null) params.set("isCompany", options.isCompany.toString());
|
|
142
|
+
const controller = new AbortController();
|
|
143
|
+
if (this.timeout) {
|
|
144
|
+
setTimeout(() => controller.abort(), this.timeout);
|
|
145
|
+
}
|
|
146
|
+
const response = await fetch(
|
|
147
|
+
`${this.baseUrl}/api/v1/configuration/payment-methods?${params.toString()}`,
|
|
148
|
+
{
|
|
149
|
+
headers: {
|
|
150
|
+
"Authorization": `Bearer ${token}`,
|
|
151
|
+
"X-Tenant-ID": this.tenantId
|
|
152
|
+
},
|
|
153
|
+
signal: controller.signal
|
|
154
|
+
}
|
|
155
|
+
);
|
|
156
|
+
if (!response.ok) {
|
|
157
|
+
const errorText = await response.text();
|
|
158
|
+
throw new Error(
|
|
159
|
+
`Payment API request failed: ${response.status} ${response.statusText}. ${errorText}`
|
|
160
|
+
);
|
|
161
|
+
}
|
|
162
|
+
return await response.json();
|
|
163
|
+
}
|
|
134
164
|
};
|
|
135
165
|
// Annotate the CommonJS export names for ESM import in node:
|
|
136
166
|
0 && (module.exports = {
|
package/dist/index.mjs
CHANGED
|
@@ -105,6 +105,36 @@ var PaymentClient = class {
|
|
|
105
105
|
}
|
|
106
106
|
return await response.json();
|
|
107
107
|
}
|
|
108
|
+
async getPaymentMethods(options = {}) {
|
|
109
|
+
const token = await this.getAuthToken();
|
|
110
|
+
const params = new URLSearchParams();
|
|
111
|
+
if (options.provider) params.set("provider", options.provider);
|
|
112
|
+
if (options.currency) params.set("currency", options.currency);
|
|
113
|
+
if (options.amount != null) params.set("amount", options.amount.toString());
|
|
114
|
+
if (options.churchId) params.set("churchId", options.churchId);
|
|
115
|
+
if (options.isCompany != null) params.set("isCompany", options.isCompany.toString());
|
|
116
|
+
const controller = new AbortController();
|
|
117
|
+
if (this.timeout) {
|
|
118
|
+
setTimeout(() => controller.abort(), this.timeout);
|
|
119
|
+
}
|
|
120
|
+
const response = await fetch(
|
|
121
|
+
`${this.baseUrl}/api/v1/configuration/payment-methods?${params.toString()}`,
|
|
122
|
+
{
|
|
123
|
+
headers: {
|
|
124
|
+
"Authorization": `Bearer ${token}`,
|
|
125
|
+
"X-Tenant-ID": this.tenantId
|
|
126
|
+
},
|
|
127
|
+
signal: controller.signal
|
|
128
|
+
}
|
|
129
|
+
);
|
|
130
|
+
if (!response.ok) {
|
|
131
|
+
const errorText = await response.text();
|
|
132
|
+
throw new Error(
|
|
133
|
+
`Payment API request failed: ${response.status} ${response.statusText}. ${errorText}`
|
|
134
|
+
);
|
|
135
|
+
}
|
|
136
|
+
return await response.json();
|
|
137
|
+
}
|
|
108
138
|
};
|
|
109
139
|
export {
|
|
110
140
|
PaymentClient
|