@pelcro/react-pelcro-js 3.40.0 → 3.42.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/index.cjs.js +35 -106
- package/dist/index.esm.js +35 -106
- package/package.json +1 -1
package/dist/index.cjs.js
CHANGED
|
@@ -11768,7 +11768,10 @@ const loadPaymentSDKs = () => {
|
|
|
11768
11768
|
window.Pelcro.helpers.loadSDK("https://js.braintreegateway.com/web/3.99.0/js/paypal-checkout.min.js", "braintree-paypal-sdk");
|
|
11769
11769
|
}
|
|
11770
11770
|
if (supportsBraintree) {
|
|
11771
|
-
window.Pelcro.helpers.loadSDK(
|
|
11771
|
+
// window.Pelcro.helpers.loadSDK(
|
|
11772
|
+
// "https://js.braintreegateway.com/web/3.99.0/js/three-d-secure.min.js",
|
|
11773
|
+
// "braintree-3D-secure-sdk"
|
|
11774
|
+
// );
|
|
11772
11775
|
window.Pelcro.helpers.loadSDK("https://js.braintreegateway.com/web/3.99.0/js/hosted-fields.min.js", "braintree-hosted-fields-sdk");
|
|
11773
11776
|
}
|
|
11774
11777
|
|
|
@@ -18302,7 +18305,6 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
18302
18305
|
|
|
18303
18306
|
/* ====== Start Braintree integration ======== */
|
|
18304
18307
|
const braintreeInstanceRef = React__default['default'].useRef(null);
|
|
18305
|
-
const braintree3DSecureInstanceRef = React__default['default'].useRef(null);
|
|
18306
18308
|
function getClientToken() {
|
|
18307
18309
|
return new Promise((resolve, reject) => {
|
|
18308
18310
|
window.Pelcro.payment.generateClientToken({
|
|
@@ -18363,12 +18365,6 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
18363
18365
|
type: SKELETON_LOADER,
|
|
18364
18366
|
payload: true
|
|
18365
18367
|
});
|
|
18366
|
-
braintree3DSecureInstanceRef.current = new window.braintree.threeDSecure.create({
|
|
18367
|
-
version: 2,
|
|
18368
|
-
authorization: braintreeToken
|
|
18369
|
-
}).then(threeDSecureInstance => {
|
|
18370
|
-
return threeDSecureInstance;
|
|
18371
|
-
});
|
|
18372
18368
|
return window.braintree.hostedFields.create(options);
|
|
18373
18369
|
});
|
|
18374
18370
|
braintreeInstanceRef.current.then(hostedFieldInstance => {
|
|
@@ -18515,7 +18511,6 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
18515
18511
|
}
|
|
18516
18512
|
};
|
|
18517
18513
|
const submitUsingBraintree = (state, dispatch) => {
|
|
18518
|
-
var _ref6, _ref7, _state$updatedPrice2;
|
|
18519
18514
|
const isUsingExistingPaymentMethod = Boolean(selectedPaymentMethodId);
|
|
18520
18515
|
if (isUsingExistingPaymentMethod) {
|
|
18521
18516
|
// no need to create a new source using braintree
|
|
@@ -18524,22 +18519,6 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
18524
18519
|
if (!braintreeInstanceRef.current) {
|
|
18525
18520
|
return console.error("Braintree sdk script wasn't loaded, you need to load braintree sdk before rendering the braintree payment flow");
|
|
18526
18521
|
}
|
|
18527
|
-
const getOrderItemsTotal = () => {
|
|
18528
|
-
if (!order) {
|
|
18529
|
-
return null;
|
|
18530
|
-
}
|
|
18531
|
-
const isQuickPurchase = !Array.isArray(order);
|
|
18532
|
-
if (isQuickPurchase) {
|
|
18533
|
-
return order.price * order.quantity;
|
|
18534
|
-
}
|
|
18535
|
-
if (order.length === 0) {
|
|
18536
|
-
return null;
|
|
18537
|
-
}
|
|
18538
|
-
return order.reduce((total, item) => {
|
|
18539
|
-
return total + item.price * item.quantity;
|
|
18540
|
-
}, 0);
|
|
18541
|
-
};
|
|
18542
|
-
const totalAmount = (_ref6 = (_ref7 = (_state$updatedPrice2 = state === null || state === void 0 ? void 0 : state.updatedPrice) !== null && _state$updatedPrice2 !== void 0 ? _state$updatedPrice2 : plan === null || plan === void 0 ? void 0 : plan.amount) !== null && _ref7 !== void 0 ? _ref7 : invoice === null || invoice === void 0 ? void 0 : invoice.amount_remaining) !== null && _ref6 !== void 0 ? _ref6 : getOrderItemsTotal();
|
|
18543
18522
|
braintreeInstanceRef.current.then(hostedFieldInstance => {
|
|
18544
18523
|
hostedFieldInstance.tokenize((tokenizeErr, payload) => {
|
|
18545
18524
|
if (tokenizeErr) {
|
|
@@ -18559,79 +18538,28 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
18559
18538
|
}
|
|
18560
18539
|
});
|
|
18561
18540
|
}
|
|
18562
|
-
|
|
18563
|
-
|
|
18564
|
-
|
|
18565
|
-
braintree3DSecureInstanceRef.current.then(threeDSecureInstance => {
|
|
18566
|
-
threeDSecureInstance.verifyCard({
|
|
18567
|
-
onLookupComplete: function (data, next) {
|
|
18568
|
-
next();
|
|
18569
|
-
},
|
|
18570
|
-
amount: totalAmount !== null && totalAmount !== void 0 ? totalAmount : "0.00",
|
|
18571
|
-
nonce: payload.nonce,
|
|
18572
|
-
bin: payload.details.bin
|
|
18573
|
-
}).then(payload => {
|
|
18574
|
-
if (payload.liabilityShifted) {
|
|
18575
|
-
handleBraintreePayment(payload, state.couponCode);
|
|
18576
|
-
} else if (payload.liabilityShiftPossible) {
|
|
18577
|
-
dispatch({
|
|
18578
|
-
type: DISABLE_SUBMIT,
|
|
18579
|
-
payload: false
|
|
18580
|
-
});
|
|
18581
|
-
dispatch({
|
|
18582
|
-
type: LOADING,
|
|
18583
|
-
payload: false
|
|
18584
|
-
});
|
|
18585
|
-
return dispatch({
|
|
18586
|
-
type: SHOW_ALERT,
|
|
18587
|
-
payload: {
|
|
18588
|
-
type: "error",
|
|
18589
|
-
content: "We encountered an issue verifying your transaction with 3D Secure, please try again."
|
|
18590
|
-
}
|
|
18591
|
-
});
|
|
18592
|
-
} else {
|
|
18593
|
-
// Liability has not shifted and will not shift
|
|
18594
|
-
dispatch({
|
|
18595
|
-
type: DISABLE_SUBMIT,
|
|
18596
|
-
payload: false
|
|
18597
|
-
});
|
|
18598
|
-
dispatch({
|
|
18599
|
-
type: LOADING,
|
|
18600
|
-
payload: false
|
|
18601
|
-
});
|
|
18602
|
-
return dispatch({
|
|
18603
|
-
type: SHOW_ALERT,
|
|
18604
|
-
payload: {
|
|
18605
|
-
type: "error",
|
|
18606
|
-
content: "We encountered an issue verifying your transaction with 3D Secure, please try another payment method."
|
|
18607
|
-
}
|
|
18608
|
-
});
|
|
18609
|
-
}
|
|
18610
|
-
}).catch(error => {
|
|
18611
|
-
console.error(error);
|
|
18612
|
-
dispatch({
|
|
18613
|
-
type: DISABLE_SUBMIT,
|
|
18614
|
-
payload: false
|
|
18615
|
-
});
|
|
18616
|
-
dispatch({
|
|
18617
|
-
type: LOADING,
|
|
18618
|
-
payload: false
|
|
18619
|
-
});
|
|
18620
|
-
return dispatch({
|
|
18621
|
-
type: SHOW_ALERT,
|
|
18622
|
-
payload: {
|
|
18623
|
-
type: "error",
|
|
18624
|
-
content: "There was a problem with your request."
|
|
18625
|
-
}
|
|
18626
|
-
});
|
|
18627
|
-
});
|
|
18628
|
-
});
|
|
18629
|
-
}
|
|
18541
|
+
|
|
18542
|
+
// Directly handle the payment with the tokenized payload
|
|
18543
|
+
handleBraintreePayment(payload, state.couponCode);
|
|
18630
18544
|
});
|
|
18631
18545
|
}).catch(error => {
|
|
18632
18546
|
if (error) {
|
|
18633
18547
|
console.error(error);
|
|
18634
|
-
|
|
18548
|
+
dispatch({
|
|
18549
|
+
type: DISABLE_SUBMIT,
|
|
18550
|
+
payload: false
|
|
18551
|
+
});
|
|
18552
|
+
dispatch({
|
|
18553
|
+
type: LOADING,
|
|
18554
|
+
payload: false
|
|
18555
|
+
});
|
|
18556
|
+
return dispatch({
|
|
18557
|
+
type: SHOW_ALERT,
|
|
18558
|
+
payload: {
|
|
18559
|
+
type: "error",
|
|
18560
|
+
content: "There was a problem with your request."
|
|
18561
|
+
}
|
|
18562
|
+
});
|
|
18635
18563
|
}
|
|
18636
18564
|
});
|
|
18637
18565
|
};
|
|
@@ -18682,6 +18610,7 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
18682
18610
|
content: t("messages.sourceCreated")
|
|
18683
18611
|
}
|
|
18684
18612
|
});
|
|
18613
|
+
refreshUser();
|
|
18685
18614
|
onSuccess(res);
|
|
18686
18615
|
});
|
|
18687
18616
|
}
|
|
@@ -19222,13 +19151,13 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
19222
19151
|
});
|
|
19223
19152
|
|
|
19224
19153
|
// When Google pay / Apple pay source created
|
|
19225
|
-
paymentRequest.on("source",
|
|
19154
|
+
paymentRequest.on("source", _ref6 => {
|
|
19226
19155
|
var _source$card;
|
|
19227
19156
|
let {
|
|
19228
19157
|
complete,
|
|
19229
19158
|
source,
|
|
19230
19159
|
...data
|
|
19231
|
-
} =
|
|
19160
|
+
} = _ref6;
|
|
19232
19161
|
dispatch({
|
|
19233
19162
|
type: DISABLE_COUPON_BUTTON,
|
|
19234
19163
|
payload: true
|
|
@@ -19243,11 +19172,11 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
19243
19172
|
});
|
|
19244
19173
|
complete("success");
|
|
19245
19174
|
if ((source === null || source === void 0 ? void 0 : (_source$card = source.card) === null || _source$card === void 0 ? void 0 : _source$card.three_d_secure) === "required") {
|
|
19246
|
-
return generate3DSecureSource(source).then(
|
|
19175
|
+
return generate3DSecureSource(source).then(_ref7 => {
|
|
19247
19176
|
let {
|
|
19248
19177
|
source,
|
|
19249
19178
|
error
|
|
19250
|
-
} =
|
|
19179
|
+
} = _ref7;
|
|
19251
19180
|
if (error) {
|
|
19252
19181
|
return handlePaymentError(error);
|
|
19253
19182
|
}
|
|
@@ -19964,11 +19893,11 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
19964
19893
|
const createPaymentSource = (state, dispatch) => {
|
|
19965
19894
|
return stripe.createSource({
|
|
19966
19895
|
type: "card"
|
|
19967
|
-
}).then(
|
|
19896
|
+
}).then(_ref8 => {
|
|
19968
19897
|
let {
|
|
19969
19898
|
source,
|
|
19970
19899
|
error
|
|
19971
|
-
} =
|
|
19900
|
+
} = _ref8;
|
|
19972
19901
|
if (error) {
|
|
19973
19902
|
return handlePaymentError(error);
|
|
19974
19903
|
}
|
|
@@ -20082,11 +20011,11 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
20082
20011
|
} = paymentMethodToDelete;
|
|
20083
20012
|
return stripe.createSource({
|
|
20084
20013
|
type: "card"
|
|
20085
|
-
}).then(
|
|
20014
|
+
}).then(_ref9 => {
|
|
20086
20015
|
let {
|
|
20087
20016
|
source,
|
|
20088
20017
|
error
|
|
20089
|
-
} =
|
|
20018
|
+
} = _ref9;
|
|
20090
20019
|
if (error) {
|
|
20091
20020
|
return handlePaymentError(error);
|
|
20092
20021
|
}
|
|
@@ -20184,12 +20113,12 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
20184
20113
|
}
|
|
20185
20114
|
stripe.createSource({
|
|
20186
20115
|
type: "card"
|
|
20187
|
-
}).then(
|
|
20188
|
-
var
|
|
20116
|
+
}).then(_ref10 => {
|
|
20117
|
+
var _ref11, _ref12, _state$updatedPrice2;
|
|
20189
20118
|
let {
|
|
20190
20119
|
source,
|
|
20191
20120
|
error
|
|
20192
|
-
} =
|
|
20121
|
+
} = _ref10;
|
|
20193
20122
|
if (error) {
|
|
20194
20123
|
return handlePaymentError(error);
|
|
20195
20124
|
}
|
|
@@ -20208,7 +20137,7 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
20208
20137
|
return total + item.price * item.quantity;
|
|
20209
20138
|
}, 0);
|
|
20210
20139
|
};
|
|
20211
|
-
(
|
|
20140
|
+
(_ref11 = (_ref12 = (_state$updatedPrice2 = state === null || state === void 0 ? void 0 : state.updatedPrice) !== null && _state$updatedPrice2 !== void 0 ? _state$updatedPrice2 : plan === null || plan === void 0 ? void 0 : plan.amount) !== null && _ref12 !== void 0 ? _ref12 : invoice === null || invoice === void 0 ? void 0 : invoice.amount_remaining) !== null && _ref11 !== void 0 ? _ref11 : getOrderItemsTotal();
|
|
20212
20141
|
return handlePayment(source);
|
|
20213
20142
|
}).catch(error => {
|
|
20214
20143
|
return handlePaymentError(error);
|
package/dist/index.esm.js
CHANGED
|
@@ -11738,7 +11738,10 @@ const loadPaymentSDKs = () => {
|
|
|
11738
11738
|
window.Pelcro.helpers.loadSDK("https://js.braintreegateway.com/web/3.99.0/js/paypal-checkout.min.js", "braintree-paypal-sdk");
|
|
11739
11739
|
}
|
|
11740
11740
|
if (supportsBraintree) {
|
|
11741
|
-
window.Pelcro.helpers.loadSDK(
|
|
11741
|
+
// window.Pelcro.helpers.loadSDK(
|
|
11742
|
+
// "https://js.braintreegateway.com/web/3.99.0/js/three-d-secure.min.js",
|
|
11743
|
+
// "braintree-3D-secure-sdk"
|
|
11744
|
+
// );
|
|
11742
11745
|
window.Pelcro.helpers.loadSDK("https://js.braintreegateway.com/web/3.99.0/js/hosted-fields.min.js", "braintree-hosted-fields-sdk");
|
|
11743
11746
|
}
|
|
11744
11747
|
|
|
@@ -18272,7 +18275,6 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
18272
18275
|
|
|
18273
18276
|
/* ====== Start Braintree integration ======== */
|
|
18274
18277
|
const braintreeInstanceRef = React__default.useRef(null);
|
|
18275
|
-
const braintree3DSecureInstanceRef = React__default.useRef(null);
|
|
18276
18278
|
function getClientToken() {
|
|
18277
18279
|
return new Promise((resolve, reject) => {
|
|
18278
18280
|
window.Pelcro.payment.generateClientToken({
|
|
@@ -18333,12 +18335,6 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
18333
18335
|
type: SKELETON_LOADER,
|
|
18334
18336
|
payload: true
|
|
18335
18337
|
});
|
|
18336
|
-
braintree3DSecureInstanceRef.current = new window.braintree.threeDSecure.create({
|
|
18337
|
-
version: 2,
|
|
18338
|
-
authorization: braintreeToken
|
|
18339
|
-
}).then(threeDSecureInstance => {
|
|
18340
|
-
return threeDSecureInstance;
|
|
18341
|
-
});
|
|
18342
18338
|
return window.braintree.hostedFields.create(options);
|
|
18343
18339
|
});
|
|
18344
18340
|
braintreeInstanceRef.current.then(hostedFieldInstance => {
|
|
@@ -18485,7 +18481,6 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
18485
18481
|
}
|
|
18486
18482
|
};
|
|
18487
18483
|
const submitUsingBraintree = (state, dispatch) => {
|
|
18488
|
-
var _ref6, _ref7, _state$updatedPrice2;
|
|
18489
18484
|
const isUsingExistingPaymentMethod = Boolean(selectedPaymentMethodId);
|
|
18490
18485
|
if (isUsingExistingPaymentMethod) {
|
|
18491
18486
|
// no need to create a new source using braintree
|
|
@@ -18494,22 +18489,6 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
18494
18489
|
if (!braintreeInstanceRef.current) {
|
|
18495
18490
|
return console.error("Braintree sdk script wasn't loaded, you need to load braintree sdk before rendering the braintree payment flow");
|
|
18496
18491
|
}
|
|
18497
|
-
const getOrderItemsTotal = () => {
|
|
18498
|
-
if (!order) {
|
|
18499
|
-
return null;
|
|
18500
|
-
}
|
|
18501
|
-
const isQuickPurchase = !Array.isArray(order);
|
|
18502
|
-
if (isQuickPurchase) {
|
|
18503
|
-
return order.price * order.quantity;
|
|
18504
|
-
}
|
|
18505
|
-
if (order.length === 0) {
|
|
18506
|
-
return null;
|
|
18507
|
-
}
|
|
18508
|
-
return order.reduce((total, item) => {
|
|
18509
|
-
return total + item.price * item.quantity;
|
|
18510
|
-
}, 0);
|
|
18511
|
-
};
|
|
18512
|
-
const totalAmount = (_ref6 = (_ref7 = (_state$updatedPrice2 = state === null || state === void 0 ? void 0 : state.updatedPrice) !== null && _state$updatedPrice2 !== void 0 ? _state$updatedPrice2 : plan === null || plan === void 0 ? void 0 : plan.amount) !== null && _ref7 !== void 0 ? _ref7 : invoice === null || invoice === void 0 ? void 0 : invoice.amount_remaining) !== null && _ref6 !== void 0 ? _ref6 : getOrderItemsTotal();
|
|
18513
18492
|
braintreeInstanceRef.current.then(hostedFieldInstance => {
|
|
18514
18493
|
hostedFieldInstance.tokenize((tokenizeErr, payload) => {
|
|
18515
18494
|
if (tokenizeErr) {
|
|
@@ -18529,79 +18508,28 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
18529
18508
|
}
|
|
18530
18509
|
});
|
|
18531
18510
|
}
|
|
18532
|
-
|
|
18533
|
-
|
|
18534
|
-
|
|
18535
|
-
braintree3DSecureInstanceRef.current.then(threeDSecureInstance => {
|
|
18536
|
-
threeDSecureInstance.verifyCard({
|
|
18537
|
-
onLookupComplete: function (data, next) {
|
|
18538
|
-
next();
|
|
18539
|
-
},
|
|
18540
|
-
amount: totalAmount !== null && totalAmount !== void 0 ? totalAmount : "0.00",
|
|
18541
|
-
nonce: payload.nonce,
|
|
18542
|
-
bin: payload.details.bin
|
|
18543
|
-
}).then(payload => {
|
|
18544
|
-
if (payload.liabilityShifted) {
|
|
18545
|
-
handleBraintreePayment(payload, state.couponCode);
|
|
18546
|
-
} else if (payload.liabilityShiftPossible) {
|
|
18547
|
-
dispatch({
|
|
18548
|
-
type: DISABLE_SUBMIT,
|
|
18549
|
-
payload: false
|
|
18550
|
-
});
|
|
18551
|
-
dispatch({
|
|
18552
|
-
type: LOADING,
|
|
18553
|
-
payload: false
|
|
18554
|
-
});
|
|
18555
|
-
return dispatch({
|
|
18556
|
-
type: SHOW_ALERT,
|
|
18557
|
-
payload: {
|
|
18558
|
-
type: "error",
|
|
18559
|
-
content: "We encountered an issue verifying your transaction with 3D Secure, please try again."
|
|
18560
|
-
}
|
|
18561
|
-
});
|
|
18562
|
-
} else {
|
|
18563
|
-
// Liability has not shifted and will not shift
|
|
18564
|
-
dispatch({
|
|
18565
|
-
type: DISABLE_SUBMIT,
|
|
18566
|
-
payload: false
|
|
18567
|
-
});
|
|
18568
|
-
dispatch({
|
|
18569
|
-
type: LOADING,
|
|
18570
|
-
payload: false
|
|
18571
|
-
});
|
|
18572
|
-
return dispatch({
|
|
18573
|
-
type: SHOW_ALERT,
|
|
18574
|
-
payload: {
|
|
18575
|
-
type: "error",
|
|
18576
|
-
content: "We encountered an issue verifying your transaction with 3D Secure, please try another payment method."
|
|
18577
|
-
}
|
|
18578
|
-
});
|
|
18579
|
-
}
|
|
18580
|
-
}).catch(error => {
|
|
18581
|
-
console.error(error);
|
|
18582
|
-
dispatch({
|
|
18583
|
-
type: DISABLE_SUBMIT,
|
|
18584
|
-
payload: false
|
|
18585
|
-
});
|
|
18586
|
-
dispatch({
|
|
18587
|
-
type: LOADING,
|
|
18588
|
-
payload: false
|
|
18589
|
-
});
|
|
18590
|
-
return dispatch({
|
|
18591
|
-
type: SHOW_ALERT,
|
|
18592
|
-
payload: {
|
|
18593
|
-
type: "error",
|
|
18594
|
-
content: "There was a problem with your request."
|
|
18595
|
-
}
|
|
18596
|
-
});
|
|
18597
|
-
});
|
|
18598
|
-
});
|
|
18599
|
-
}
|
|
18511
|
+
|
|
18512
|
+
// Directly handle the payment with the tokenized payload
|
|
18513
|
+
handleBraintreePayment(payload, state.couponCode);
|
|
18600
18514
|
});
|
|
18601
18515
|
}).catch(error => {
|
|
18602
18516
|
if (error) {
|
|
18603
18517
|
console.error(error);
|
|
18604
|
-
|
|
18518
|
+
dispatch({
|
|
18519
|
+
type: DISABLE_SUBMIT,
|
|
18520
|
+
payload: false
|
|
18521
|
+
});
|
|
18522
|
+
dispatch({
|
|
18523
|
+
type: LOADING,
|
|
18524
|
+
payload: false
|
|
18525
|
+
});
|
|
18526
|
+
return dispatch({
|
|
18527
|
+
type: SHOW_ALERT,
|
|
18528
|
+
payload: {
|
|
18529
|
+
type: "error",
|
|
18530
|
+
content: "There was a problem with your request."
|
|
18531
|
+
}
|
|
18532
|
+
});
|
|
18605
18533
|
}
|
|
18606
18534
|
});
|
|
18607
18535
|
};
|
|
@@ -18652,6 +18580,7 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
18652
18580
|
content: t("messages.sourceCreated")
|
|
18653
18581
|
}
|
|
18654
18582
|
});
|
|
18583
|
+
refreshUser();
|
|
18655
18584
|
onSuccess(res);
|
|
18656
18585
|
});
|
|
18657
18586
|
}
|
|
@@ -19192,13 +19121,13 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
19192
19121
|
});
|
|
19193
19122
|
|
|
19194
19123
|
// When Google pay / Apple pay source created
|
|
19195
|
-
paymentRequest.on("source",
|
|
19124
|
+
paymentRequest.on("source", _ref6 => {
|
|
19196
19125
|
var _source$card;
|
|
19197
19126
|
let {
|
|
19198
19127
|
complete,
|
|
19199
19128
|
source,
|
|
19200
19129
|
...data
|
|
19201
|
-
} =
|
|
19130
|
+
} = _ref6;
|
|
19202
19131
|
dispatch({
|
|
19203
19132
|
type: DISABLE_COUPON_BUTTON,
|
|
19204
19133
|
payload: true
|
|
@@ -19213,11 +19142,11 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
19213
19142
|
});
|
|
19214
19143
|
complete("success");
|
|
19215
19144
|
if ((source === null || source === void 0 ? void 0 : (_source$card = source.card) === null || _source$card === void 0 ? void 0 : _source$card.three_d_secure) === "required") {
|
|
19216
|
-
return generate3DSecureSource(source).then(
|
|
19145
|
+
return generate3DSecureSource(source).then(_ref7 => {
|
|
19217
19146
|
let {
|
|
19218
19147
|
source,
|
|
19219
19148
|
error
|
|
19220
|
-
} =
|
|
19149
|
+
} = _ref7;
|
|
19221
19150
|
if (error) {
|
|
19222
19151
|
return handlePaymentError(error);
|
|
19223
19152
|
}
|
|
@@ -19934,11 +19863,11 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
19934
19863
|
const createPaymentSource = (state, dispatch) => {
|
|
19935
19864
|
return stripe.createSource({
|
|
19936
19865
|
type: "card"
|
|
19937
|
-
}).then(
|
|
19866
|
+
}).then(_ref8 => {
|
|
19938
19867
|
let {
|
|
19939
19868
|
source,
|
|
19940
19869
|
error
|
|
19941
|
-
} =
|
|
19870
|
+
} = _ref8;
|
|
19942
19871
|
if (error) {
|
|
19943
19872
|
return handlePaymentError(error);
|
|
19944
19873
|
}
|
|
@@ -20052,11 +19981,11 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
20052
19981
|
} = paymentMethodToDelete;
|
|
20053
19982
|
return stripe.createSource({
|
|
20054
19983
|
type: "card"
|
|
20055
|
-
}).then(
|
|
19984
|
+
}).then(_ref9 => {
|
|
20056
19985
|
let {
|
|
20057
19986
|
source,
|
|
20058
19987
|
error
|
|
20059
|
-
} =
|
|
19988
|
+
} = _ref9;
|
|
20060
19989
|
if (error) {
|
|
20061
19990
|
return handlePaymentError(error);
|
|
20062
19991
|
}
|
|
@@ -20154,12 +20083,12 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
20154
20083
|
}
|
|
20155
20084
|
stripe.createSource({
|
|
20156
20085
|
type: "card"
|
|
20157
|
-
}).then(
|
|
20158
|
-
var
|
|
20086
|
+
}).then(_ref10 => {
|
|
20087
|
+
var _ref11, _ref12, _state$updatedPrice2;
|
|
20159
20088
|
let {
|
|
20160
20089
|
source,
|
|
20161
20090
|
error
|
|
20162
|
-
} =
|
|
20091
|
+
} = _ref10;
|
|
20163
20092
|
if (error) {
|
|
20164
20093
|
return handlePaymentError(error);
|
|
20165
20094
|
}
|
|
@@ -20178,7 +20107,7 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
20178
20107
|
return total + item.price * item.quantity;
|
|
20179
20108
|
}, 0);
|
|
20180
20109
|
};
|
|
20181
|
-
(
|
|
20110
|
+
(_ref11 = (_ref12 = (_state$updatedPrice2 = state === null || state === void 0 ? void 0 : state.updatedPrice) !== null && _state$updatedPrice2 !== void 0 ? _state$updatedPrice2 : plan === null || plan === void 0 ? void 0 : plan.amount) !== null && _ref12 !== void 0 ? _ref12 : invoice === null || invoice === void 0 ? void 0 : invoice.amount_remaining) !== null && _ref11 !== void 0 ? _ref11 : getOrderItemsTotal();
|
|
20182
20111
|
return handlePayment(source);
|
|
20183
20112
|
}).catch(error => {
|
|
20184
20113
|
return handlePaymentError(error);
|