swell-js 3.18.2 → 3.19.2

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.
@@ -9,7 +9,7 @@ import { m as methods$4 } from './attributes-a5d59cae.js';
9
9
  import { m as methods$5 } from './subscriptions-afa9565b.js';
10
10
  import { m as methods$6 } from './content-8feae575.js';
11
11
  import { m as methods$7 } from './settings-3cf85d69.js';
12
- import { m as methods$8 } from './payment-ed203c03.js';
12
+ import { m as methods$8 } from './payment-4030605c.js';
13
13
  import { m as methods$9 } from './locale-abdc14e0.js';
14
14
  import { m as methods$a } from './currency-85151e0d.js';
15
15
  import { n as trimEnd, E as utils, l as trimStart, k as trimBoth, j as toSnake, o as stringifyQuery, A as base64Encode, t as toCamel, e as setOptions } from './index-bee7164f.js';
@@ -23,7 +23,7 @@ const options = {
23
23
  };
24
24
 
25
25
  const api = {
26
- version: '3.18.2',
26
+ version: '3.19.2',
27
27
  options,
28
28
  request,
29
29
 
package/dist/api.js CHANGED
@@ -1,4 +1,4 @@
1
- export { a as default } from './api-b810ea57.js';
1
+ export { a as default } from './api-896f20cf.js';
2
2
  import './card-31d20d88.js';
3
3
  import './index-bee7164f.js';
4
4
  import 'qs';
@@ -14,6 +14,6 @@ import './categories-bb6f6179.js';
14
14
  import './subscriptions-afa9565b.js';
15
15
  import './content-8feae575.js';
16
16
  import './settings-3cf85d69.js';
17
- import './payment-ed203c03.js';
17
+ import './payment-4030605c.js';
18
18
  import './locale-abdc14e0.js';
19
19
  import './currency-85151e0d.js';
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- export { a as default } from './api-b810ea57.js';
1
+ export { a as default } from './api-896f20cf.js';
2
2
  import './card-31d20d88.js';
3
3
  import './index-bee7164f.js';
4
4
  import 'qs';
@@ -14,6 +14,6 @@ import './categories-bb6f6179.js';
14
14
  import './subscriptions-afa9565b.js';
15
15
  import './content-8feae575.js';
16
16
  import './settings-3cf85d69.js';
17
- import './payment-ed203c03.js';
17
+ import './payment-4030605c.js';
18
18
  import './locale-abdc14e0.js';
19
19
  import './currency-85151e0d.js';
@@ -1,4 +1,4 @@
1
- import { F as toString, G as keys, H as isArrayLike, I as baseIteratee, J as isArray, K as isBuffer, L as isTypedArray, M as isArguments, N as getTag, O as isPrototype, P as baseKeys, Q as arrayMap, g as get, R as toNumber, j as toSnake, B as vaultRequest, q as isFunction, C as getLocationParams, D as removeUrlParams } from './index-bee7164f.js';
1
+ import { F as toString, G as keys, H as isArrayLike, I as baseIteratee, J as isArray, K as isBuffer, L as isTypedArray, M as isArguments, N as getTag, O as isPrototype, P as baseKeys, Q as arrayMap, j as toSnake, g as get, R as toNumber, B as vaultRequest, q as isFunction, C as getLocationParams, D as removeUrlParams } from './index-bee7164f.js';
2
2
  import { m as methods$1 } from './cart-5e54de2c.js';
3
3
  import { m as methods$2 } from './settings-3cf85d69.js';
4
4
 
@@ -538,9 +538,8 @@ async function createPaymentMethod(stripe, cardElement, authorize, cart) {
538
538
  }
539
539
 
540
540
  const { error: setupIntentError } = await stripe.confirmCardSetup(
541
- authorization.client_secret,
541
+ toSnake(authorization).client_secret,
542
542
  );
543
-
544
543
  return setupIntentError ? { error: setupIntentError } : authorization.card;
545
544
  }
546
545
 
@@ -1287,29 +1286,38 @@ async function paymentTokenize(request, params, payMethods, cart) {
1287
1286
  .catch(onError),
1288
1287
  );
1289
1288
 
