@pelcro/react-pelcro-js 3.26.0-beta.43 → 3.26.0-beta.44
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 +145 -36
- package/dist/index.esm.js +145 -36
- package/package.json +1 -1
package/dist/index.cjs.js
CHANGED
|
@@ -19615,6 +19615,102 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
19615
19615
|
onSuccess(response);
|
|
19616
19616
|
}
|
|
19617
19617
|
};
|
|
19618
|
+
const confirmStripeIntentSetup = (response, flow, paymentMethodId) => {
|
|
19619
|
+
var _response$data2;
|
|
19620
|
+
const setupIntent = (_response$data2 = response.data) === null || _response$data2 === void 0 ? void 0 : _response$data2.setup_intent;
|
|
19621
|
+
if (setupIntent !== null && setupIntent !== void 0 && setupIntent.client_secret) {
|
|
19622
|
+
var _response$data3, _response$data3$sourc;
|
|
19623
|
+
stripe.confirmCardSetup(setupIntent.client_secret, {
|
|
19624
|
+
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
|
|
19625
|
+
}).then(res => {
|
|
19626
|
+
var _response$data4;
|
|
19627
|
+
if (res.error) {
|
|
19628
|
+
dispatch({
|
|
19629
|
+
type: LOADING,
|
|
19630
|
+
payload: false
|
|
19631
|
+
});
|
|
19632
|
+
onFailure(res.error);
|
|
19633
|
+
return dispatch({
|
|
19634
|
+
type: SHOW_ALERT,
|
|
19635
|
+
payload: {
|
|
19636
|
+
type: "error",
|
|
19637
|
+
content: getErrorMessages(res.error)
|
|
19638
|
+
}
|
|
19639
|
+
});
|
|
19640
|
+
}
|
|
19641
|
+
if (flow === "create") {
|
|
19642
|
+
dispatch({
|
|
19643
|
+
type: DISABLE_SUBMIT,
|
|
19644
|
+
payload: false
|
|
19645
|
+
});
|
|
19646
|
+
dispatch({
|
|
19647
|
+
type: LOADING,
|
|
19648
|
+
payload: false
|
|
19649
|
+
});
|
|
19650
|
+
dispatch({
|
|
19651
|
+
type: SHOW_ALERT,
|
|
19652
|
+
payload: {
|
|
19653
|
+
type: "success",
|
|
19654
|
+
content: t("messages.sourceCreated")
|
|
19655
|
+
}
|
|
19656
|
+
});
|
|
19657
|
+
onSuccess(res);
|
|
19658
|
+
return;
|
|
19659
|
+
}
|
|
19660
|
+
if (flow === "update") {
|
|
19661
|
+
dispatch({
|
|
19662
|
+
type: DISABLE_SUBMIT,
|
|
19663
|
+
payload: false
|
|
19664
|
+
});
|
|
19665
|
+
dispatch({
|
|
19666
|
+
type: LOADING,
|
|
19667
|
+
payload: false
|
|
19668
|
+
});
|
|
19669
|
+
dispatch({
|
|
19670
|
+
type: SHOW_ALERT,
|
|
19671
|
+
payload: {
|
|
19672
|
+
type: "success",
|
|
19673
|
+
content: t("messages.sourceUpdated")
|
|
19674
|
+
}
|
|
19675
|
+
});
|
|
19676
|
+
onSuccess(res);
|
|
19677
|
+
return;
|
|
19678
|
+
}
|
|
19679
|
+
if (flow === "replace") {
|
|
19680
|
+
setTimeout(() => {
|
|
19681
|
+
window.Pelcro.paymentMethods.deletePaymentMethod({
|
|
19682
|
+
auth_token: window.Pelcro.user.read().auth_token,
|
|
19683
|
+
payment_method_id: paymentMethodId
|
|
19684
|
+
}, (err, res) => {
|
|
19685
|
+
dispatch({
|
|
19686
|
+
type: DISABLE_SUBMIT,
|
|
19687
|
+
payload: false
|
|
19688
|
+
});
|
|
19689
|
+
dispatch({
|
|
19690
|
+
type: LOADING,
|
|
19691
|
+
payload: false
|
|
19692
|
+
});
|
|
19693
|
+
if (err) {
|
|
19694
|
+
onFailure === null || onFailure === void 0 ? void 0 : onFailure(err);
|
|
19695
|
+
return dispatch({
|
|
19696
|
+
type: SHOW_ALERT,
|
|
19697
|
+
payload: {
|
|
19698
|
+
type: "error",
|
|
19699
|
+
content: getErrorMessages(err)
|
|
19700
|
+
}
|
|
19701
|
+
});
|
|
19702
|
+
}
|
|
19703
|
+
onSuccess(res);
|
|
19704
|
+
});
|
|
19705
|
+
}, 2000);
|
|
19706
|
+
return;
|
|
19707
|
+
}
|
|
19708
|
+
return handlePayment(response === null || response === void 0 ? void 0 : (_response$data4 = response.data) === null || _response$data4 === void 0 ? void 0 : _response$data4.source);
|
|
19709
|
+
});
|
|
19710
|
+
} else {
|
|
19711
|
+
onSuccess(response);
|
|
19712
|
+
}
|
|
19713
|
+
};
|
|
19618
19714
|
const subscribe = (stripeSource, state, dispatch) => {
|
|
19619
19715
|
const {
|
|
19620
19716
|
couponCode
|
|
@@ -19900,7 +19996,6 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
19900
19996
|
return stripe.createSource({
|
|
19901
19997
|
type: "card"
|
|
19902
19998
|
}).then(_ref8 => {
|
|
19903
|
-
var _source$card2;
|
|
19904
19999
|
let {
|
|
19905
20000
|
source,
|
|
19906
20001
|
error
|
|
@@ -19910,17 +20005,19 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
19910
20005
|
}
|
|
19911
20006
|
|
|
19912
20007
|
// We don't support source creation for 3D secure yet
|
|
19913
|
-
if (
|
|
19914
|
-
|
|
19915
|
-
|
|
19916
|
-
|
|
19917
|
-
|
|
19918
|
-
|
|
19919
|
-
}
|
|
20008
|
+
// if (source?.card?.three_d_secure === "required") {
|
|
20009
|
+
// return handlePaymentError({
|
|
20010
|
+
// error: {
|
|
20011
|
+
// message: t("messages.cardAuthNotSupported")
|
|
20012
|
+
// }
|
|
20013
|
+
// });
|
|
20014
|
+
// }
|
|
20015
|
+
|
|
19920
20016
|
window.Pelcro.paymentMethods.create({
|
|
19921
20017
|
auth_token: window.Pelcro.user.read().auth_token,
|
|
19922
20018
|
token: source.id
|
|
19923
20019
|
}, (err, res) => {
|
|
20020
|
+
var _res$data, _res$data$setup_inten, _res$data2, _res$data2$setup_inte;
|
|
19924
20021
|
dispatch({
|
|
19925
20022
|
type: DISABLE_SUBMIT,
|
|
19926
20023
|
payload: false
|
|
@@ -19939,14 +20036,18 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
19939
20036
|
}
|
|
19940
20037
|
});
|
|
19941
20038
|
}
|
|
19942
|
-
|
|
19943
|
-
|
|
19944
|
-
|
|
19945
|
-
|
|
19946
|
-
|
|
19947
|
-
|
|
19948
|
-
|
|
19949
|
-
|
|
20039
|
+
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") {
|
|
20040
|
+
confirmStripeIntentSetup(res, "create");
|
|
20041
|
+
} else {
|
|
20042
|
+
dispatch({
|
|
20043
|
+
type: SHOW_ALERT,
|
|
20044
|
+
payload: {
|
|
20045
|
+
type: "success",
|
|
20046
|
+
content: t("messages.sourceCreated")
|
|
20047
|
+
}
|
|
20048
|
+
});
|
|
20049
|
+
onSuccess(res);
|
|
20050
|
+
}
|
|
19950
20051
|
});
|
|
19951
20052
|
});
|
|
19952
20053
|
};
|
|
@@ -19967,6 +20068,7 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
19967
20068
|
exp_year: year,
|
|
19968
20069
|
is_default: isDefault
|
|
19969
20070
|
}, (err, res) => {
|
|
20071
|
+
var _res$data3, _res$data3$setup_inte, _res$data4, _res$data4$setup_inte;
|
|
19970
20072
|
dispatch({
|
|
19971
20073
|
type: DISABLE_SUBMIT,
|
|
19972
20074
|
payload: false
|
|
@@ -19985,14 +20087,18 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
19985
20087
|
}
|
|
19986
20088
|
});
|
|
19987
20089
|
}
|
|
19988
|
-
|
|
19989
|
-
|
|
19990
|
-
|
|
19991
|
-
|
|
19992
|
-
|
|
19993
|
-
|
|
19994
|
-
|
|
19995
|
-
|
|
20090
|
+
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") {
|
|
20091
|
+
confirmStripeIntentSetup(res, "update");
|
|
20092
|
+
} else {
|
|
20093
|
+
dispatch({
|
|
20094
|
+
type: SHOW_ALERT,
|
|
20095
|
+
payload: {
|
|
20096
|
+
type: "success",
|
|
20097
|
+
content: t("messages.sourceUpdated")
|
|
20098
|
+
}
|
|
20099
|
+
});
|
|
20100
|
+
onSuccess(res);
|
|
20101
|
+
}
|
|
19996
20102
|
});
|
|
19997
20103
|
};
|
|
19998
20104
|
const replacePaymentSource = (state, dispatch) => {
|
|
@@ -20002,7 +20108,6 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
20002
20108
|
return stripe.createSource({
|
|
20003
20109
|
type: "card"
|
|
20004
20110
|
}).then(_ref9 => {
|
|
20005
|
-
var _source$card3;
|
|
20006
20111
|
let {
|
|
20007
20112
|
source,
|
|
20008
20113
|
error
|
|
@@ -20012,17 +20117,19 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
20012
20117
|
}
|
|
20013
20118
|
|
|
20014
20119
|
// We don't support source creation for 3D secure yet
|
|
20015
|
-
if (
|
|
20016
|
-
|
|
20017
|
-
|
|
20018
|
-
|
|
20019
|
-
|
|
20020
|
-
|
|
20021
|
-
}
|
|
20120
|
+
// if (source?.card?.three_d_secure === "required") {
|
|
20121
|
+
// return handlePaymentError({
|
|
20122
|
+
// error: {
|
|
20123
|
+
// message: t("messages.cardAuthNotSupported")
|
|
20124
|
+
// }
|
|
20125
|
+
// });
|
|
20126
|
+
// }
|
|
20127
|
+
|
|
20022
20128
|
window.Pelcro.paymentMethods.create({
|
|
20023
20129
|
auth_token: window.Pelcro.user.read().auth_token,
|
|
20024
20130
|
token: source.id
|
|
20025
20131
|
}, (err, res) => {
|
|
20132
|
+
var _res$data5, _res$data5$setup_inte, _res$data6, _res$data6$setup_inte;
|
|
20026
20133
|
if (err) {
|
|
20027
20134
|
onFailure(err);
|
|
20028
20135
|
return dispatch({
|
|
@@ -20033,7 +20140,9 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
20033
20140
|
}
|
|
20034
20141
|
});
|
|
20035
20142
|
}
|
|
20036
|
-
if (res) {
|
|
20143
|
+
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") {
|
|
20144
|
+
confirmStripeIntentSetup(res, "replace", paymentMethodId);
|
|
20145
|
+
} else {
|
|
20037
20146
|
setTimeout(() => {
|
|
20038
20147
|
window.Pelcro.paymentMethods.deletePaymentMethod({
|
|
20039
20148
|
auth_token: window.Pelcro.user.read().auth_token,
|
|
@@ -20196,12 +20305,12 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
20196
20305
|
coupon_code: state === null || state === void 0 ? void 0 : state.couponCode,
|
|
20197
20306
|
address_id: selectedAddressId
|
|
20198
20307
|
}, (error, res) => {
|
|
20199
|
-
var _res$
|
|
20308
|
+
var _res$data7, _res$data8;
|
|
20200
20309
|
if (error) {
|
|
20201
20310
|
return reject(error);
|
|
20202
20311
|
}
|
|
20203
|
-
const taxAmount = (_res$
|
|
20204
|
-
const totalAmountWithTax = (_res$
|
|
20312
|
+
const taxAmount = (_res$data7 = res.data) === null || _res$data7 === void 0 ? void 0 : _res$data7.taxes;
|
|
20313
|
+
const totalAmountWithTax = (_res$data8 = res.data) === null || _res$data8 === void 0 ? void 0 : _res$data8.total;
|
|
20205
20314
|
resolve({
|
|
20206
20315
|
totalAmountWithTax,
|
|
20207
20316
|
taxAmount
|
package/dist/index.esm.js
CHANGED
|
@@ -19585,6 +19585,102 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
19585
19585
|
onSuccess(response);
|
|
19586
19586
|
}
|
|
19587
19587
|
};
|
|
19588
|
+
const confirmStripeIntentSetup = (response, flow, paymentMethodId) => {
|
|
19589
|
+
var _response$data2;
|
|
19590
|
+
const setupIntent = (_response$data2 = response.data) === null || _response$data2 === void 0 ? void 0 : _response$data2.setup_intent;
|
|
19591
|
+
if (setupIntent !== null && setupIntent !== void 0 && setupIntent.client_secret) {
|
|
19592
|
+
var _response$data3, _response$data3$sourc;
|
|
19593
|
+
stripe.confirmCardSetup(setupIntent.client_secret, {
|
|
19594
|
+
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
|
|
19595
|
+
}).then(res => {
|
|
19596
|
+
var _response$data4;
|
|
19597
|
+
if (res.error) {
|
|
19598
|
+
dispatch({
|
|
19599
|
+
type: LOADING,
|
|
19600
|
+
payload: false
|
|
19601
|
+
});
|
|
19602
|
+
onFailure(res.error);
|
|
19603
|
+
return dispatch({
|
|
19604
|
+
type: SHOW_ALERT,
|
|
19605
|
+
payload: {
|
|
19606
|
+
type: "error",
|
|
19607
|
+
content: getErrorMessages(res.error)
|
|
19608
|
+
}
|
|
19609
|
+
});
|
|
19610
|
+
}
|
|
19611
|
+
if (flow === "create") {
|
|
19612
|
+
dispatch({
|
|
19613
|
+
type: DISABLE_SUBMIT,
|
|
19614
|
+
payload: false
|
|
19615
|
+
});
|
|
19616
|
+
dispatch({
|
|
19617
|
+
type: LOADING,
|
|
19618
|
+
payload: false
|
|
19619
|
+
});
|
|
19620
|
+
dispatch({
|
|
19621
|
+
type: SHOW_ALERT,
|
|
19622
|
+
payload: {
|
|
19623
|
+
type: "success",
|
|
19624
|
+
content: t("messages.sourceCreated")
|
|
19625
|
+
}
|
|
19626
|
+
});
|
|
19627
|
+
onSuccess(res);
|
|
19628
|
+
return;
|
|
19629
|
+
}
|
|
19630
|
+
if (flow === "update") {
|
|
19631
|
+
dispatch({
|
|
19632
|
+
type: DISABLE_SUBMIT,
|
|
19633
|
+
payload: false
|
|
19634
|
+
});
|
|
19635
|
+
dispatch({
|
|
19636
|
+
type: LOADING,
|
|
19637
|
+
payload: false
|
|
19638
|
+
});
|
|
19639
|
+
dispatch({
|
|
19640
|
+
type: SHOW_ALERT,
|
|
19641
|
+
payload: {
|
|
19642
|
+
type: "success",
|
|
19643
|
+
content: t("messages.sourceUpdated")
|
|
19644
|
+
}
|
|
19645
|
+
});
|
|
19646
|
+
onSuccess(res);
|
|
19647
|
+
return;
|
|
19648
|
+
}
|
|
19649
|
+
if (flow === "replace") {
|
|
19650
|
+
setTimeout(() => {
|
|
19651
|
+
window.Pelcro.paymentMethods.deletePaymentMethod({
|
|
19652
|
+
auth_token: window.Pelcro.user.read().auth_token,
|
|
19653
|
+
payment_method_id: paymentMethodId
|
|
19654
|
+
}, (err, res) => {
|
|
19655
|
+
dispatch({
|
|
19656
|
+
type: DISABLE_SUBMIT,
|
|
19657
|
+
payload: false
|
|
19658
|
+
});
|
|
19659
|
+
dispatch({
|
|
19660
|
+
type: LOADING,
|
|
19661
|
+
payload: false
|
|
19662
|
+
});
|
|
19663
|
+
if (err) {
|
|
19664
|
+
onFailure === null || onFailure === void 0 ? void 0 : onFailure(err);
|
|
19665
|
+
return dispatch({
|
|
19666
|
+
type: SHOW_ALERT,
|
|
19667
|
+
payload: {
|
|
19668
|
+
type: "error",
|
|
19669
|
+
content: getErrorMessages(err)
|
|
19670
|
+
}
|
|
19671
|
+
});
|
|
19672
|
+
}
|
|
19673
|
+
onSuccess(res);
|
|
19674
|
+
});
|
|
19675
|
+
}, 2000);
|
|
19676
|
+
return;
|
|
19677
|
+
}
|
|
19678
|
+
return handlePayment(response === null || response === void 0 ? void 0 : (_response$data4 = response.data) === null || _response$data4 === void 0 ? void 0 : _response$data4.source);
|
|
19679
|
+
});
|
|
19680
|
+
} else {
|
|
19681
|
+
onSuccess(response);
|
|
19682
|
+
}
|
|
19683
|
+
};
|
|
19588
19684
|
const subscribe = (stripeSource, state, dispatch) => {
|
|
19589
19685
|
const {
|
|
19590
19686
|
couponCode
|
|
@@ -19870,7 +19966,6 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
19870
19966
|
return stripe.createSource({
|
|
19871
19967
|
type: "card"
|
|
19872
19968
|
}).then(_ref8 => {
|
|
19873
|
-
var _source$card2;
|
|
19874
19969
|
let {
|
|
19875
19970
|
source,
|
|
19876
19971
|
error
|
|
@@ -19880,17 +19975,19 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
19880
19975
|
}
|
|
19881
19976
|
|
|
19882
19977
|
// We don't support source creation for 3D secure yet
|
|
19883
|
-
if (
|
|
19884
|
-
|
|
19885
|
-
|
|
19886
|
-
|
|
19887
|
-
|
|
19888
|
-
|
|
19889
|
-
}
|
|
19978
|
+
// if (source?.card?.three_d_secure === "required") {
|
|
19979
|
+
// return handlePaymentError({
|
|
19980
|
+
// error: {
|
|
19981
|
+
// message: t("messages.cardAuthNotSupported")
|
|
19982
|
+
// }
|
|
19983
|
+
// });
|
|
19984
|
+
// }
|
|
19985
|
+
|
|
19890
19986
|
window.Pelcro.paymentMethods.create({
|
|
19891
19987
|
auth_token: window.Pelcro.user.read().auth_token,
|
|
19892
19988
|
token: source.id
|
|
19893
19989
|
}, (err, res) => {
|
|
19990
|
+
var _res$data, _res$data$setup_inten, _res$data2, _res$data2$setup_inte;
|
|
19894
19991
|
dispatch({
|
|
19895
19992
|
type: DISABLE_SUBMIT,
|
|
19896
19993
|
payload: false
|
|
@@ -19909,14 +20006,18 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
19909
20006
|
}
|
|
19910
20007
|
});
|
|
19911
20008
|
}
|
|
19912
|
-
|
|
19913
|
-
|
|
19914
|
-
|
|
19915
|
-
|
|
19916
|
-
|
|
19917
|
-
|
|
19918
|
-
|
|
19919
|
-
|
|
20009
|
+
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") {
|
|
20010
|
+
confirmStripeIntentSetup(res, "create");
|
|
20011
|
+
} else {
|
|
20012
|
+
dispatch({
|
|
20013
|
+
type: SHOW_ALERT,
|
|
20014
|
+
payload: {
|
|
20015
|
+
type: "success",
|
|
20016
|
+
content: t("messages.sourceCreated")
|
|
20017
|
+
}
|
|
20018
|
+
});
|
|
20019
|
+
onSuccess(res);
|
|
20020
|
+
}
|
|
19920
20021
|
});
|
|
19921
20022
|
});
|
|
19922
20023
|
};
|
|
@@ -19937,6 +20038,7 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
19937
20038
|
exp_year: year,
|
|
19938
20039
|
is_default: isDefault
|
|
19939
20040
|
}, (err, res) => {
|
|
20041
|
+
var _res$data3, _res$data3$setup_inte, _res$data4, _res$data4$setup_inte;
|
|
19940
20042
|
dispatch({
|
|
19941
20043
|
type: DISABLE_SUBMIT,
|
|
19942
20044
|
payload: false
|
|
@@ -19955,14 +20057,18 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
19955
20057
|
}
|
|
19956
20058
|
});
|
|
19957
20059
|
}
|
|
19958
|
-
|
|
19959
|
-
|
|
19960
|
-
|
|
19961
|
-
|
|
19962
|
-
|
|
19963
|
-
|
|
19964
|
-
|
|
19965
|
-
|
|
20060
|
+
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") {
|
|
20061
|
+
confirmStripeIntentSetup(res, "update");
|
|
20062
|
+
} else {
|
|
20063
|
+
dispatch({
|
|
20064
|
+
type: SHOW_ALERT,
|
|
20065
|
+
payload: {
|
|
20066
|
+
type: "success",
|
|
20067
|
+
content: t("messages.sourceUpdated")
|
|
20068
|
+
}
|
|
20069
|
+
});
|
|
20070
|
+
onSuccess(res);
|
|
20071
|
+
}
|
|
19966
20072
|
});
|
|
19967
20073
|
};
|
|
19968
20074
|
const replacePaymentSource = (state, dispatch) => {
|
|
@@ -19972,7 +20078,6 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
19972
20078
|
return stripe.createSource({
|
|
19973
20079
|
type: "card"
|
|
19974
20080
|
}).then(_ref9 => {
|
|
19975
|
-
var _source$card3;
|
|
19976
20081
|
let {
|
|
19977
20082
|
source,
|
|
19978
20083
|
error
|
|
@@ -19982,17 +20087,19 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
19982
20087
|
}
|
|
19983
20088
|
|
|
19984
20089
|
// We don't support source creation for 3D secure yet
|
|
19985
|
-
if (
|
|
19986
|
-
|
|
19987
|
-
|
|
19988
|
-
|
|
19989
|
-
|
|
19990
|
-
|
|
19991
|
-
}
|
|
20090
|
+
// if (source?.card?.three_d_secure === "required") {
|
|
20091
|
+
// return handlePaymentError({
|
|
20092
|
+
// error: {
|
|
20093
|
+
// message: t("messages.cardAuthNotSupported")
|
|
20094
|
+
// }
|
|
20095
|
+
// });
|
|
20096
|
+
// }
|
|
20097
|
+
|
|
19992
20098
|
window.Pelcro.paymentMethods.create({
|
|
19993
20099
|
auth_token: window.Pelcro.user.read().auth_token,
|
|
19994
20100
|
token: source.id
|
|
19995
20101
|
}, (err, res) => {
|
|
20102
|
+
var _res$data5, _res$data5$setup_inte, _res$data6, _res$data6$setup_inte;
|
|
19996
20103
|
if (err) {
|
|
19997
20104
|
onFailure(err);
|
|
19998
20105
|
return dispatch({
|
|
@@ -20003,7 +20110,9 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
20003
20110
|
}
|
|
20004
20111
|
});
|
|
20005
20112
|
}
|
|
20006
|
-
if (res) {
|
|
20113
|
+
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") {
|
|
20114
|
+
confirmStripeIntentSetup(res, "replace", paymentMethodId);
|
|
20115
|
+
} else {
|
|
20007
20116
|
setTimeout(() => {
|
|
20008
20117
|
window.Pelcro.paymentMethods.deletePaymentMethod({
|
|
20009
20118
|
auth_token: window.Pelcro.user.read().auth_token,
|
|
@@ -20166,12 +20275,12 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
20166
20275
|
coupon_code: state === null || state === void 0 ? void 0 : state.couponCode,
|
|
20167
20276
|
address_id: selectedAddressId
|
|
20168
20277
|
}, (error, res) => {
|
|
20169
|
-
var _res$
|
|
20278
|
+
var _res$data7, _res$data8;
|
|
20170
20279
|
if (error) {
|
|
20171
20280
|
return reject(error);
|
|
20172
20281
|
}
|
|
20173
|
-
const taxAmount = (_res$
|
|
20174
|
-
const totalAmountWithTax = (_res$
|
|
20282
|
+
const taxAmount = (_res$data7 = res.data) === null || _res$data7 === void 0 ? void 0 : _res$data7.taxes;
|
|
20283
|
+
const totalAmountWithTax = (_res$data8 = res.data) === null || _res$data8 === void 0 ? void 0 : _res$data8.total;
|
|
20175
20284
|
resolve({
|
|
20176
20285
|
totalAmountWithTax,
|
|
20177
20286
|
taxAmount
|