swell-js 3.24.0 → 3.24.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.
- package/dist/{api.6ceb5c2c.mjs → api.10709a76.mjs} +2 -2
- package/dist/api.mjs +2 -2
- package/dist/{index.33151a3b.mjs → index.a60f77a7.mjs} +31 -26
- package/dist/index.mjs +2 -2
- package/dist/payment.mjs +1 -1
- package/dist/swell.cjs +37 -32
- package/dist/swell.cjs.map +1 -1
- package/dist/swell.umd.min.js +27 -23
- package/dist/swell.umd.min.js.map +1 -1
- package/package.json +1 -1
- package/types/cart/snake.d.ts +1 -1
- package/types/index.d.ts +4 -2
|
@@ -10,7 +10,7 @@ import { m as methods$8 } from './subscriptions.fd44cccc.mjs';
|
|
|
10
10
|
import { d as defaultMethods, j as trimEnd, E as utils, i as trimStart, h as trimBoth, f as toSnake, k as stringifyQuery, y as base64Encode, t as toCamel, b as setOptions } from './index.b29eadc6.mjs';
|
|
11
11
|
import { m as methods$9 } from './content.5b4bea62.mjs';
|
|
12
12
|
import { m as methods$a } from './settings.6c0d2563.mjs';
|
|
13
|
-
import { P as PaymentController } from './index.
|
|
13
|
+
import { P as PaymentController } from './index.a60f77a7.mjs';
|
|
14
14
|
import { m as methods$b } from './locale.9d7241ac.mjs';
|
|
15
15
|
import { m as methods$c } from './currency.e2cd8985.mjs';
|
|
16
16
|
|
|
@@ -130,7 +130,7 @@ const options = {
|
|
|
130
130
|
};
|
|
131
131
|
|
|
132
132
|
const api = {
|
|
133
|
-
version: '3.24.
|
|
133
|
+
version: '3.24.2',
|
|
134
134
|
options,
|
|
135
135
|
request,
|
|
136
136
|
|
package/dist/api.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { a as default } from './api.
|
|
1
|
+
export { a as default } from './api.10709a76.mjs';
|
|
2
2
|
import './card.982ad378.mjs';
|
|
3
3
|
import './index.b29eadc6.mjs';
|
|
4
4
|
import 'qs';
|
|
@@ -16,6 +16,6 @@ import './categories.f6027058.mjs';
|
|
|
16
16
|
import './subscriptions.fd44cccc.mjs';
|
|
17
17
|
import './content.5b4bea62.mjs';
|
|
18
18
|
import './settings.6c0d2563.mjs';
|
|
19
|
-
import './index.
|
|
19
|
+
import './index.a60f77a7.mjs';
|
|
20
20
|
import './locale.9d7241ac.mjs';
|
|
21
21
|
import './currency.e2cd8985.mjs';
|
|
@@ -1281,7 +1281,7 @@ class StripeGooglePayment extends Payment {
|
|
|
1281
1281
|
return [this.cardPaymentMethod];
|
|
1282
1282
|
}
|
|
1283
1283
|
|
|
1284
|
-
async createElements() {
|
|
1284
|
+
async createElements(cart) {
|
|
1285
1285
|
const {
|
|
1286
1286
|
elementId = 'googlepay-button',
|
|
1287
1287
|
locale = 'en',
|
|
@@ -1308,7 +1308,6 @@ class StripeGooglePayment extends Payment {
|
|
|
1308
1308
|
);
|
|
1309
1309
|
}
|
|
1310
1310
|
|
|
1311
|
-
const cart = await this.getCart();
|
|
1312
1311
|
const paymentRequestData = this._createPaymentRequestData(cart);
|
|
1313
1312
|
|
|
1314
1313
|
this.element = this.googleClient.createButton({
|
|
@@ -1458,7 +1457,7 @@ class StripeApplePayment extends Payment {
|
|
|
1458
1457
|
StripeApplePayment.stripe = stripe;
|
|
1459
1458
|
}
|
|
1460
1459
|
|
|
1461
|
-
async createElements() {
|
|
1460
|
+
async createElements(cart) {
|
|
1462
1461
|
const {
|
|
1463
1462
|
elementId = 'applepay-button',
|
|
1464
1463
|
style: { type = 'default', theme = 'dark', height = '40px' } = {},
|
|
@@ -1469,7 +1468,6 @@ class StripeApplePayment extends Payment {
|
|
|
1469
1468
|
await this.loadScripts(this.scripts);
|
|
1470
1469
|
await this._authorizeDomain();
|
|
1471
1470
|
|
|
1472
|
-
const cart = await this.getCart();
|
|
1473
1471
|
const paymentRequest = this._createPaymentRequest(cart);
|
|
1474
1472
|
const canMakePayment = await paymentRequest.canMakePayment();
|
|
1475
1473
|
|
|
@@ -1733,7 +1731,7 @@ class BraintreePaypalPayment extends Payment {
|
|
|
1733
1731
|
return this.braintree.paypalCheckout;
|
|
1734
1732
|
}
|
|
1735
1733
|
|
|
1736
|
-
async createElements() {
|
|
1734
|
+
async createElements(cart) {
|
|
1737
1735
|
const {
|
|
1738
1736
|
elementId = 'paypal-button',
|
|
1739
1737
|
locale = 'en_US',
|
|
@@ -1765,7 +1763,6 @@ class BraintreePaypalPayment extends Payment {
|
|
|
1765
1763
|
const paypalCheckout = await this.braintreePaypalCheckout.create({
|
|
1766
1764
|
client: braintreeClient,
|
|
1767
1765
|
});
|
|
1768
|
-
const cart = await this.getCart();
|
|
1769
1766
|
|
|
1770
1767
|
this.element = this.paypal.Buttons({
|
|
1771
1768
|
locale,
|
|
@@ -1934,7 +1931,7 @@ class BraintreeGooglePayment extends Payment {
|
|
|
1934
1931
|
return [this.cardPaymentMethod];
|
|
1935
1932
|
}
|
|
1936
1933
|
|
|
1937
|
-
async createElements() {
|
|
1934
|
+
async createElements(cart) {
|
|
1938
1935
|
const {
|
|
1939
1936
|
elementId = 'googlepay-button',
|
|
1940
1937
|
locale = 'en',
|
|
@@ -1967,7 +1964,6 @@ class BraintreeGooglePayment extends Payment {
|
|
|
1967
1964
|
googleMerchantId: this.method.merchant_id,
|
|
1968
1965
|
googlePayVersion: API_VERSION,
|
|
1969
1966
|
});
|
|
1970
|
-
const cart = await this.getCart();
|
|
1971
1967
|
const paymentRequestData = this._createPaymentRequestData(cart);
|
|
1972
1968
|
const paymentDataRequest =
|
|
1973
1969
|
googlePayment.createPaymentDataRequest(paymentRequestData);
|
|
@@ -2127,7 +2123,7 @@ class BraintreeApplePayment extends Payment {
|
|
|
2127
2123
|
return window.ApplePaySession;
|
|
2128
2124
|
}
|
|
2129
2125
|
|
|
2130
|
-
async createElements() {
|
|
2126
|
+
async createElements(cart) {
|
|
2131
2127
|
const { elementId = 'applepay-button' } = this.params;
|
|
2132
2128
|
|
|
2133
2129
|
this.setElementContainer(elementId);
|
|
@@ -2139,7 +2135,6 @@ class BraintreeApplePayment extends Payment {
|
|
|
2139
2135
|
);
|
|
2140
2136
|
}
|
|
2141
2137
|
|
|
2142
|
-
const cart = await this.getCart();
|
|
2143
2138
|
const braintreeClient = await this._createBraintreeClient();
|
|
2144
2139
|
const applePayment = await this.braintree.applePay.create({
|
|
2145
2140
|
client: braintreeClient,
|
|
@@ -2638,7 +2633,7 @@ class PaypalDirectPayment extends Payment {
|
|
|
2638
2633
|
}?gateway=paypal`;
|
|
2639
2634
|
}
|
|
2640
2635
|
|
|
2641
|
-
async createElements() {
|
|
2636
|
+
async createElements(cart) {
|
|
2642
2637
|
const {
|
|
2643
2638
|
elementId = 'paypal-button',
|
|
2644
2639
|
locale = 'en_US',
|
|
@@ -2654,8 +2649,6 @@ class PaypalDirectPayment extends Payment {
|
|
|
2654
2649
|
|
|
2655
2650
|
this.setElementContainer(elementId);
|
|
2656
2651
|
|
|
2657
|
-
const cart = await this.getCart();
|
|
2658
|
-
|
|
2659
2652
|
this._validateCart(cart);
|
|
2660
2653
|
await this.loadScripts(this.scripts);
|
|
2661
2654
|
|
|
@@ -2914,7 +2907,7 @@ class AmazonDirectPayment extends Payment {
|
|
|
2914
2907
|
}?gateway=amazon`;
|
|
2915
2908
|
}
|
|
2916
2909
|
|
|
2917
|
-
async createElements() {
|
|
2910
|
+
async createElements(cart) {
|
|
2918
2911
|
const {
|
|
2919
2912
|
elementId = 'amazonpay-button',
|
|
2920
2913
|
locale = 'en_US',
|
|
@@ -2925,7 +2918,6 @@ class AmazonDirectPayment extends Payment {
|
|
|
2925
2918
|
|
|
2926
2919
|
this.setElementContainer(elementId);
|
|
2927
2920
|
|
|
2928
|
-
const cart = await this.getCart();
|
|
2929
2921
|
const session = await this._createSession(cart);
|
|
2930
2922
|
|
|
2931
2923
|
await this.loadScripts(this.scripts);
|
|
@@ -3120,6 +3112,7 @@ class PaymentController {
|
|
|
3120
3112
|
constructor(request, options) {
|
|
3121
3113
|
this.request = request;
|
|
3122
3114
|
this.options = options;
|
|
3115
|
+
this.payment = new Payment(this.request, this.options);
|
|
3123
3116
|
}
|
|
3124
3117
|
|
|
3125
3118
|
get(id) {
|
|
@@ -3144,10 +3137,14 @@ class PaymentController {
|
|
|
3144
3137
|
}
|
|
3145
3138
|
|
|
3146
3139
|
const paymentInstances = await this._createPaymentInstances();
|
|
3140
|
+
const cart = await this.payment.getCart();
|
|
3147
3141
|
|
|
3148
|
-
await this._performPaymentAction(
|
|
3149
|
-
|
|
3150
|
-
|
|
3142
|
+
await this._performPaymentAction(
|
|
3143
|
+
paymentInstances,
|
|
3144
|
+
'createElements',
|
|
3145
|
+
cart,
|
|
3146
|
+
).then((paymentInstances) =>
|
|
3147
|
+
this._performPaymentAction(paymentInstances, 'mountElements'),
|
|
3151
3148
|
);
|
|
3152
3149
|
}
|
|
3153
3150
|
|
|
@@ -3313,18 +3310,26 @@ class PaymentController {
|
|
|
3313
3310
|
}
|
|
3314
3311
|
|
|
3315
3312
|
async _performPaymentAction(paymentInstances, action, ...args) {
|
|
3313
|
+
const actions = paymentInstances.reduce((acc, instance) => {
|
|
3314
|
+
const paymentAction = instance[action];
|
|
3315
|
+
|
|
3316
|
+
if (paymentAction) {
|
|
3317
|
+
acc.set(instance, paymentAction.call(instance, ...args));
|
|
3318
|
+
}
|
|
3319
|
+
|
|
3320
|
+
return acc;
|
|
3321
|
+
}, new Map());
|
|
3322
|
+
|
|
3323
|
+
await Promise.allSettled(actions.values());
|
|
3324
|
+
|
|
3316
3325
|
const nextPaymentInstances = [];
|
|
3317
3326
|
|
|
3318
|
-
for (const
|
|
3327
|
+
for (const [instance, resultPromise] of actions.entries()) {
|
|
3319
3328
|
try {
|
|
3320
|
-
|
|
3321
|
-
|
|
3322
|
-
if (paymentAction) {
|
|
3323
|
-
await paymentAction.call(paymentInstance, ...args);
|
|
3324
|
-
nextPaymentInstances.push(paymentInstance);
|
|
3325
|
-
}
|
|
3329
|
+
await resultPromise;
|
|
3330
|
+
nextPaymentInstances.push(instance);
|
|
3326
3331
|
} catch (error) {
|
|
3327
|
-
const onPaymentError =
|
|
3332
|
+
const onPaymentError = instance.onError.bind(instance);
|
|
3328
3333
|
|
|
3329
3334
|
onPaymentError(error);
|
|
3330
3335
|
}
|
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { a as default } from './api.
|
|
1
|
+
export { a as default } from './api.10709a76.mjs';
|
|
2
2
|
import './card.982ad378.mjs';
|
|
3
3
|
import './index.b29eadc6.mjs';
|
|
4
4
|
import 'qs';
|
|
@@ -16,6 +16,6 @@ import './categories.f6027058.mjs';
|
|
|
16
16
|
import './subscriptions.fd44cccc.mjs';
|
|
17
17
|
import './content.5b4bea62.mjs';
|
|
18
18
|
import './settings.6c0d2563.mjs';
|
|
19
|
-
import './index.
|
|
19
|
+
import './index.a60f77a7.mjs';
|
|
20
20
|
import './locale.9d7241ac.mjs';
|
|
21
21
|
import './currency.e2cd8985.mjs';
|
package/dist/payment.mjs
CHANGED
package/dist/swell.cjs
CHANGED
|
@@ -741,7 +741,7 @@ ListCache.prototype.has = listCacheHas;
|
|
|
741
741
|
ListCache.prototype.set = listCacheSet;
|
|
742
742
|
|
|
743
743
|
/* Built-in method references that are verified to be native. */
|
|
744
|
-
var Map = getNative(root, 'Map');
|
|
744
|
+
var Map$1 = getNative(root, 'Map');
|
|
745
745
|
|
|
746
746
|
/**
|
|
747
747
|
* Removes all key-value entries from the map.
|
|
@@ -754,7 +754,7 @@ function mapCacheClear() {
|
|
|
754
754
|
this.size = 0;
|
|
755
755
|
this.__data__ = {
|
|
756
756
|
'hash': new Hash,
|
|
757
|
-
'map': new (Map || ListCache),
|
|
757
|
+
'map': new (Map$1 || ListCache),
|
|
758
758
|
'string': new Hash
|
|
759
759
|
};
|
|
760
760
|
}
|
|
@@ -1628,7 +1628,7 @@ function stackSet(key, value) {
|
|
|
1628
1628
|
var data = this.__data__;
|
|
1629
1629
|
if (data instanceof ListCache) {
|
|
1630
1630
|
var pairs = data.__data__;
|
|
1631
|
-
if (!Map || (pairs.length < LARGE_ARRAY_SIZE - 1)) {
|
|
1631
|
+
if (!Map$1 || (pairs.length < LARGE_ARRAY_SIZE - 1)) {
|
|
1632
1632
|
pairs.push([key, value]);
|
|
1633
1633
|
this.size = ++data.size;
|
|
1634
1634
|
return this;
|
|
@@ -2538,7 +2538,7 @@ var dataViewTag$2 = '[object DataView]';
|
|
|
2538
2538
|
|
|
2539
2539
|
/** Used to detect maps, sets, and weakmaps. */
|
|
2540
2540
|
var dataViewCtorString = toSource(DataView),
|
|
2541
|
-
mapCtorString = toSource(Map),
|
|
2541
|
+
mapCtorString = toSource(Map$1),
|
|
2542
2542
|
promiseCtorString = toSource(Promise$1),
|
|
2543
2543
|
setCtorString = toSource(Set),
|
|
2544
2544
|
weakMapCtorString = toSource(WeakMap);
|
|
@@ -2554,7 +2554,7 @@ var getTag = baseGetTag;
|
|
|
2554
2554
|
|
|
2555
2555
|
// Fallback for data views, maps, sets, and weak maps in IE 11 and promises in Node.js < 6.
|
|
2556
2556
|
if ((DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag$2) ||
|
|
2557
|
-
(Map && getTag(new Map) != mapTag$4) ||
|
|
2557
|
+
(Map$1 && getTag(new Map$1) != mapTag$4) ||
|
|
2558
2558
|
(Promise$1 && getTag(Promise$1.resolve()) != promiseTag) ||
|
|
2559
2559
|
(Set && getTag(new Set) != setTag$4) ||
|
|
2560
2560
|
(WeakMap && getTag(new WeakMap) != weakMapTag$1)) {
|
|
@@ -7490,7 +7490,7 @@ class StripeGooglePayment extends Payment {
|
|
|
7490
7490
|
return [this.cardPaymentMethod];
|
|
7491
7491
|
}
|
|
7492
7492
|
|
|
7493
|
-
async createElements() {
|
|
7493
|
+
async createElements(cart) {
|
|
7494
7494
|
const {
|
|
7495
7495
|
elementId = 'googlepay-button',
|
|
7496
7496
|
locale = 'en',
|
|
@@ -7517,7 +7517,6 @@ class StripeGooglePayment extends Payment {
|
|
|
7517
7517
|
);
|
|
7518
7518
|
}
|
|
7519
7519
|
|
|
7520
|
-
const cart = await this.getCart();
|
|
7521
7520
|
const paymentRequestData = this._createPaymentRequestData(cart);
|
|
7522
7521
|
|
|
7523
7522
|
this.element = this.googleClient.createButton({
|
|
@@ -7667,7 +7666,7 @@ class StripeApplePayment extends Payment {
|
|
|
7667
7666
|
StripeApplePayment.stripe = stripe;
|
|
7668
7667
|
}
|
|
7669
7668
|
|
|
7670
|
-
async createElements() {
|
|
7669
|
+
async createElements(cart) {
|
|
7671
7670
|
const {
|
|
7672
7671
|
elementId = 'applepay-button',
|
|
7673
7672
|
style: { type = 'default', theme = 'dark', height = '40px' } = {},
|
|
@@ -7678,7 +7677,6 @@ class StripeApplePayment extends Payment {
|
|
|
7678
7677
|
await this.loadScripts(this.scripts);
|
|
7679
7678
|
await this._authorizeDomain();
|
|
7680
7679
|
|
|
7681
|
-
const cart = await this.getCart();
|
|
7682
7680
|
const paymentRequest = this._createPaymentRequest(cart);
|
|
7683
7681
|
const canMakePayment = await paymentRequest.canMakePayment();
|
|
7684
7682
|
|
|
@@ -7942,7 +7940,7 @@ class BraintreePaypalPayment extends Payment {
|
|
|
7942
7940
|
return this.braintree.paypalCheckout;
|
|
7943
7941
|
}
|
|
7944
7942
|
|
|
7945
|
-
async createElements() {
|
|
7943
|
+
async createElements(cart) {
|
|
7946
7944
|
const {
|
|
7947
7945
|
elementId = 'paypal-button',
|
|
7948
7946
|
locale = 'en_US',
|
|
@@ -7974,7 +7972,6 @@ class BraintreePaypalPayment extends Payment {
|
|
|
7974
7972
|
const paypalCheckout = await this.braintreePaypalCheckout.create({
|
|
7975
7973
|
client: braintreeClient,
|
|
7976
7974
|
});
|
|
7977
|
-
const cart = await this.getCart();
|
|
7978
7975
|
|
|
7979
7976
|
this.element = this.paypal.Buttons({
|
|
7980
7977
|
locale,
|
|
@@ -8143,7 +8140,7 @@ class BraintreeGooglePayment extends Payment {
|
|
|
8143
8140
|
return [this.cardPaymentMethod];
|
|
8144
8141
|
}
|
|
8145
8142
|
|
|
8146
|
-
async createElements() {
|
|
8143
|
+
async createElements(cart) {
|
|
8147
8144
|
const {
|
|
8148
8145
|
elementId = 'googlepay-button',
|
|
8149
8146
|
locale = 'en',
|
|
@@ -8176,7 +8173,6 @@ class BraintreeGooglePayment extends Payment {
|
|
|
8176
8173
|
googleMerchantId: this.method.merchant_id,
|
|
8177
8174
|
googlePayVersion: API_VERSION,
|
|
8178
8175
|
});
|
|
8179
|
-
const cart = await this.getCart();
|
|
8180
8176
|
const paymentRequestData = this._createPaymentRequestData(cart);
|
|
8181
8177
|
const paymentDataRequest =
|
|
8182
8178
|
googlePayment.createPaymentDataRequest(paymentRequestData);
|
|
@@ -8336,7 +8332,7 @@ class BraintreeApplePayment extends Payment {
|
|
|
8336
8332
|
return window.ApplePaySession;
|
|
8337
8333
|
}
|
|
8338
8334
|
|
|
8339
|
-
async createElements() {
|
|
8335
|
+
async createElements(cart) {
|
|
8340
8336
|
const { elementId = 'applepay-button' } = this.params;
|
|
8341
8337
|
|
|
8342
8338
|
this.setElementContainer(elementId);
|
|
@@ -8348,7 +8344,6 @@ class BraintreeApplePayment extends Payment {
|
|
|
8348
8344
|
);
|
|
8349
8345
|
}
|
|
8350
8346
|
|
|
8351
|
-
const cart = await this.getCart();
|
|
8352
8347
|
const braintreeClient = await this._createBraintreeClient();
|
|
8353
8348
|
const applePayment = await this.braintree.applePay.create({
|
|
8354
8349
|
client: braintreeClient,
|
|
@@ -8847,7 +8842,7 @@ class PaypalDirectPayment extends Payment {
|
|
|
8847
8842
|
}?gateway=paypal`;
|
|
8848
8843
|
}
|
|
8849
8844
|
|
|
8850
|
-
async createElements() {
|
|
8845
|
+
async createElements(cart) {
|
|
8851
8846
|
const {
|
|
8852
8847
|
elementId = 'paypal-button',
|
|
8853
8848
|
locale = 'en_US',
|
|
@@ -8863,8 +8858,6 @@ class PaypalDirectPayment extends Payment {
|
|
|
8863
8858
|
|
|
8864
8859
|
this.setElementContainer(elementId);
|
|
8865
8860
|
|
|
8866
|
-
const cart = await this.getCart();
|
|
8867
|
-
|
|
8868
8861
|
this._validateCart(cart);
|
|
8869
8862
|
await this.loadScripts(this.scripts);
|
|
8870
8863
|
|
|
@@ -9123,7 +9116,7 @@ class AmazonDirectPayment extends Payment {
|
|
|
9123
9116
|
}?gateway=amazon`;
|
|
9124
9117
|
}
|
|
9125
9118
|
|
|
9126
|
-
async createElements() {
|
|
9119
|
+
async createElements(cart) {
|
|
9127
9120
|
const {
|
|
9128
9121
|
elementId = 'amazonpay-button',
|
|
9129
9122
|
locale = 'en_US',
|
|
@@ -9134,7 +9127,6 @@ class AmazonDirectPayment extends Payment {
|
|
|
9134
9127
|
|
|
9135
9128
|
this.setElementContainer(elementId);
|
|
9136
9129
|
|
|
9137
|
-
const cart = await this.getCart();
|
|
9138
9130
|
const session = await this._createSession(cart);
|
|
9139
9131
|
|
|
9140
9132
|
await this.loadScripts(this.scripts);
|
|
@@ -9329,6 +9321,7 @@ class PaymentController {
|
|
|
9329
9321
|
constructor(request, options) {
|
|
9330
9322
|
this.request = request;
|
|
9331
9323
|
this.options = options;
|
|
9324
|
+
this.payment = new Payment(this.request, this.options);
|
|
9332
9325
|
}
|
|
9333
9326
|
|
|
9334
9327
|
get(id) {
|
|
@@ -9353,10 +9346,14 @@ class PaymentController {
|
|
|
9353
9346
|
}
|
|
9354
9347
|
|
|
9355
9348
|
const paymentInstances = await this._createPaymentInstances();
|
|
9349
|
+
const cart = await this.payment.getCart();
|
|
9356
9350
|
|
|
9357
|
-
await this._performPaymentAction(
|
|
9358
|
-
|
|
9359
|
-
|
|
9351
|
+
await this._performPaymentAction(
|
|
9352
|
+
paymentInstances,
|
|
9353
|
+
'createElements',
|
|
9354
|
+
cart,
|
|
9355
|
+
).then((paymentInstances) =>
|
|
9356
|
+
this._performPaymentAction(paymentInstances, 'mountElements'),
|
|
9360
9357
|
);
|
|
9361
9358
|
}
|
|
9362
9359
|
|
|
@@ -9522,18 +9519,26 @@ class PaymentController {
|
|
|
9522
9519
|
}
|
|
9523
9520
|
|
|
9524
9521
|
async _performPaymentAction(paymentInstances, action, ...args) {
|
|
9522
|
+
const actions = paymentInstances.reduce((acc, instance) => {
|
|
9523
|
+
const paymentAction = instance[action];
|
|
9524
|
+
|
|
9525
|
+
if (paymentAction) {
|
|
9526
|
+
acc.set(instance, paymentAction.call(instance, ...args));
|
|
9527
|
+
}
|
|
9528
|
+
|
|
9529
|
+
return acc;
|
|
9530
|
+
}, new Map());
|
|
9531
|
+
|
|
9532
|
+
await Promise.allSettled(actions.values());
|
|
9533
|
+
|
|
9525
9534
|
const nextPaymentInstances = [];
|
|
9526
9535
|
|
|
9527
|
-
for (const
|
|
9536
|
+
for (const [instance, resultPromise] of actions.entries()) {
|
|
9528
9537
|
try {
|
|
9529
|
-
|
|
9530
|
-
|
|
9531
|
-
if (paymentAction) {
|
|
9532
|
-
await paymentAction.call(paymentInstance, ...args);
|
|
9533
|
-
nextPaymentInstances.push(paymentInstance);
|
|
9534
|
-
}
|
|
9538
|
+
await resultPromise;
|
|
9539
|
+
nextPaymentInstances.push(instance);
|
|
9535
9540
|
} catch (error) {
|
|
9536
|
-
const onPaymentError =
|
|
9541
|
+
const onPaymentError = instance.onError.bind(instance);
|
|
9537
9542
|
|
|
9538
9543
|
onPaymentError(error);
|
|
9539
9544
|
}
|
|
@@ -9965,7 +9970,7 @@ const options = {
|
|
|
9965
9970
|
};
|
|
9966
9971
|
|
|
9967
9972
|
const api = {
|
|
9968
|
-
version: '3.24.
|
|
9973
|
+
version: '3.24.2',
|
|
9969
9974
|
options,
|
|
9970
9975
|
request,
|
|
9971
9976
|
|