@pelcro/react-pelcro-js 4.0.0-alpha.50 → 4.0.0-alpha.51
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 +157 -40
- package/dist/index.esm.js +157 -40
- package/package.json +1 -1
package/dist/index.cjs.js
CHANGED
|
@@ -24213,6 +24213,113 @@ const PaymentMethodContainerWithoutStripe = ({
|
|
|
24213
24213
|
}
|
|
24214
24214
|
};
|
|
24215
24215
|
|
|
24216
|
+
const confirmStripeIntentSetup = (response, flow, paymentMethodId) => {
|
|
24217
|
+
var _response$data2;
|
|
24218
|
+
|
|
24219
|
+
const setupIntent = (_response$data2 = response.data) === null || _response$data2 === void 0 ? void 0 : _response$data2.setup_intent;
|
|
24220
|
+
|
|
24221
|
+
if (setupIntent !== null && setupIntent !== void 0 && setupIntent.client_secret) {
|
|
24222
|
+
var _response$data3, _response$data3$sourc;
|
|
24223
|
+
|
|
24224
|
+
stripe.confirmCardSetup(setupIntent.client_secret, {
|
|
24225
|
+
payment_method: (_response$data3 = response.data) === null || _response$data3 === void 0 ? void 0 : (_response$data3$sourc = _response$data3.source) === null || _response$data3$sourc === void 0 ? void 0 : _response$data3$sourc.object_id
|
|
24226
|
+
}).then(res => {
|
|
24227
|
+
var _response$data4;
|
|
24228
|
+
|
|
24229
|
+
if (res.error) {
|
|
24230
|
+
dispatch({
|
|
24231
|
+
type: LOADING,
|
|
24232
|
+
payload: false
|
|
24233
|
+
});
|
|
24234
|
+
onFailure(res.error);
|
|
24235
|
+
return dispatch({
|
|
24236
|
+
type: SHOW_ALERT,
|
|
24237
|
+
payload: {
|
|
24238
|
+
type: "error",
|
|
24239
|
+
content: getErrorMessages(res.error)
|
|
24240
|
+
}
|
|
24241
|
+
});
|
|
24242
|
+
}
|
|
24243
|
+
|
|
24244
|
+
if (flow === "create") {
|
|
24245
|
+
dispatch({
|
|
24246
|
+
type: DISABLE_SUBMIT,
|
|
24247
|
+
payload: false
|
|
24248
|
+
});
|
|
24249
|
+
dispatch({
|
|
24250
|
+
type: LOADING,
|
|
24251
|
+
payload: false
|
|
24252
|
+
});
|
|
24253
|
+
dispatch({
|
|
24254
|
+
type: SHOW_ALERT,
|
|
24255
|
+
payload: {
|
|
24256
|
+
type: "success",
|
|
24257
|
+
content: t("messages.sourceCreated")
|
|
24258
|
+
}
|
|
24259
|
+
});
|
|
24260
|
+
onSuccess(res);
|
|
24261
|
+
return;
|
|
24262
|
+
}
|
|
24263
|
+
|
|
24264
|
+
if (flow === "update") {
|
|
24265
|
+
dispatch({
|
|
24266
|
+
type: DISABLE_SUBMIT,
|
|
24267
|
+
payload: false
|
|
24268
|
+
});
|
|
24269
|
+
dispatch({
|
|
24270
|
+
type: LOADING,
|
|
24271
|
+
payload: false
|
|
24272
|
+
});
|
|
24273
|
+
dispatch({
|
|
24274
|
+
type: SHOW_ALERT,
|
|
24275
|
+
payload: {
|
|
24276
|
+
type: "success",
|
|
24277
|
+
content: t("messages.sourceUpdated")
|
|
24278
|
+
}
|
|
24279
|
+
});
|
|
24280
|
+
onSuccess(res);
|
|
24281
|
+
return;
|
|
24282
|
+
}
|
|
24283
|
+
|
|
24284
|
+
if (flow === "replace") {
|
|
24285
|
+
setTimeout(() => {
|
|
24286
|
+
window.Pelcro.paymentMethods.deletePaymentMethod({
|
|
24287
|
+
auth_token: window.Pelcro.user.read().auth_token,
|
|
24288
|
+
payment_method_id: paymentMethodId
|
|
24289
|
+
}, (err, res) => {
|
|
24290
|
+
dispatch({
|
|
24291
|
+
type: DISABLE_SUBMIT,
|
|
24292
|
+
payload: false
|
|
24293
|
+
});
|
|
24294
|
+
dispatch({
|
|
24295
|
+
type: LOADING,
|
|
24296
|
+
payload: false
|
|
24297
|
+
});
|
|
24298
|
+
|
|
24299
|
+
if (err) {
|
|
24300
|
+
onFailure === null || onFailure === void 0 ? void 0 : onFailure(err);
|
|
24301
|
+
return dispatch({
|
|
24302
|
+
type: SHOW_ALERT,
|
|
24303
|
+
payload: {
|
|
24304
|
+
type: "error",
|
|
24305
|
+
content: getErrorMessages(err)
|
|
24306
|
+
}
|
|
24307
|
+
});
|
|
24308
|
+
}
|
|
24309
|
+
|
|
24310
|
+
onSuccess(res);
|
|
24311
|
+
});
|
|
24312
|
+
}, 2000);
|
|
24313
|
+
return;
|
|
24314
|
+
}
|
|
24315
|
+
|
|
24316
|
+
return handlePayment(response === null || response === void 0 ? void 0 : (_response$data4 = response.data) === null || _response$data4 === void 0 ? void 0 : _response$data4.source);
|
|
24317
|
+
});
|
|
24318
|
+
} else {
|
|
24319
|
+
onSuccess(response);
|
|
24320
|
+
}
|
|
24321
|
+
};
|
|
24322
|
+
|
|
24216
24323
|
const subscribe = (stripeSource, state, dispatch) => {
|
|
24217
24324
|
const {
|
|
24218
24325
|
couponCode
|
|
@@ -24496,25 +24603,24 @@ const PaymentMethodContainerWithoutStripe = ({
|
|
|
24496
24603
|
source,
|
|
24497
24604
|
error
|
|
24498
24605
|
}) => {
|
|
24499
|
-
var _source$card2;
|
|
24500
|
-
|
|
24501
24606
|
if (error) {
|
|
24502
24607
|
return handlePaymentError(error);
|
|
24503
24608
|
} // We don't support source creation for 3D secure yet
|
|
24609
|
+
// if (source?.card?.three_d_secure === "required") {
|
|
24610
|
+
// return handlePaymentError({
|
|
24611
|
+
// error: {
|
|
24612
|
+
// message: t("messages.cardAuthNotSupported")
|
|
24613
|
+
// }
|
|
24614
|
+
// });
|
|
24615
|
+
// }
|
|
24504
24616
|
|
|
24505
24617
|
|
|
24506
|
-
if ((source === null || source === void 0 ? void 0 : (_source$card2 = source.card) === null || _source$card2 === void 0 ? void 0 : _source$card2.three_d_secure) === "required") {
|
|
24507
|
-
return handlePaymentError({
|
|
24508
|
-
error: {
|
|
24509
|
-
message: t("messages.cardAuthNotSupported")
|
|
24510
|
-
}
|
|
24511
|
-
});
|
|
24512
|
-
}
|
|
24513
|
-
|
|
24514
24618
|
window.Pelcro.paymentMethods.create({
|
|
24515
24619
|
auth_token: window.Pelcro.user.read().auth_token,
|
|
24516
24620
|
token: source.id
|
|
24517
24621
|
}, (err, res) => {
|
|
24622
|
+
var _res$data, _res$data$setup_inten, _res$data2, _res$data2$setup_inte;
|
|
24623
|
+
|
|
24518
24624
|
dispatch({
|
|
24519
24625
|
type: DISABLE_SUBMIT,
|
|
24520
24626
|
payload: false
|
|
@@ -24535,14 +24641,18 @@ const PaymentMethodContainerWithoutStripe = ({
|
|
|
24535
24641
|
});
|
|
24536
24642
|
}
|
|
24537
24643
|
|
|
24538
|
-
|
|
24539
|
-
|
|
24540
|
-
|
|
24541
|
-
|
|
24542
|
-
|
|
24543
|
-
|
|
24544
|
-
|
|
24545
|
-
|
|
24644
|
+
if (((_res$data = res.data) === null || _res$data === void 0 ? void 0 : (_res$data$setup_inten = _res$data.setup_intent) === null || _res$data$setup_inten === void 0 ? void 0 : _res$data$setup_inten.status) === "requires_action" || ((_res$data2 = res.data) === null || _res$data2 === void 0 ? void 0 : (_res$data2$setup_inte = _res$data2.setup_intent) === null || _res$data2$setup_inte === void 0 ? void 0 : _res$data2$setup_inte.status) === "requires_confirmation") {
|
|
24645
|
+
confirmStripeIntentSetup(res, "create");
|
|
24646
|
+
} else {
|
|
24647
|
+
dispatch({
|
|
24648
|
+
type: SHOW_ALERT,
|
|
24649
|
+
payload: {
|
|
24650
|
+
type: "success",
|
|
24651
|
+
content: t("messages.sourceCreated")
|
|
24652
|
+
}
|
|
24653
|
+
});
|
|
24654
|
+
onSuccess(res);
|
|
24655
|
+
}
|
|
24546
24656
|
});
|
|
24547
24657
|
});
|
|
24548
24658
|
};
|
|
@@ -24564,6 +24674,8 @@ const PaymentMethodContainerWithoutStripe = ({
|
|
|
24564
24674
|
exp_year: year,
|
|
24565
24675
|
is_default: isDefault
|
|
24566
24676
|
}, (err, res) => {
|
|
24677
|
+
var _res$data3, _res$data3$setup_inte, _res$data4, _res$data4$setup_inte;
|
|
24678
|
+
|
|
24567
24679
|
dispatch({
|
|
24568
24680
|
type: DISABLE_SUBMIT,
|
|
24569
24681
|
payload: false
|
|
@@ -24584,14 +24696,18 @@ const PaymentMethodContainerWithoutStripe = ({
|
|
|
24584
24696
|
});
|
|
24585
24697
|
}
|
|
24586
24698
|
|
|
24587
|
-
|
|
24588
|
-
|
|
24589
|
-
|
|
24590
|
-
|
|
24591
|
-
|
|
24592
|
-
|
|
24593
|
-
|
|
24594
|
-
|
|
24699
|
+
if (((_res$data3 = res.data) === null || _res$data3 === void 0 ? void 0 : (_res$data3$setup_inte = _res$data3.setup_intent) === null || _res$data3$setup_inte === void 0 ? void 0 : _res$data3$setup_inte.status) === "requires_action" || ((_res$data4 = res.data) === null || _res$data4 === void 0 ? void 0 : (_res$data4$setup_inte = _res$data4.setup_intent) === null || _res$data4$setup_inte === void 0 ? void 0 : _res$data4$setup_inte.status) === "requires_confirmation") {
|
|
24700
|
+
confirmStripeIntentSetup(res, "update");
|
|
24701
|
+
} else {
|
|
24702
|
+
dispatch({
|
|
24703
|
+
type: SHOW_ALERT,
|
|
24704
|
+
payload: {
|
|
24705
|
+
type: "success",
|
|
24706
|
+
content: t("messages.sourceUpdated")
|
|
24707
|
+
}
|
|
24708
|
+
});
|
|
24709
|
+
onSuccess(res);
|
|
24710
|
+
}
|
|
24595
24711
|
});
|
|
24596
24712
|
};
|
|
24597
24713
|
|
|
@@ -24605,25 +24721,24 @@ const PaymentMethodContainerWithoutStripe = ({
|
|
|
24605
24721
|
source,
|
|
24606
24722
|
error
|
|
24607
24723
|
}) => {
|
|
24608
|
-
var _source$card3;
|
|
24609
|
-
|
|
24610
24724
|
if (error) {
|
|
24611
24725
|
return handlePaymentError(error);
|
|
24612
24726
|
} // We don't support source creation for 3D secure yet
|
|
24727
|
+
// if (source?.card?.three_d_secure === "required") {
|
|
24728
|
+
// return handlePaymentError({
|
|
24729
|
+
// error: {
|
|
24730
|
+
// message: t("messages.cardAuthNotSupported")
|
|
24731
|
+
// }
|
|
24732
|
+
// });
|
|
24733
|
+
// }
|
|
24613
24734
|
|
|
24614
24735
|
|
|
24615
|
-
if ((source === null || source === void 0 ? void 0 : (_source$card3 = source.card) === null || _source$card3 === void 0 ? void 0 : _source$card3.three_d_secure) === "required") {
|
|
24616
|
-
return handlePaymentError({
|
|
24617
|
-
error: {
|
|
24618
|
-
message: t("messages.cardAuthNotSupported")
|
|
24619
|
-
}
|
|
24620
|
-
});
|
|
24621
|
-
}
|
|
24622
|
-
|
|
24623
24736
|
window.Pelcro.paymentMethods.create({
|
|
24624
24737
|
auth_token: window.Pelcro.user.read().auth_token,
|
|
24625
24738
|
token: source.id
|
|
24626
24739
|
}, (err, res) => {
|
|
24740
|
+
var _res$data5, _res$data5$setup_inte, _res$data6, _res$data6$setup_inte;
|
|
24741
|
+
|
|
24627
24742
|
if (err) {
|
|
24628
24743
|
onFailure(err);
|
|
24629
24744
|
return dispatch({
|
|
@@ -24635,7 +24750,9 @@ const PaymentMethodContainerWithoutStripe = ({
|
|
|
24635
24750
|
});
|
|
24636
24751
|
}
|
|
24637
24752
|
|
|
24638
|
-
if (res) {
|
|
24753
|
+
if (((_res$data5 = res.data) === null || _res$data5 === void 0 ? void 0 : (_res$data5$setup_inte = _res$data5.setup_intent) === null || _res$data5$setup_inte === void 0 ? void 0 : _res$data5$setup_inte.status) === "requires_action" || ((_res$data6 = res.data) === null || _res$data6 === void 0 ? void 0 : (_res$data6$setup_inte = _res$data6.setup_intent) === null || _res$data6$setup_inte === void 0 ? void 0 : _res$data6$setup_inte.status) === "requires_confirmation") {
|
|
24754
|
+
confirmStripeIntentSetup(res, "replace", paymentMethodId);
|
|
24755
|
+
} else {
|
|
24639
24756
|
setTimeout(() => {
|
|
24640
24757
|
window.Pelcro.paymentMethods.deletePaymentMethod({
|
|
24641
24758
|
auth_token: window.Pelcro.user.read().auth_token,
|
|
@@ -24771,14 +24888,14 @@ const PaymentMethodContainerWithoutStripe = ({
|
|
|
24771
24888
|
coupon_code: state === null || state === void 0 ? void 0 : state.couponCode,
|
|
24772
24889
|
address_id: selectedAddressId
|
|
24773
24890
|
}, (error, res) => {
|
|
24774
|
-
var _res$
|
|
24891
|
+
var _res$data7, _res$data8;
|
|
24775
24892
|
|
|
24776
24893
|
if (error) {
|
|
24777
24894
|
return reject(error);
|
|
24778
24895
|
}
|
|
24779
24896
|
|
|
24780
|
-
const taxAmount = (_res$
|
|
24781
|
-
const totalAmountWithTax = (_res$
|
|
24897
|
+
const taxAmount = (_res$data7 = res.data) === null || _res$data7 === void 0 ? void 0 : _res$data7.taxes;
|
|
24898
|
+
const totalAmountWithTax = (_res$data8 = res.data) === null || _res$data8 === void 0 ? void 0 : _res$data8.total;
|
|
24782
24899
|
resolve({
|
|
24783
24900
|
totalAmountWithTax,
|
|
24784
24901
|
taxAmount
|
package/dist/index.esm.js
CHANGED
|
@@ -24183,6 +24183,113 @@ const PaymentMethodContainerWithoutStripe = ({
|
|
|
24183
24183
|
}
|
|
24184
24184
|
};
|
|
24185
24185
|
|
|
24186
|
+
const confirmStripeIntentSetup = (response, flow, paymentMethodId) => {
|
|
24187
|
+
var _response$data2;
|
|
24188
|
+
|
|
24189
|
+
const setupIntent = (_response$data2 = response.data) === null || _response$data2 === void 0 ? void 0 : _response$data2.setup_intent;
|
|
24190
|
+
|
|
24191
|
+
if (setupIntent !== null && setupIntent !== void 0 && setupIntent.client_secret) {
|
|
24192
|
+
var _response$data3, _response$data3$sourc;
|
|
24193
|
+
|
|
24194
|
+
stripe.confirmCardSetup(setupIntent.client_secret, {
|
|
24195
|
+
payment_method: (_response$data3 = response.data) === null || _response$data3 === void 0 ? void 0 : (_response$data3$sourc = _response$data3.source) === null || _response$data3$sourc === void 0 ? void 0 : _response$data3$sourc.object_id
|
|
24196
|
+
}).then(res => {
|
|
24197
|
+
var _response$data4;
|
|
24198
|
+
|
|
24199
|
+
if (res.error) {
|
|
24200
|
+
dispatch({
|
|
24201
|
+
type: LOADING,
|
|
24202
|
+
payload: false
|
|
24203
|
+
});
|
|
24204
|
+
onFailure(res.error);
|
|
24205
|
+
return dispatch({
|
|
24206
|
+
type: SHOW_ALERT,
|
|
24207
|
+
payload: {
|
|
24208
|
+
type: "error",
|
|
24209
|
+
content: getErrorMessages(res.error)
|
|
24210
|
+
}
|
|
24211
|
+
});
|
|
24212
|
+
}
|
|
24213
|
+
|
|
24214
|
+
if (flow === "create") {
|
|
24215
|
+
dispatch({
|
|
24216
|
+
type: DISABLE_SUBMIT,
|
|
24217
|
+
payload: false
|
|
24218
|
+
});
|
|
24219
|
+
dispatch({
|
|
24220
|
+
type: LOADING,
|
|
24221
|
+
payload: false
|
|
24222
|
+
});
|
|
24223
|
+
dispatch({
|
|
24224
|
+
type: SHOW_ALERT,
|
|
24225
|
+
payload: {
|
|
24226
|
+
type: "success",
|
|
24227
|
+
content: t("messages.sourceCreated")
|
|
24228
|
+
}
|
|
24229
|
+
});
|
|
24230
|
+
onSuccess(res);
|
|
24231
|
+
return;
|
|
24232
|
+
}
|
|
24233
|
+
|
|
24234
|
+
if (flow === "update") {
|
|
24235
|
+
dispatch({
|
|
24236
|
+
type: DISABLE_SUBMIT,
|
|
24237
|
+
payload: false
|
|
24238
|
+
});
|
|
24239
|
+
dispatch({
|
|
24240
|
+
type: LOADING,
|
|
24241
|
+
payload: false
|
|
24242
|
+
});
|
|
24243
|
+
dispatch({
|
|
24244
|
+
type: SHOW_ALERT,
|
|
24245
|
+
payload: {
|
|
24246
|
+
type: "success",
|
|
24247
|
+
content: t("messages.sourceUpdated")
|
|
24248
|
+
}
|
|
24249
|
+
});
|
|
24250
|
+
onSuccess(res);
|
|
24251
|
+
return;
|
|
24252
|
+
}
|
|
24253
|
+
|
|
24254
|
+
if (flow === "replace") {
|
|
24255
|
+
setTimeout(() => {
|
|
24256
|
+
window.Pelcro.paymentMethods.deletePaymentMethod({
|
|
24257
|
+
auth_token: window.Pelcro.user.read().auth_token,
|
|
24258
|
+
payment_method_id: paymentMethodId
|
|
24259
|
+
}, (err, res) => {
|
|
24260
|
+
dispatch({
|
|
24261
|
+
type: DISABLE_SUBMIT,
|
|
24262
|
+
payload: false
|
|
24263
|
+
});
|
|
24264
|
+
dispatch({
|
|
24265
|
+
type: LOADING,
|
|
24266
|
+
payload: false
|
|
24267
|
+
});
|
|
24268
|
+
|
|
24269
|
+
if (err) {
|
|
24270
|
+
onFailure === null || onFailure === void 0 ? void 0 : onFailure(err);
|
|
24271
|
+
return dispatch({
|
|
24272
|
+
type: SHOW_ALERT,
|
|
24273
|
+
payload: {
|
|
24274
|
+
type: "error",
|
|
24275
|
+
content: getErrorMessages(err)
|
|
24276
|
+
}
|
|
24277
|
+
});
|
|
24278
|
+
}
|
|
24279
|
+
|
|
24280
|
+
onSuccess(res);
|
|
24281
|
+
});
|
|
24282
|
+
}, 2000);
|
|
24283
|
+
return;
|
|
24284
|
+
}
|
|
24285
|
+
|
|
24286
|
+
return handlePayment(response === null || response === void 0 ? void 0 : (_response$data4 = response.data) === null || _response$data4 === void 0 ? void 0 : _response$data4.source);
|
|
24287
|
+
});
|
|
24288
|
+
} else {
|
|
24289
|
+
onSuccess(response);
|
|
24290
|
+
}
|
|
24291
|
+
};
|
|
24292
|
+
|
|
24186
24293
|
const subscribe = (stripeSource, state, dispatch) => {
|
|
24187
24294
|
const {
|
|
24188
24295
|
couponCode
|
|
@@ -24466,25 +24573,24 @@ const PaymentMethodContainerWithoutStripe = ({
|
|
|
24466
24573
|
source,
|
|
24467
24574
|
error
|
|
24468
24575
|
}) => {
|
|
24469
|
-
var _source$card2;
|
|
24470
|
-
|
|
24471
24576
|
if (error) {
|
|
24472
24577
|
return handlePaymentError(error);
|
|
24473
24578
|
} // We don't support source creation for 3D secure yet
|
|
24579
|
+
// if (source?.card?.three_d_secure === "required") {
|
|
24580
|
+
// return handlePaymentError({
|
|
24581
|
+
// error: {
|
|
24582
|
+
// message: t("messages.cardAuthNotSupported")
|
|
24583
|
+
// }
|
|
24584
|
+
// });
|
|
24585
|
+
// }
|
|
24474
24586
|
|
|
24475
24587
|
|
|
24476
|
-
if ((source === null || source === void 0 ? void 0 : (_source$card2 = source.card) === null || _source$card2 === void 0 ? void 0 : _source$card2.three_d_secure) === "required") {
|
|
24477
|
-
return handlePaymentError({
|
|
24478
|
-
error: {
|
|
24479
|
-
message: t("messages.cardAuthNotSupported")
|
|
24480
|
-
}
|
|
24481
|
-
});
|
|
24482
|
-
}
|
|
24483
|
-
|
|
24484
24588
|
window.Pelcro.paymentMethods.create({
|
|
24485
24589
|
auth_token: window.Pelcro.user.read().auth_token,
|
|
24486
24590
|
token: source.id
|
|
24487
24591
|
}, (err, res) => {
|
|
24592
|
+
var _res$data, _res$data$setup_inten, _res$data2, _res$data2$setup_inte;
|
|
24593
|
+
|
|
24488
24594
|
dispatch({
|
|
24489
24595
|
type: DISABLE_SUBMIT,
|
|
24490
24596
|
payload: false
|
|
@@ -24505,14 +24611,18 @@ const PaymentMethodContainerWithoutStripe = ({
|
|
|
24505
24611
|
});
|
|
24506
24612
|
}
|
|
24507
24613
|
|
|
24508
|
-
|
|
24509
|
-
|
|
24510
|
-
|
|
24511
|
-
|
|
24512
|
-
|
|
24513
|
-
|
|
24514
|
-
|
|
24515
|
-
|
|
24614
|
+
if (((_res$data = res.data) === null || _res$data === void 0 ? void 0 : (_res$data$setup_inten = _res$data.setup_intent) === null || _res$data$setup_inten === void 0 ? void 0 : _res$data$setup_inten.status) === "requires_action" || ((_res$data2 = res.data) === null || _res$data2 === void 0 ? void 0 : (_res$data2$setup_inte = _res$data2.setup_intent) === null || _res$data2$setup_inte === void 0 ? void 0 : _res$data2$setup_inte.status) === "requires_confirmation") {
|
|
24615
|
+
confirmStripeIntentSetup(res, "create");
|
|
24616
|
+
} else {
|
|
24617
|
+
dispatch({
|
|
24618
|
+
type: SHOW_ALERT,
|
|
24619
|
+
payload: {
|
|
24620
|
+
type: "success",
|
|
24621
|
+
content: t("messages.sourceCreated")
|
|
24622
|
+
}
|
|
24623
|
+
});
|
|
24624
|
+
onSuccess(res);
|
|
24625
|
+
}
|
|
24516
24626
|
});
|
|
24517
24627
|
});
|
|
24518
24628
|
};
|
|
@@ -24534,6 +24644,8 @@ const PaymentMethodContainerWithoutStripe = ({
|
|
|
24534
24644
|
exp_year: year,
|
|
24535
24645
|
is_default: isDefault
|
|
24536
24646
|
}, (err, res) => {
|
|
24647
|
+
var _res$data3, _res$data3$setup_inte, _res$data4, _res$data4$setup_inte;
|
|
24648
|
+
|
|
24537
24649
|
dispatch({
|
|
24538
24650
|
type: DISABLE_SUBMIT,
|
|
24539
24651
|
payload: false
|
|
@@ -24554,14 +24666,18 @@ const PaymentMethodContainerWithoutStripe = ({
|
|
|
24554
24666
|
});
|
|
24555
24667
|
}
|
|
24556
24668
|
|
|
24557
|
-
|
|
24558
|
-
|
|
24559
|
-
|
|
24560
|
-
|
|
24561
|
-
|
|
24562
|
-
|
|
24563
|
-
|
|
24564
|
-
|
|
24669
|
+
if (((_res$data3 = res.data) === null || _res$data3 === void 0 ? void 0 : (_res$data3$setup_inte = _res$data3.setup_intent) === null || _res$data3$setup_inte === void 0 ? void 0 : _res$data3$setup_inte.status) === "requires_action" || ((_res$data4 = res.data) === null || _res$data4 === void 0 ? void 0 : (_res$data4$setup_inte = _res$data4.setup_intent) === null || _res$data4$setup_inte === void 0 ? void 0 : _res$data4$setup_inte.status) === "requires_confirmation") {
|
|
24670
|
+
confirmStripeIntentSetup(res, "update");
|
|
24671
|
+
} else {
|
|
24672
|
+
dispatch({
|
|
24673
|
+
type: SHOW_ALERT,
|
|
24674
|
+
payload: {
|
|
24675
|
+
type: "success",
|
|
24676
|
+
content: t("messages.sourceUpdated")
|
|
24677
|
+
}
|
|
24678
|
+
});
|
|
24679
|
+
onSuccess(res);
|
|
24680
|
+
}
|
|
24565
24681
|
});
|
|
24566
24682
|
};
|
|
24567
24683
|
|
|
@@ -24575,25 +24691,24 @@ const PaymentMethodContainerWithoutStripe = ({
|
|
|
24575
24691
|
source,
|
|
24576
24692
|
error
|
|
24577
24693
|
}) => {
|
|
24578
|
-
var _source$card3;
|
|
24579
|
-
|
|
24580
24694
|
if (error) {
|
|
24581
24695
|
return handlePaymentError(error);
|
|
24582
24696
|
} // We don't support source creation for 3D secure yet
|
|
24697
|
+
// if (source?.card?.three_d_secure === "required") {
|
|
24698
|
+
// return handlePaymentError({
|
|
24699
|
+
// error: {
|
|
24700
|
+
// message: t("messages.cardAuthNotSupported")
|
|
24701
|
+
// }
|
|
24702
|
+
// });
|
|
24703
|
+
// }
|
|
24583
24704
|
|
|
24584
24705
|
|
|
24585
|
-
if ((source === null || source === void 0 ? void 0 : (_source$card3 = source.card) === null || _source$card3 === void 0 ? void 0 : _source$card3.three_d_secure) === "required") {
|
|
24586
|
-
return handlePaymentError({
|
|
24587
|
-
error: {
|
|
24588
|
-
message: t("messages.cardAuthNotSupported")
|
|
24589
|
-
}
|
|
24590
|
-
});
|
|
24591
|
-
}
|
|
24592
|
-
|
|
24593
24706
|
window.Pelcro.paymentMethods.create({
|
|
24594
24707
|
auth_token: window.Pelcro.user.read().auth_token,
|
|
24595
24708
|
token: source.id
|
|
24596
24709
|
}, (err, res) => {
|
|
24710
|
+
var _res$data5, _res$data5$setup_inte, _res$data6, _res$data6$setup_inte;
|
|
24711
|
+
|
|
24597
24712
|
if (err) {
|
|
24598
24713
|
onFailure(err);
|
|
24599
24714
|
return dispatch({
|
|
@@ -24605,7 +24720,9 @@ const PaymentMethodContainerWithoutStripe = ({
|
|
|
24605
24720
|
});
|
|
24606
24721
|
}
|
|
24607
24722
|
|
|
24608
|
-
if (res) {
|
|
24723
|
+
if (((_res$data5 = res.data) === null || _res$data5 === void 0 ? void 0 : (_res$data5$setup_inte = _res$data5.setup_intent) === null || _res$data5$setup_inte === void 0 ? void 0 : _res$data5$setup_inte.status) === "requires_action" || ((_res$data6 = res.data) === null || _res$data6 === void 0 ? void 0 : (_res$data6$setup_inte = _res$data6.setup_intent) === null || _res$data6$setup_inte === void 0 ? void 0 : _res$data6$setup_inte.status) === "requires_confirmation") {
|
|
24724
|
+
confirmStripeIntentSetup(res, "replace", paymentMethodId);
|
|
24725
|
+
} else {
|
|
24609
24726
|
setTimeout(() => {
|
|
24610
24727
|
window.Pelcro.paymentMethods.deletePaymentMethod({
|
|
24611
24728
|
auth_token: window.Pelcro.user.read().auth_token,
|
|
@@ -24741,14 +24858,14 @@ const PaymentMethodContainerWithoutStripe = ({
|
|
|
24741
24858
|
coupon_code: state === null || state === void 0 ? void 0 : state.couponCode,
|
|
24742
24859
|
address_id: selectedAddressId
|
|
24743
24860
|
}, (error, res) => {
|
|
24744
|
-
var _res$
|
|
24861
|
+
var _res$data7, _res$data8;
|
|
24745
24862
|
|
|
24746
24863
|
if (error) {
|
|
24747
24864
|
return reject(error);
|
|
24748
24865
|
}
|
|
24749
24866
|
|
|
24750
|
-
const taxAmount = (_res$
|
|
24751
|
-
const totalAmountWithTax = (_res$
|
|
24867
|
+
const taxAmount = (_res$data7 = res.data) === null || _res$data7 === void 0 ? void 0 : _res$data7.taxes;
|
|
24868
|
+
const totalAmountWithTax = (_res$data8 = res.data) === null || _res$data8 === void 0 ? void 0 : _res$data8.total;
|
|
24752
24869
|
resolve({
|
|
24753
24870
|
totalAmountWithTax,
|
|
24754
24871
|
taxAmount
|