@funnelsgrove/payments 0.55.0 → 0.57.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/solidgate/components/SolidgateCheckoutDialog.js +7 -13
- package/dist/providers/solidgate/services/solidgate.service.js +79 -24
- package/dist/providers/solidgate/services/solidgateDeclineMessage.d.ts +1 -0
- package/dist/providers/solidgate/services/solidgateDeclineMessage.js +7 -0
- package/dist/services/checkoutObservability.service.d.ts +2 -2
- package/dist/services/checkoutObservability.service.js +8 -4
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const PAYMENTS_PACKAGE_VERSION = "0.
|
|
1
|
+
export declare const PAYMENTS_PACKAGE_VERSION = "0.57.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.57.0";
|
|
@@ -5,7 +5,7 @@ import { useCallback, useEffect, useMemo, useRef, useState, } from 'react';
|
|
|
5
5
|
import { trackSolidgateCheckoutEvent } from '../services/solidgateCheckoutAnalytics.service.js';
|
|
6
6
|
import { pollSolidgateCheckoutStatus, prepareSolidgateCheckout, SolidgateExistingSubscriptionError, } from '../services/solidgate.service.js';
|
|
7
7
|
import { trackCheckoutCanceled, trackCheckoutFailureShown, } from '../../../services/checkoutObservability.service.js';
|
|
8
|
-
import { solidgateDeclineMessage } from '../services/solidgateDeclineMessage.js';
|
|
8
|
+
import { isSolidgateCustomerDecline, solidgateDeclineMessage } from '../services/solidgateDeclineMessage.js';
|
|
9
9
|
import { SolidgateCheckoutSummary } from './SolidgateCheckoutSummary.js';
|
|
10
10
|
import { SolidgatePaymentForm } from './SolidgatePaymentForm.js';
|
|
11
11
|
import { solidgateCheckoutDialogStyles } from './SolidgateCheckoutDialog.styles.js';
|
|
@@ -139,19 +139,12 @@ export function SolidgateCheckoutDialog({ open, layout = 'dialog', request, cust
|
|
|
139
139
|
(_b = onPaymentPendingChangeRef.current) === null || _b === void 0 ? void 0 : _b.call(onPaymentPendingChangeRef, nextView.state === 'submitting'
|
|
140
140
|
|| nextView.state === 'verifying' || nextView.state === 'success' || nextView.canResumeVerification);
|
|
141
141
|
}, []);
|
|
142
|
-
const trackFailure = useCallback((message, failureStage, attemptId) => {
|
|
142
|
+
const trackFailure = useCallback((message, failureStage, attemptId, details) => {
|
|
143
143
|
const analytics = checkoutAnalyticsRef.current;
|
|
144
144
|
if (!analytics) {
|
|
145
145
|
return;
|
|
146
146
|
}
|
|
147
|
-
trackCheckoutFailureShown({
|
|
148
|
-
analytics,
|
|
149
|
-
checkoutSessionId: attemptId,
|
|
150
|
-
errorMessage: message,
|
|
151
|
-
failureStage,
|
|
152
|
-
paymentMethod: 'card',
|
|
153
|
-
provider: 'solidgate',
|
|
154
|
-
});
|
|
147
|
+
trackCheckoutFailureShown(Object.assign({ analytics, checkoutSessionId: attemptId, errorMessage: message, failureStage, paymentMethod: 'card', provider: 'solidgate' }, details));
|
|
155
148
|
}, []);
|
|
156
149
|
const requiresEmailCommit = Boolean(onCustomerEmailCommit);
|
|
157
150
|
const startedAttemptRef = useRef(null);
|
|
@@ -207,8 +200,9 @@ export function SolidgateCheckoutDialog({ open, layout = 'dialog', request, cust
|
|
|
207
200
|
state: error instanceof SolidgateExistingSubscriptionError ? 'existing_subscription' : 'recoverable_error',
|
|
208
201
|
checkout: null, canResumeVerification: false, failureMessage,
|
|
209
202
|
});
|
|
210
|
-
|
|
211
|
-
(
|
|
203
|
+
const errorCode = error instanceof SolidgateExistingSubscriptionError ? error.code : undefined;
|
|
204
|
+
trackFailure(failureMessage, 'checkout_session_creation', null, { errorCode });
|
|
205
|
+
(_a = onErrorRef.current) === null || _a === void 0 ? void 0 : _a.call(onErrorRef, failureMessage, errorCode);
|
|
212
206
|
}
|
|
213
207
|
});
|
|
214
208
|
return () => controller.abort();
|
|
@@ -295,7 +289,7 @@ export function SolidgateCheckoutDialog({ open, layout = 'dialog', request, cust
|
|
|
295
289
|
declinedAttemptRef.current = checkout.attemptId;
|
|
296
290
|
const failureMessage = solidgateDeclineMessage(result.failureCode);
|
|
297
291
|
setState({ state: 'recoverable_error', checkout, canResumeVerification: false, failureMessage });
|
|
298
|
-
trackFailure(failureMessage, 'payment_failed', checkout.attemptId);
|
|
292
|
+
trackFailure(failureMessage, 'payment_failed', checkout.attemptId, Object.assign(Object.assign({}, (isSolidgateCustomerDecline(result.failureCode) ? { providerDeclineCode: result.failureCode } : {})), { providerErrorCode: result.failureCode }));
|
|
299
293
|
(_c = onErrorRef.current) === null || _c === void 0 ? void 0 : _c.call(onErrorRef, failureMessage);
|
|
300
294
|
}
|
|
301
295
|
else if (result.status === 'requires_payment') {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { paywallCheckoutReturnUrl, retainPaywallCheckout, FUNNEL_ID, FUNNEL_SDK_PUBLISHABLE_KEY, buildMainApiUrl, resolvePreviewPaymentPublishableKey, } from '@funnelsgrove/runtime';
|
|
1
|
+
import { paywallCheckoutReturnUrl, retainPaywallCheckout, FUNNEL_ID, FUNNEL_SDK_PUBLISHABLE_KEY, buildMainApiUrl, funnelSdkService, getCheckoutIdentityToken, resolvePreviewPaymentPublishableKey, retainCheckoutIdentityToken, } from '@funnelsgrove/runtime';
|
|
2
2
|
import { trackSolidgateCheckoutEvent } from './solidgateCheckoutAnalytics.service.js';
|
|
3
3
|
export class SolidgateExistingSubscriptionError extends Error {
|
|
4
4
|
constructor() {
|
|
@@ -15,6 +15,24 @@ export class SolidgateSavedPaymentMethodUnavailableError extends Error {
|
|
|
15
15
|
this.name = 'SolidgateSavedPaymentMethodUnavailableError';
|
|
16
16
|
}
|
|
17
17
|
}
|
|
18
|
+
/** The server rejected the bootstrap identity proof as expired; refresh it and resend once. */
|
|
19
|
+
class SolidgateCheckoutIdentityExpiredError extends Error {
|
|
20
|
+
constructor() {
|
|
21
|
+
super('Checkout identity has expired');
|
|
22
|
+
this.name = 'SolidgateCheckoutIdentityExpiredError';
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
const MAX_CHECKOUT_PROOF_LENGTH = 4096;
|
|
26
|
+
/** Checkout access tokens issued by the create response, keyed by attempt id (memory only, like Stripe). */
|
|
27
|
+
const checkoutAccessTokens = new Map();
|
|
28
|
+
const retainCheckoutAccessToken = (attemptId, token) => {
|
|
29
|
+
const normalized = typeof token === 'string' ? token.trim() : '';
|
|
30
|
+
if (!normalized || normalized.length > MAX_CHECKOUT_PROOF_LENGTH) {
|
|
31
|
+
checkoutAccessTokens.delete(attemptId);
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
checkoutAccessTokens.set(attemptId, normalized);
|
|
35
|
+
};
|
|
18
36
|
const trimTrailingSlash = (value) => value.replace(/\/+$/, '');
|
|
19
37
|
const requiredString = (value, name) => {
|
|
20
38
|
const normalized = typeof value === 'string' ? value.trim() : '';
|
|
@@ -44,26 +62,28 @@ const postJson = async (path, body, runtimeConfig, signal) => {
|
|
|
44
62
|
signal,
|
|
45
63
|
});
|
|
46
64
|
if (!response.ok) {
|
|
47
|
-
if (response.status === 409) {
|
|
65
|
+
if (response.status === 409 || response.status === 401) {
|
|
48
66
|
const payload = await response.json().catch(() => null);
|
|
49
|
-
|
|
50
|
-
|
|
67
|
+
const code = payload && typeof payload === 'object' && 'code' in payload ? payload.code : null;
|
|
68
|
+
if (response.status === 409 && code === 'already_subscribed_to_product') {
|
|
51
69
|
throw new SolidgateExistingSubscriptionError();
|
|
52
70
|
}
|
|
53
|
-
if (
|
|
54
|
-
&& payload.code === 'saved_payment_method_unavailable') {
|
|
71
|
+
if (response.status === 409 && code === 'saved_payment_method_unavailable') {
|
|
55
72
|
throw new SolidgateSavedPaymentMethodUnavailableError();
|
|
56
73
|
}
|
|
74
|
+
if (response.status === 401 && code === 'checkout_identity_expired') {
|
|
75
|
+
throw new SolidgateCheckoutIdentityExpiredError();
|
|
76
|
+
}
|
|
57
77
|
}
|
|
58
78
|
throw new Error('Solidgate checkout is temporarily unavailable');
|
|
59
79
|
}
|
|
60
80
|
return response.json();
|
|
61
81
|
};
|
|
62
|
-
const getJson = async (path, runtimeConfig, signal) => {
|
|
82
|
+
const getJson = async (path, headers, runtimeConfig, signal) => {
|
|
63
83
|
const publishableKey = resolvePublishableKey(runtimeConfig);
|
|
64
84
|
const response = await fetch(resolveApiUrl(path, runtimeConfig), {
|
|
65
85
|
method: 'GET',
|
|
66
|
-
headers: Object.assign({}, (publishableKey ? { 'x-sdk-publishable-key': publishableKey } : {})),
|
|
86
|
+
headers: Object.assign(Object.assign({}, (publishableKey ? { 'x-sdk-publishable-key': publishableKey } : {})), headers),
|
|
67
87
|
signal,
|
|
68
88
|
});
|
|
69
89
|
if (!response.ok) {
|
|
@@ -72,6 +92,41 @@ const getJson = async (path, runtimeConfig, signal) => {
|
|
|
72
92
|
return response.json();
|
|
73
93
|
};
|
|
74
94
|
const isRecord = (value) => (Boolean(value) && typeof value === 'object' && !Array.isArray(value));
|
|
95
|
+
const refreshCheckoutIdentity = async (userId, idempotencyKey, runtimeConfig, signal) => {
|
|
96
|
+
const payload = await funnelSdkService.bootstrapUser({
|
|
97
|
+
userId, idempotencyKey, runtimeConfig, signal,
|
|
98
|
+
});
|
|
99
|
+
const token = typeof payload.checkoutIdentityToken === 'string' ? payload.checkoutIdentityToken.trim() : '';
|
|
100
|
+
if (!token) {
|
|
101
|
+
throw new Error('Solidgate checkout is temporarily unavailable');
|
|
102
|
+
}
|
|
103
|
+
retainCheckoutIdentityToken(userId, token);
|
|
104
|
+
return token;
|
|
105
|
+
};
|
|
106
|
+
/**
|
|
107
|
+
* Sends the request with the runtime's bootstrap identity proof when it holds one.
|
|
108
|
+
* Mirrors the Stripe path: an expired proof is refreshed through bootstrap and the
|
|
109
|
+
* same attempt is sent once more. The server still verifies every proof.
|
|
110
|
+
*/
|
|
111
|
+
const postWithCheckoutIdentity = async (identity, send) => {
|
|
112
|
+
const checkoutIdentityToken = getCheckoutIdentityToken(identity.userId);
|
|
113
|
+
try {
|
|
114
|
+
return await send(checkoutIdentityToken ? { checkoutIdentityToken } : {});
|
|
115
|
+
}
|
|
116
|
+
catch (error) {
|
|
117
|
+
if (!(error instanceof SolidgateCheckoutIdentityExpiredError)) {
|
|
118
|
+
throw error;
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
const refreshed = await refreshCheckoutIdentity(identity.userId, identity.idempotencyKey, identity.runtimeConfig, identity.signal);
|
|
122
|
+
try {
|
|
123
|
+
return await send({ checkoutIdentityToken: refreshed });
|
|
124
|
+
}
|
|
125
|
+
catch (error) {
|
|
126
|
+
throw error instanceof SolidgateCheckoutIdentityExpiredError
|
|
127
|
+
? new Error('Solidgate checkout is temporarily unavailable') : error;
|
|
128
|
+
}
|
|
129
|
+
};
|
|
75
130
|
const parsePreparation = (value) => {
|
|
76
131
|
if (!isRecord(value) || !isRecord(value.display) || !isRecord(value.initialization)) {
|
|
77
132
|
throw new Error('Solidgate checkout returned an invalid response');
|
|
@@ -134,7 +189,7 @@ const parseStatus = (value) => {
|
|
|
134
189
|
&& /^\d\.\d{2}$/.test(value.failureCode) ? { failureCode: value.failureCode } : {}));
|
|
135
190
|
};
|
|
136
191
|
export const prepareSolidgateCheckout = async (input) => {
|
|
137
|
-
var _a, _b
|
|
192
|
+
var _a, _b;
|
|
138
193
|
const paymentProfileId = ((_a = input.paymentProfileId) === null || _a === void 0 ? void 0 : _a.trim()) || null;
|
|
139
194
|
const providerPlanId = ((_b = input.providerPlanId) === null || _b === void 0 ? void 0 : _b.trim()) || null;
|
|
140
195
|
const checkoutType = input.checkoutType || null;
|
|
@@ -142,8 +197,15 @@ export const prepareSolidgateCheckout = async (input) => {
|
|
|
142
197
|
if (!paymentProfileId || !providerPlanId || !checkoutType || !environment) {
|
|
143
198
|
throw new Error('Solidgate V2 checkout selection is incomplete');
|
|
144
199
|
}
|
|
145
|
-
const
|
|
146
|
-
|
|
200
|
+
const funnelEndUserId = requiredString(input.funnelEndUserId, 'funnelEndUserId');
|
|
201
|
+
const idempotencyKey = requiredString(input.idempotencyKey, 'idempotencyKey');
|
|
202
|
+
const response = await postWithCheckoutIdentity({ userId: funnelEndUserId, idempotencyKey, runtimeConfig: input.runtimeConfig, signal: input.signal }, (proof) => {
|
|
203
|
+
var _a;
|
|
204
|
+
return postJson('/sdk/public/v2/payments/checkout-sessions', Object.assign(Object.assign(Object.assign(Object.assign({ checkoutType, uiMode: 'custom', environment,
|
|
205
|
+
paymentProfileId, provider: 'solidgate', providerPlanId, planKey: requiredString(input.funnelPlanKey, 'funnelPlanKey'), funnelId: resolveFunnelId(input.funnelId, input.runtimeConfig), funnelEndUserId, offerSetId: requiredString(input.offerSetId, 'offerSetId'), idempotencyKey }, proof), (input.language != null ? { language: input.language } : {})), (input.retryAttemptId ? { retryAttemptId: input.retryAttemptId } : {})), { couponId: ((_a = input.discountKeyOrProviderId) === null || _a === void 0 ? void 0 : _a.trim()) || null, returnUrl: paywallCheckoutReturnUrl(requiredString(input.returnUrl, 'returnUrl'), 'solidgate'), successUrl: paywallCheckoutReturnUrl(requiredString(input.successUrl, 'successUrl'), 'solidgate'), failUrl: paywallCheckoutReturnUrl(requiredString(input.failUrl, 'failUrl'), 'solidgate', true) }), input.runtimeConfig, input.signal);
|
|
206
|
+
});
|
|
207
|
+
const result = parsePreparation(response);
|
|
208
|
+
retainCheckoutAccessToken(result.attemptId, isRecord(response) ? response.checkoutAccessToken : null);
|
|
147
209
|
retainPaywallCheckout('solidgate', result.attemptId);
|
|
148
210
|
return result;
|
|
149
211
|
};
|
|
@@ -151,7 +213,9 @@ export const retrieveSolidgateCheckoutStatus = async (input) => {
|
|
|
151
213
|
const attemptId = requiredString(input.attemptId, 'attemptId');
|
|
152
214
|
const funnelId = resolveFunnelId(input.funnelId, input.runtimeConfig);
|
|
153
215
|
const funnelEndUserId = requiredString(input.funnelEndUserId, 'funnelEndUserId');
|
|
154
|
-
const
|
|
216
|
+
const checkoutIdentityToken = getCheckoutIdentityToken(funnelEndUserId);
|
|
217
|
+
const checkoutAccessToken = checkoutAccessTokens.get(attemptId);
|
|
218
|
+
const result = parseStatus(await getJson(`/sdk/public/v2/payments/checkout-sessions/${encodeURIComponent(attemptId)}?provider=solidgate&funnelId=${encodeURIComponent(funnelId)}&funnelEndUserId=${encodeURIComponent(funnelEndUserId)}`, Object.assign(Object.assign({}, (checkoutIdentityToken ? { 'x-funnelsgrove-checkout-identity-token': checkoutIdentityToken } : {})), (checkoutAccessToken ? { 'x-funnelsgrove-checkout-access-token': checkoutAccessToken } : {})), input.runtimeConfig, input.signal));
|
|
155
219
|
if (result.attemptId !== attemptId) {
|
|
156
220
|
throw new Error('Solidgate checkout status returned the wrong attempt');
|
|
157
221
|
}
|
|
@@ -231,18 +295,9 @@ export const pollSolidgateCheckoutStatus = async (input, options = {}) => {
|
|
|
231
295
|
const oneClickStatuses = new Set(['verifying', 'succeeded', 'failed']);
|
|
232
296
|
/** Charges a one-time offer to the instrument saved by the user's paid Solidgate checkout. */
|
|
233
297
|
export const chargeSolidgateOneClickPayment = async (input) => {
|
|
234
|
-
const
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
funnelId: resolveFunnelId(input.funnelId, input.runtimeConfig),
|
|
238
|
-
offerSetId: requiredString(input.offerSetId, 'offerSetId'),
|
|
239
|
-
paymentProfileId: requiredString(input.paymentProfileId, 'paymentProfileId'),
|
|
240
|
-
providerPlanId: requiredString(input.providerPlanId, 'providerPlanId'),
|
|
241
|
-
planKey: requiredString(input.funnelPlanKey, 'funnelPlanKey'),
|
|
242
|
-
userId: requiredString(input.userId, 'userId'),
|
|
243
|
-
checkoutSessionId: requiredString(input.checkoutSessionId, 'checkoutSessionId'),
|
|
244
|
-
idempotencyKey: requiredString(input.idempotencyKey, 'idempotencyKey'),
|
|
245
|
-
}, input.runtimeConfig, input.signal);
|
|
298
|
+
const userId = requiredString(input.userId, 'userId');
|
|
299
|
+
const idempotencyKey = requiredString(input.idempotencyKey, 'idempotencyKey');
|
|
300
|
+
const value = await postWithCheckoutIdentity({ userId, idempotencyKey, runtimeConfig: input.runtimeConfig, signal: input.signal }, (proof) => postJson('/sdk/public/v2/payments/one-click', Object.assign({ provider: 'solidgate', environment: input.environment, funnelId: resolveFunnelId(input.funnelId, input.runtimeConfig), offerSetId: requiredString(input.offerSetId, 'offerSetId'), paymentProfileId: requiredString(input.paymentProfileId, 'paymentProfileId'), providerPlanId: requiredString(input.providerPlanId, 'providerPlanId'), planKey: requiredString(input.funnelPlanKey, 'funnelPlanKey'), userId, checkoutSessionId: requiredString(input.checkoutSessionId, 'checkoutSessionId'), idempotencyKey }, proof), input.runtimeConfig, input.signal));
|
|
246
301
|
if (!isRecord(value) || value.provider !== 'solidgate' || typeof value.status !== 'string'
|
|
247
302
|
|| !oneClickStatuses.has(value.status)) {
|
|
248
303
|
throw new Error('Solidgate one-click returned an invalid response');
|
|
@@ -22,3 +22,10 @@ const messages = {
|
|
|
22
22
|
};
|
|
23
23
|
export const solidgateDeclineMessage = (code) => ((code && Object.hasOwn(messages, code) ? messages[code] : undefined)
|
|
24
24
|
|| 'Your payment was declined. Use another payment method or contact your bank.');
|
|
25
|
+
// Issuer, card-data and bank-verification refusals; other codes stay platform failures.
|
|
26
|
+
const customerDeclineCodes = new Set([
|
|
27
|
+
'2.04', '2.06', '2.08', '2.09', '2.15',
|
|
28
|
+
'3.01', '3.02', '3.03', '3.04', '3.05', '3.06', '3.07', '3.09', '3.11', '3.13',
|
|
29
|
+
'4.08',
|
|
30
|
+
]);
|
|
31
|
+
export const isSolidgateCustomerDecline = (code) => (Boolean(code && customerDeclineCodes.has(code)));
|
|
@@ -31,8 +31,8 @@ type CheckoutFailureShownInput = CheckoutObservabilityInput & {
|
|
|
31
31
|
providerErrorCode?: string | null;
|
|
32
32
|
providerErrorType?: string | null;
|
|
33
33
|
};
|
|
34
|
-
export type CheckoutFailureCategory = 'network_failure' | 'payment_rejection' | 'platform_failure' | 'session_failure' | 'validation_failure';
|
|
35
|
-
export type CheckoutFailureClassificationInput = Pick<CheckoutFailureShownInput, 'errorMessage' | 'provider' | 'providerDeclineCode' | 'providerErrorCode' | 'providerErrorType'>;
|
|
34
|
+
export type CheckoutFailureCategory = 'existing_subscription' | 'network_failure' | 'payment_rejection' | 'platform_failure' | 'session_failure' | 'validation_failure';
|
|
35
|
+
export type CheckoutFailureClassificationInput = Pick<CheckoutFailureShownInput, 'errorCode' | 'errorMessage' | 'provider' | 'providerDeclineCode' | 'providerErrorCode' | 'providerErrorType'>;
|
|
36
36
|
export declare const classifyCheckoutFailure: (input: CheckoutFailureClassificationInput) => CheckoutFailureCategory;
|
|
37
37
|
export declare const trackCheckoutFailureShown: (input: CheckoutFailureShownInput) => string | null;
|
|
38
38
|
export declare const trackCheckoutCanceled: (input: CheckoutObservabilityInput) => string | null;
|
|
@@ -45,14 +45,17 @@ export const classifyCheckoutFailure = (input) => {
|
|
|
45
45
|
const providerDeclineCode = asNonEmptyString(input.providerDeclineCode);
|
|
46
46
|
const providerErrorCode = asNonEmptyString(input.providerErrorCode);
|
|
47
47
|
const providerErrorType = asNonEmptyString(input.providerErrorType);
|
|
48
|
+
if (asNonEmptyString(input.errorCode) === 'already_subscribed_to_product') {
|
|
49
|
+
return 'existing_subscription';
|
|
50
|
+
}
|
|
48
51
|
if (input.provider === 'stripe' && providerErrorCode
|
|
49
52
|
&& STRIPE_VALIDATION_ERROR_CODES.has(providerErrorCode)) {
|
|
50
53
|
return 'validation_failure';
|
|
51
54
|
}
|
|
52
|
-
if (
|
|
53
|
-
|| providerErrorType === 'card_error'
|
|
54
|
-
|
|
55
|
-
|| /card has insufficient funds|unable to authenticate your payment method|card(?: was| is)? declined|security code is incorrect/i.test(input.errorMessage))
|
|
55
|
+
if (Boolean(providerDeclineCode)
|
|
56
|
+
|| (input.provider === 'stripe' && (providerErrorType === 'card_error'
|
|
57
|
+
|| (providerErrorCode ? STRIPE_PAYMENT_REJECTION_CODES.has(providerErrorCode) : false)))
|
|
58
|
+
|| /card has insufficient funds|unable to authenticate your payment method|card(?: was| is)? declined|security code is incorrect|card has expired|card type isn[’']t accepted/i.test(input.errorMessage)) {
|
|
56
59
|
return 'payment_rejection';
|
|
57
60
|
}
|
|
58
61
|
const message = input.errorMessage.trim();
|
|
@@ -192,6 +195,7 @@ export const trackCheckoutFailureShown = (input) => {
|
|
|
192
195
|
const providerErrorCode = (_b = asNonEmptyString(input.providerErrorCode)) === null || _b === void 0 ? void 0 : _b.slice(0, 120);
|
|
193
196
|
const providerErrorType = (_c = asNonEmptyString(input.providerErrorType)) === null || _c === void 0 ? void 0 : _c.slice(0, 120);
|
|
194
197
|
const failureCategory = classifyCheckoutFailure({
|
|
198
|
+
errorCode: input.errorCode,
|
|
195
199
|
errorMessage,
|
|
196
200
|
provider: input.provider,
|
|
197
201
|
providerDeclineCode,
|