@funnelsgrove/payments 0.82.0 → 0.83.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.
@@ -1 +1 @@
1
- export declare const PAYMENTS_PACKAGE_VERSION = "0.82.0";
1
+ export declare const PAYMENTS_PACKAGE_VERSION = "0.83.0";
@@ -1,2 +1,2 @@
1
1
  // Generated by scripts/generate-package-version.mjs.
2
- export const PAYMENTS_PACKAGE_VERSION = "0.82.0";
2
+ export const PAYMENTS_PACKAGE_VERSION = "0.83.0";
@@ -195,7 +195,7 @@ const parseStatus = (value) => {
195
195
  throw new Error('Solidgate checkout status returned an invalid retry delay');
196
196
  }
197
197
  return Object.assign({ attemptId: requiredString(value.attemptId, 'attemptId'), status: value.status, retryAfterMs }, (value.status === 'failed' && typeof value.failureCode === 'string'
198
- && /^\d\.\d{2}$/.test(value.failureCode) ? { failureCode: value.failureCode } : {}));
198
+ && /^(?:\d\.\d{2}|risk_decline)$/.test(value.failureCode) ? { failureCode: value.failureCode } : {}));
199
199
  };
200
200
  export const prepareSolidgateCheckout = async (input) => {
201
201
  var _a, _b;
@@ -25,9 +25,10 @@ const messages = {
25
25
  };
26
26
  export const solidgateDeclineMessage = (code) => ((code && Object.hasOwn(messages, code) ? messages[code] : undefined)
27
27
  || 'Your payment was declined. Use another payment method or contact your bank.');
28
- // Issuer, card-data and bank-verification refusals; other codes stay platform failures.
28
+ // Issuer, card-data, bank-verification and risk refusals; other codes stay platform failures.
29
+ // `risk_decline` keeps the general message: the buyer is not told about anti-fraud.
29
30
  const customerDeclineCodes = new Set([
30
- '1.01', '2.04', '2.06', '2.08', '2.09', '2.15',
31
+ 'risk_decline', '1.01', '2.04', '2.06', '2.08', '2.09', '2.15',
31
32
  '3.01', '3.02', '3.03', '3.04', '3.05', '3.06', '3.07', '3.08', '3.09', '3.11', '3.12', '3.13',
32
33
  '4.08', '5.01',
33
34
  ]);
@@ -398,7 +398,10 @@ function MethodForm({ blockId, checkoutAnalytics, checkoutSessionId, copy, count
398
398
  }
399
399
  if (result.type === 'error' && !isStripeCheckoutAlreadyPaidError(result.error)) {
400
400
  const message = result.error.message || copy.paymentFailed;
401
- showError(message, normalizeStripeCheckoutError(message, result.error, method));
401
+ const details = normalizeStripeCheckoutError(message, result.error, method);
402
+ // Stripe checks an incomplete form before charging and words that message in the visitor's language.
403
+ showError(message, !paymentElementComplete && details.category === 'platform_failure'
404
+ ? Object.assign(Object.assign({}, details), { category: 'validation_failure' }) : details);
402
405
  stopSubmitting();
403
406
  return;
404
407
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@funnelsgrove/payments",
3
- "version": "0.82.0",
3
+ "version": "0.83.0",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/The-Solid-Grove/funnelsgrove.git",
@@ -64,11 +64,11 @@
64
64
  "playwright": "1.58.2",
65
65
  "typescript": "^5",
66
66
  "vitest": "^3.2.4",
67
- "@funnelsgrove/runtime": "0.50.0",
68
- "@funnelsgrove/analytics": "0.33.0"
67
+ "@funnelsgrove/runtime": "0.51.0",
68
+ "@funnelsgrove/analytics": "0.34.0"
69
69
  },
70
70
  "peerDependencies": {
71
- "@funnelsgrove/runtime": "^0.50.0",
72
- "@funnelsgrove/analytics": "^0.33.0"
71
+ "@funnelsgrove/runtime": "^0.51.0",
72
+ "@funnelsgrove/analytics": "^0.34.0"
73
73
  }
74
74
  }