@funnelsgrove/payments 0.65.0 → 0.67.0
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/generated/package-version.d.ts +1 -1
- package/dist/generated/package-version.js +1 -1
- package/dist/providers/stripe/services/oneClick/completePayment.js +4 -1
- package/dist/providers/stripe/services/oneClick/confirmation.js +8 -5
- package/dist/providers/stripe/services/oneClick/types.d.ts +2 -0
- package/package.json +5 -5
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const PAYMENTS_PACKAGE_VERSION = "0.
|
|
1
|
+
export declare const PAYMENTS_PACKAGE_VERSION = "0.67.0";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// Generated by scripts/generate-package-version.mjs.
|
|
2
|
-
export const PAYMENTS_PACKAGE_VERSION = "0.
|
|
2
|
+
export const PAYMENTS_PACKAGE_VERSION = "0.67.0";
|
|
@@ -6,7 +6,10 @@ export const requiresStripeOneClickConfirmation = (status) => {
|
|
|
6
6
|
};
|
|
7
7
|
export async function completeStripeOneClickPayment(input) {
|
|
8
8
|
const payment = await chargeStripeOneClickPayment(input);
|
|
9
|
-
|
|
9
|
+
// CHECKOUT-BR-011: a Pix upsell shows its QR code only while it still awaits payment.
|
|
10
|
+
const confirmationAttempted = payment.paymentMethodType === 'pix'
|
|
11
|
+
? payment.status === 'requires_payment_method'
|
|
12
|
+
: requiresStripeOneClickConfirmation(payment.status);
|
|
10
13
|
const result = Object.assign(Object.assign({}, payment), { status: confirmationAttempted ? await confirmOneClickPayment(payment, input) : payment.status, confirmationAttempted });
|
|
11
14
|
try {
|
|
12
15
|
await trackPaidStripeOneClickPaymentCompleted(input, result);
|
|
@@ -10,11 +10,14 @@ export const confirmOneClickPayment = async (payment, input) => {
|
|
|
10
10
|
if (!stripe) {
|
|
11
11
|
throw new Error('Stripe could not be initialized for one-click payment confirmation.');
|
|
12
12
|
}
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
13
|
+
// CHECKOUT-BR-011: Stripe.js shows the new Pix QR code and resolves once it is paid or closed.
|
|
14
|
+
const confirmation = payment.paymentMethodType === 'pix'
|
|
15
|
+
? await stripe.confirmPixPayment(clientSecret, { payment_method: {} })
|
|
16
|
+
: await stripe.confirmPayment({
|
|
17
|
+
clientSecret,
|
|
18
|
+
confirmParams: { return_url: input.returnUrl },
|
|
19
|
+
redirect: 'if_required',
|
|
20
|
+
});
|
|
18
21
|
if (confirmation.error) {
|
|
19
22
|
throw new Error(confirmation.error.message || 'Unable to confirm one-click payment.');
|
|
20
23
|
}
|
|
@@ -28,6 +28,8 @@ export type ChargeOneClickPaymentInput = {
|
|
|
28
28
|
export type ChargeOneClickPaymentResponse = {
|
|
29
29
|
paymentIntentId: string;
|
|
30
30
|
status: string;
|
|
31
|
+
/** `pix` when the buyer paid the purchase with Pix and must scan a new QR code. */
|
|
32
|
+
paymentMethodType?: 'card' | 'pix';
|
|
31
33
|
amountCents?: number;
|
|
32
34
|
money?: ProviderMoney;
|
|
33
35
|
clientSecret?: string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@funnelsgrove/payments",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.67.0",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "git+https://github.com/The-Solid-Grove/funnelsgrove.git",
|
|
@@ -46,11 +46,11 @@
|
|
|
46
46
|
"jsdom": "20.0.3",
|
|
47
47
|
"typescript": "^5",
|
|
48
48
|
"vitest": "^3.2.4",
|
|
49
|
-
"@funnelsgrove/runtime": "0.
|
|
50
|
-
"@funnelsgrove/analytics": "0.
|
|
49
|
+
"@funnelsgrove/runtime": "0.43.0",
|
|
50
|
+
"@funnelsgrove/analytics": "0.26.0"
|
|
51
51
|
},
|
|
52
52
|
"peerDependencies": {
|
|
53
|
-
"@funnelsgrove/runtime": "^0.
|
|
54
|
-
"@funnelsgrove/analytics": "^0.
|
|
53
|
+
"@funnelsgrove/runtime": "^0.43.0",
|
|
54
|
+
"@funnelsgrove/analytics": "^0.26.0"
|
|
55
55
|
}
|
|
56
56
|
}
|