1290
- if (intent && intent.status === 'requires_confirmation') {
1291
- const { paymentIntent, error } = await stripe.confirmCardPayment(
1292
- intent.client_secret,
1293
- );
1294
- return error
1295
- ? onError(error)
1296
- : await methods$1(request, options)
1297
- .update({
1298
- billing: {
1299
- method: 'card',
1300
- card: paymentMethod,
1301
- intent: {
1302
- stripe: {
1303
- id: paymentIntent.id,
1304
- ...(!!auth_total && {
1305
- auth_amount: auth_total,
1306
- }),
1307
- },
1308
- },
1289
+ if (
1290
+ intent &&
1291
+ ['requires_capture', 'requires_confirmation'].includes(intent.status)
1292
+ ) {
1293
+ if (intent.status === 'requires_confirmation') {
1294
+ // Confirm the payment intent
1295
+ const { error } = await stripe.confirmCardPayment(
1296
+ intent.client_secret,
1297
+ );
1298
+ if (error) {
1299
+ return onError(error);
1300
+ }
1301
+ }
1302
+
1303
+ // Capture the payment
1304
+ return await methods$1(request, options)
1305
+ .update({
1306
+ billing: {
1307
+ method: 'card',
1308
+ card: paymentMethod,
1309
+ intent: {
1310
+ stripe: {
1311
+ id: intent.id,
1312
+ ...(!!auth_total && {
1313
+ auth_amount: auth_total,
1314
+ }),
1309
1315
  },
1310
- })
1311
- .then(onSuccess)
1312
- .catch(onError);
1316
+ },
1317
+ },
1318
+ })
1319
+ .then(onSuccess)
1320
+ .catch(onError);
1313
1321
  }
1314
1322
  } else if (payMethods.card.gateway === 'quickpay') {
1315
1323
  const intent = await createQuickpayPayment(
package/dist/payment.js CHANGED
@@ -1,4 +1,4 @@
1
- export { m as default, s as shouldUsePayPalEmail } from './payment-ed203c03.js';
1
+ export { m as default, s as shouldUsePayPalEmail } from './payment-4030605c.js';
2
2
  import './index-bee7164f.js';
3
3
  import 'qs';
4
4
  import 'deepmerge';
package/dist/swell.cjs.js CHANGED
@@ -6276,9 +6276,8 @@ async function createPaymentMethod(stripe, cardElement, authorize, cart) {
6276
6276
  }
6277
6277
 
6278
6278
  const { error: setupIntentError } = await stripe.confirmCardSetup(
6279
- authorization.client_secret,
6279
+ toSnake(authorization).client_secret,
6280
6280
  );
6281
-
6282
6281
  return setupIntentError ? { error: setupIntentError } : authorization.card;
6283
6282
  }
6284
6283
 
@@ -7025,29 +7024,38 @@ async function paymentTokenize(request, params, payMethods, cart) {
7025
7024
  .catch(onError),
7026
7025
  );
7027
7026
 
7028
- if (intent && intent.status === 'requires_confirmation') {
7029
- const { paymentIntent, error } = await stripe.confirmCardPayment(
7030
- intent.client_secret,
7031
- );
7032
- return error
7033
- ? onError(error)
7034
- : await methods$8(request, options$1)
7035
- .update({
7036
- billing: {
7037
- method: 'card',
7038
- card: paymentMethod,
7039
- intent: {
7040
- stripe: {
7041
- id: paymentIntent.id,
7042
- ...(!!auth_total && {
7043
- auth_amount: auth_total,
7044
- }),
7045
- },
7046
- },
7027
+ if (
7028
+ intent &&
7029
+ ['requires_capture', 'requires_confirmation'].includes(intent.status)
7030
+ ) {
7031
+ if (intent.status === 'requires_confirmation') {
7032
+ // Confirm the payment intent
7033
+ const { error } = await stripe.confirmCardPayment(
7034
+ intent.client_secret,
7035
+ );
7036
+ if (error) {
7037
+ return onError(error);
7038
+ }
7039
+ }
7040
+
7041
+ // Capture the payment
7042
+ return await methods$8(request, options$1)
7043
+ .update({
7044
+ billing: {
7045
+ method: 'card',
7046
+ card: paymentMethod,
7047
+ intent: {
7048
+ stripe: {
7049
+ id: intent.id,
7050
+ ...(!!auth_total && {
7051
+ auth_amount: auth_total,
7052
+ }),
7047
7053
  },
7048
- })
7049
- .then(onSuccess)
7050
- .catch(onError);
7054
+ },
7055
+ },
7056
+ })
7057
+ .then(onSuccess)
7058
+ .catch(onError);
7051
7059
  }
7052
7060
  } else if (payMethods.card.gateway === 'quickpay') {
7053
7061
  const intent = await createQuickpayPayment(
@@ -7647,7 +7655,7 @@ const options = {
7647
7655
  };
7648
7656
 
7649
7657
  const api = {
7650
- version: '3.18.2',
7658
+ version: '3.19.2',
7651
7659
  options,
7652
7660
  request,
7653
7661