@pelcro/react-pelcro-js 3.33.2 → 3.34.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 +145 -36
- package/dist/index.esm.js +145 -36
- package/package.json +1 -1
package/dist/index.cjs.js
CHANGED
|
@@ -18762,6 +18762,102 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
18762
18762
|
onSuccess(response);
|
|
18763
18763
|
}
|
|
18764
18764
|
};
|
|
18765
|
+
const confirmStripeIntentSetup = (response, flow, paymentMethodId) => {
|
|
18766
|
+
var _response$data2;
|
|
18767
|
+
const setupIntent = (_response$data2 = response.data) === null || _response$data2 === void 0 ? void 0 : _response$data2.setup_intent;
|
|
18768
|
+
if (setupIntent !== null && setupIntent !== void 0 && setupIntent.client_secret) {
|
|
18769
|
+
var _response$data3, _response$data3$sourc;
|
|
18770
|
+
stripe.confirmCardSetup(setupIntent.client_secret, {
|
|
18771
|
+
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
|
|
18772
|
+
}).then(res => {
|
|
18773
|
+
var _response$data4;
|
|
18774
|
+
if (res.error) {
|
|
18775
|
+
dispatch({
|
|
18776
|
+
type: LOADING,
|
|
18777
|
+
payload: false
|
|
18778
|
+
});
|
|
18779
|
+
onFailure(res.error);
|
|
18780
|
+
return dispatch({
|
|
18781
|
+
type: SHOW_ALERT,
|
|
18782
|
+
payload: {
|
|
18783
|
+
type: "error",
|
|
18784
|
+
content: getErrorMessages(res.error)
|
|
18785
|
+
}
|
|
18786
|
+
});
|
|
18787
|
+
}
|
|
18788
|
+
if (flow === "create") {
|
|
18789
|
+
dispatch({
|
|
18790
|
+
type: DISABLE_SUBMIT,
|
|
18791
|
+
payload: false
|
|
18792
|
+
});
|
|
18793
|
+
dispatch({
|
|
18794
|
+
type: LOADING,
|
|
18795
|
+
payload: false
|
|
18796
|
+
});
|
|
18797
|
+
dispatch({
|
|
18798
|
+
type: SHOW_ALERT,
|
|
18799
|
+
payload: {
|
|
18800
|
+
type: "success",
|
|
18801
|
+
content: t("messages.sourceCreated")
|
|
18802
|
+
}
|
|
18803
|
+
});
|
|
18804
|
+
onSuccess(res);
|
|
18805
|
+
return;
|
|
18806
|
+
}
|
|
18807
|
+
if (flow === "update") {
|
|
18808
|
+
dispatch({
|
|
18809
|
+
type: DISABLE_SUBMIT,
|
|
18810
|
+
payload: false
|
|
18811
|
+
});
|
|
18812
|
+
dispatch({
|
|
18813
|
+
type: LOADING,
|
|
18814
|
+
payload: false
|
|
18815
|
+
});
|
|
18816
|
+
dispatch({
|
|
18817
|
+
type: SHOW_ALERT,
|
|
18818
|
+
payload: {
|
|
18819
|
+
type: "success",
|
|
18820
|
+
content: t("messages.sourceUpdated")
|
|
18821
|
+
}
|
|
18822
|
+
});
|
|
18823
|
+
onSuccess(res);
|
|
18824
|
+
return;
|
|
18825
|
+
}
|
|
18826
|
+
if (flow === "replace") {
|
|
18827
|
+
setTimeout(() => {
|
|
18828
|
+
window.Pelcro.paymentMethods.deletePaymentMethod({
|
|
18829
|
+
auth_token: window.Pelcro.user.read().auth_token,
|
|
18830
|
+
payment_method_id: paymentMethodId
|
|
18831
|
+
}, (err, res) => {
|
|
18832
|
+
dispatch({
|
|
18833
|
+
type: DISABLE_SUBMIT,
|
|
18834
|
+
payload: false
|
|
18835
|
+
});
|
|
18836
|
+
dispatch({
|
|
18837
|
+
type: LOADING,
|
|
18838
|
+
payload: false
|
|
18839
|
+
});
|
|
18840
|
+
if (err) {
|
|
18841
|
+
onFailure === null || onFailure === void 0 ? void 0 : onFailure(err);
|
|
18842
|
+
return dispatch({
|
|
18843
|
+
type: SHOW_ALERT,
|
|
18844
|
+
payload: {
|
|
18845
|
+
type: "error",
|
|
18846
|
+
content: getErrorMessages(err)
|
|
18847
|
+
}
|
|
18848
|
+
});
|
|
18849
|
+
}
|
|
18850
|
+
onSuccess(res);
|
|
18851
|
+
});
|
|
18852
|
+
}, 2000);
|
|
18853
|
+
return;
|
|
18854
|
+
}
|
|
18855
|
+
return handlePayment(response === null || response === void 0 ? void 0 : (_response$data4 = response.data) === null || _response$data4 === void 0 ? void 0 : _response$data4.source);
|
|
18856
|
+
});
|
|
18857
|
+
} else {
|
|
18858
|
+
onSuccess(response);
|
|
18859
|
+
}
|
|
18860
|
+
};
|
|
18765
18861
|
const subscribe = (stripeSource, state, dispatch) => {
|
|
18766
18862
|
const {
|
|
18767
18863
|
couponCode
|
|
@@ -19024,7 +19120,6 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
19024
19120
|
return stripe.createSource({
|
|
19025
19121
|
type: "card"
|
|
19026
19122
|
}).then(_ref8 => {
|
|
19027
|
-
var _source$card2;
|
|
19028
19123
|
let {
|
|
19029
19124
|
source,
|
|
19030
19125
|
error
|
|
@@ -19034,17 +19129,19 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
19034
19129
|
}
|
|
19035
19130
|
|
|
19036
19131
|
// We don't support source creation for 3D secure yet
|
|
19037
|
-
if (
|
|
19038
|
-
|
|
19039
|
-
|
|
19040
|
-
|
|
19041
|
-
|
|
19042
|
-
|
|
19043
|
-
}
|
|
19132
|
+
// if (source?.card?.three_d_secure === "required") {
|
|
19133
|
+
// return handlePaymentError({
|
|
19134
|
+
// error: {
|
|
19135
|
+
// message: t("messages.cardAuthNotSupported")
|
|
19136
|
+
// }
|
|
19137
|
+
// });
|
|
19138
|
+
// }
|
|
19139
|
+
|
|
19044
19140
|
window.Pelcro.paymentMethods.create({
|
|
19045
19141
|
auth_token: window.Pelcro.user.read().auth_token,
|
|
19046
19142
|
token: source.id
|
|
19047
19143
|
}, (err, res) => {
|
|
19144
|
+
var _res$data, _res$data$setup_inten, _res$data2, _res$data2$setup_inte;
|
|
19048
19145
|
dispatch({
|
|
19049
19146
|
type: DISABLE_SUBMIT,
|
|
19050
19147
|
payload: false
|
|
@@ -19063,14 +19160,18 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
19063
19160
|
}
|
|
19064
19161
|
});
|
|
19065
19162
|
}
|
|
19066
|
-
|
|
19067
|
-
|
|
19068
|
-
|
|
19069
|
-
|
|
19070
|
-
|
|
19071
|
-
|
|
19072
|
-
|
|
19073
|
-
|
|
19163
|
+
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") {
|
|
19164
|
+
confirmStripeIntentSetup(res, "create");
|
|
19165
|
+
} else {
|
|
19166
|
+
dispatch({
|
|
19167
|
+
type: SHOW_ALERT,
|
|
19168
|
+
payload: {
|
|
19169
|
+
type: "success",
|
|
19170
|
+
content: t("messages.sourceCreated")
|
|
19171
|
+
}
|
|
19172
|
+
});
|
|
19173
|
+
onSuccess(res);
|
|
19174
|
+
}
|
|
19074
19175
|
});
|
|
19075
19176
|
});
|
|
19076
19177
|
};
|
|
@@ -19091,6 +19192,7 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
19091
19192
|
exp_year: year,
|
|
19092
19193
|
is_default: isDefault
|
|
19093
19194
|
}, (err, res) => {
|
|
19195
|
+
var _res$data3, _res$data3$setup_inte, _res$data4, _res$data4$setup_inte;
|
|
19094
19196
|
dispatch({
|
|
19095
19197
|
type: DISABLE_SUBMIT,
|
|
19096
19198
|
payload: false
|
|
@@ -19109,14 +19211,18 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
19109
19211
|
}
|
|
19110
19212
|
});
|
|
19111
19213
|
}
|
|
19112
|
-
|
|
19113
|
-
|
|
19114
|
-
|
|
19115
|
-
|
|
19116
|
-
|
|
19117
|
-
|
|
19118
|
-
|
|
19119
|
-
|
|
19214
|
+
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") {
|
|
19215
|
+
confirmStripeIntentSetup(res, "update");
|
|
19216
|
+
} else {
|
|
19217
|
+
dispatch({
|
|
19218
|
+
type: SHOW_ALERT,
|
|
19219
|
+
payload: {
|
|
19220
|
+
type: "success",
|
|
19221
|
+
content: t("messages.sourceUpdated")
|
|
19222
|
+
}
|
|
19223
|
+
});
|
|
19224
|
+
onSuccess(res);
|
|
19225
|
+
}
|
|
19120
19226
|
});
|
|
19121
19227
|
};
|
|
19122
19228
|
const replacePaymentSource = (state, dispatch) => {
|
|
@@ -19126,7 +19232,6 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
19126
19232
|
return stripe.createSource({
|
|
19127
19233
|
type: "card"
|
|
19128
19234
|
}).then(_ref9 => {
|
|
19129
|
-
var _source$card3;
|
|
19130
19235
|
let {
|
|
19131
19236
|
source,
|
|
19132
19237
|
error
|
|
@@ -19136,17 +19241,19 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
19136
19241
|
}
|
|
19137
19242
|
|
|
19138
19243
|
// We don't support source creation for 3D secure yet
|
|
19139
|
-
if (
|
|
19140
|
-
|
|
19141
|
-
|
|
19142
|
-
|
|
19143
|
-
|
|
19144
|
-
|
|
19145
|
-
}
|
|
19244
|
+
// if (source?.card?.three_d_secure === "required") {
|
|
19245
|
+
// return handlePaymentError({
|
|
19246
|
+
// error: {
|
|
19247
|
+
// message: t("messages.cardAuthNotSupported")
|
|
19248
|
+
// }
|
|
19249
|
+
// });
|
|
19250
|
+
// }
|
|
19251
|
+
|
|
19146
19252
|
window.Pelcro.paymentMethods.create({
|
|
19147
19253
|
auth_token: window.Pelcro.user.read().auth_token,
|
|
19148
19254
|
token: source.id
|
|
19149
19255
|
}, (err, res) => {
|
|
19256
|
+
var _res$data5, _res$data5$setup_inte, _res$data6, _res$data6$setup_inte;
|
|
19150
19257
|
if (err) {
|
|
19151
19258
|
onFailure(err);
|
|
19152
19259
|
return dispatch({
|
|
@@ -19157,7 +19264,9 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
19157
19264
|
}
|
|
19158
19265
|
});
|
|
19159
19266
|
}
|
|
19160
|
-
if (res) {
|
|
19267
|
+
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") {
|
|
19268
|
+
confirmStripeIntentSetup(res, "replace", paymentMethodId);
|
|
19269
|
+
} else {
|
|
19161
19270
|
setTimeout(() => {
|
|
19162
19271
|
window.Pelcro.paymentMethods.deletePaymentMethod({
|
|
19163
19272
|
auth_token: window.Pelcro.user.read().auth_token,
|
|
@@ -19276,12 +19385,12 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
19276
19385
|
coupon_code: state === null || state === void 0 ? void 0 : state.couponCode,
|
|
19277
19386
|
address_id: selectedAddressId
|
|
19278
19387
|
}, (error, res) => {
|
|
19279
|
-
var _res$
|
|
19388
|
+
var _res$data7, _res$data8;
|
|
19280
19389
|
if (error) {
|
|
19281
19390
|
return reject(error);
|
|
19282
19391
|
}
|
|
19283
|
-
const taxAmount = (_res$
|
|
19284
|
-
const totalAmountWithTax = (_res$
|
|
19392
|
+
const taxAmount = (_res$data7 = res.data) === null || _res$data7 === void 0 ? void 0 : _res$data7.taxes;
|
|
19393
|
+
const totalAmountWithTax = (_res$data8 = res.data) === null || _res$data8 === void 0 ? void 0 : _res$data8.total;
|
|
19285
19394
|
resolve({
|
|
19286
19395
|
totalAmountWithTax,
|
|
19287
19396
|
taxAmount
|
package/dist/index.esm.js
CHANGED
|
@@ -18732,6 +18732,102 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
18732
18732
|
onSuccess(response);
|
|
18733
18733
|
}
|
|
18734
18734
|
};
|
|
18735
|
+
const confirmStripeIntentSetup = (response, flow, paymentMethodId) => {
|
|
18736
|
+
var _response$data2;
|
|
18737
|
+
const setupIntent = (_response$data2 = response.data) === null || _response$data2 === void 0 ? void 0 : _response$data2.setup_intent;
|
|
18738
|
+
if (setupIntent !== null && setupIntent !== void 0 && setupIntent.client_secret) {
|
|
18739
|
+
var _response$data3, _response$data3$sourc;
|
|
18740
|
+
stripe.confirmCardSetup(setupIntent.client_secret, {
|
|
18741
|
+
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
|
|
18742
|
+
}).then(res => {
|
|
18743
|
+
var _response$data4;
|
|
18744
|
+
if (res.error) {
|
|
18745
|
+
dispatch({
|
|
18746
|
+
type: LOADING,
|
|
18747
|
+
payload: false
|
|
18748
|
+
});
|
|
18749
|
+
onFailure(res.error);
|
|
18750
|
+
return dispatch({
|
|
18751
|
+
type: SHOW_ALERT,
|
|
18752
|
+
payload: {
|
|
18753
|
+
type: "error",
|
|
18754
|
+
content: getErrorMessages(res.error)
|
|
18755
|
+
}
|
|
18756
|
+
});
|
|
18757
|
+
}
|
|
18758
|
+
if (flow === "create") {
|
|
18759
|
+
dispatch({
|
|
18760
|
+
type: DISABLE_SUBMIT,
|
|
18761
|
+
payload: false
|
|
18762
|
+
});
|
|
18763
|
+
dispatch({
|
|
18764
|
+
type: LOADING,
|
|
18765
|
+
payload: false
|
|
18766
|
+
});
|
|
18767
|
+
dispatch({
|
|
18768
|
+
type: SHOW_ALERT,
|
|
18769
|
+
payload: {
|
|
18770
|
+
type: "success",
|
|
18771
|
+
content: t("messages.sourceCreated")
|
|
18772
|
+
}
|
|
18773
|
+
});
|
|
18774
|
+
onSuccess(res);
|
|
18775
|
+
return;
|
|
18776
|
+
}
|
|
18777
|
+
if (flow === "update") {
|
|
18778
|
+
dispatch({
|
|
18779
|
+
type: DISABLE_SUBMIT,
|
|
18780
|
+
payload: false
|
|
18781
|
+
});
|
|
18782
|
+
dispatch({
|
|
18783
|
+
type: LOADING,
|
|
18784
|
+
payload: false
|
|
18785
|
+
});
|
|
18786
|
+
dispatch({
|
|
18787
|
+
type: SHOW_ALERT,
|
|
18788
|
+
payload: {
|
|
18789
|
+
type: "success",
|
|
18790
|
+
content: t("messages.sourceUpdated")
|
|
18791
|
+
}
|
|
18792
|
+
});
|
|
18793
|
+
onSuccess(res);
|
|
18794
|
+
return;
|
|
18795
|
+
}
|
|
18796
|
+
if (flow === "replace") {
|
|
18797
|
+
setTimeout(() => {
|
|
18798
|
+
window.Pelcro.paymentMethods.deletePaymentMethod({
|
|
18799
|
+
auth_token: window.Pelcro.user.read().auth_token,
|
|
18800
|
+
payment_method_id: paymentMethodId
|
|
18801
|
+
}, (err, res) => {
|
|
18802
|
+
dispatch({
|
|
18803
|
+
type: DISABLE_SUBMIT,
|
|
18804
|
+
payload: false
|
|
18805
|
+
});
|
|
18806
|
+
dispatch({
|
|
18807
|
+
type: LOADING,
|
|
18808
|
+
payload: false
|
|
18809
|
+
});
|
|
18810
|
+
if (err) {
|
|
18811
|
+
onFailure === null || onFailure === void 0 ? void 0 : onFailure(err);
|
|
18812
|
+
return dispatch({
|
|
18813
|
+
type: SHOW_ALERT,
|
|
18814
|
+
payload: {
|
|
18815
|
+
type: "error",
|
|
18816
|
+
content: getErrorMessages(err)
|
|
18817
|
+
}
|
|
18818
|
+
});
|
|
18819
|
+
}
|
|
18820
|
+
onSuccess(res);
|
|
18821
|
+
});
|
|
18822
|
+
}, 2000);
|
|
18823
|
+
return;
|
|
18824
|
+
}
|
|
18825
|
+
return handlePayment(response === null || response === void 0 ? void 0 : (_response$data4 = response.data) === null || _response$data4 === void 0 ? void 0 : _response$data4.source);
|
|
18826
|
+
});
|
|
18827
|
+
} else {
|
|
18828
|
+
onSuccess(response);
|
|
18829
|
+
}
|
|
18830
|
+
};
|
|
18735
18831
|
const subscribe = (stripeSource, state, dispatch) => {
|
|
18736
18832
|
const {
|
|
18737
18833
|
couponCode
|
|
@@ -18994,7 +19090,6 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
18994
19090
|
return stripe.createSource({
|
|
18995
19091
|
type: "card"
|
|
18996
19092
|
}).then(_ref8 => {
|
|
18997
|
-
var _source$card2;
|
|
18998
19093
|
let {
|
|
18999
19094
|
source,
|
|
19000
19095
|
error
|
|
@@ -19004,17 +19099,19 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
19004
19099
|
}
|
|
19005
19100
|
|
|
19006
19101
|
// We don't support source creation for 3D secure yet
|
|
19007
|
-
if (
|
|
19008
|
-
|
|
19009
|
-
|
|
19010
|
-
|
|
19011
|
-
|
|
19012
|
-
|
|
19013
|
-
}
|
|
19102
|
+
// if (source?.card?.three_d_secure === "required") {
|
|
19103
|
+
// return handlePaymentError({
|
|
19104
|
+
// error: {
|
|
19105
|
+
// message: t("messages.cardAuthNotSupported")
|
|
19106
|
+
// }
|
|
19107
|
+
// });
|
|
19108
|
+
// }
|
|
19109
|
+
|
|
19014
19110
|
window.Pelcro.paymentMethods.create({
|
|
19015
19111
|
auth_token: window.Pelcro.user.read().auth_token,
|
|
19016
19112
|
token: source.id
|
|
19017
19113
|
}, (err, res) => {
|
|
19114
|
+
var _res$data, _res$data$setup_inten, _res$data2, _res$data2$setup_inte;
|
|
19018
19115
|
dispatch({
|
|
19019
19116
|
type: DISABLE_SUBMIT,
|
|
19020
19117
|
payload: false
|
|
@@ -19033,14 +19130,18 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
19033
19130
|
}
|
|
19034
19131
|
});
|
|
19035
19132
|
}
|
|
19036
|
-
|
|
19037
|
-
|
|
19038
|
-
|
|
19039
|
-
|
|
19040
|
-
|
|
19041
|
-
|
|
19042
|
-
|
|
19043
|
-
|
|
19133
|
+
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") {
|
|
19134
|
+
confirmStripeIntentSetup(res, "create");
|
|
19135
|
+
} else {
|
|
19136
|
+
dispatch({
|
|
19137
|
+
type: SHOW_ALERT,
|
|
19138
|
+
payload: {
|
|
19139
|
+
type: "success",
|
|
19140
|
+
content: t("messages.sourceCreated")
|
|
19141
|
+
}
|
|
19142
|
+
});
|
|
19143
|
+
onSuccess(res);
|
|
19144
|
+
}
|
|
19044
19145
|
});
|
|
19045
19146
|
});
|
|
19046
19147
|
};
|
|
@@ -19061,6 +19162,7 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
19061
19162
|
exp_year: year,
|
|
19062
19163
|
is_default: isDefault
|
|
19063
19164
|
}, (err, res) => {
|
|
19165
|
+
var _res$data3, _res$data3$setup_inte, _res$data4, _res$data4$setup_inte;
|
|
19064
19166
|
dispatch({
|
|
19065
19167
|
type: DISABLE_SUBMIT,
|
|
19066
19168
|
payload: false
|
|
@@ -19079,14 +19181,18 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
19079
19181
|
}
|
|
19080
19182
|
});
|
|
19081
19183
|
}
|
|
19082
|
-
|
|
19083
|
-
|
|
19084
|
-
|
|
19085
|
-
|
|
19086
|
-
|
|
19087
|
-
|
|
19088
|
-
|
|
19089
|
-
|
|
19184
|
+
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") {
|
|
19185
|
+
confirmStripeIntentSetup(res, "update");
|
|
19186
|
+
} else {
|
|
19187
|
+
dispatch({
|
|
19188
|
+
type: SHOW_ALERT,
|
|
19189
|
+
payload: {
|
|
19190
|
+
type: "success",
|
|
19191
|
+
content: t("messages.sourceUpdated")
|
|
19192
|
+
}
|
|
19193
|
+
});
|
|
19194
|
+
onSuccess(res);
|
|
19195
|
+
}
|
|
19090
19196
|
});
|
|
19091
19197
|
};
|
|
19092
19198
|
const replacePaymentSource = (state, dispatch) => {
|
|
@@ -19096,7 +19202,6 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
19096
19202
|
return stripe.createSource({
|
|
19097
19203
|
type: "card"
|
|
19098
19204
|
}).then(_ref9 => {
|
|
19099
|
-
var _source$card3;
|
|
19100
19205
|
let {
|
|
19101
19206
|
source,
|
|
19102
19207
|
error
|
|
@@ -19106,17 +19211,19 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
19106
19211
|
}
|
|
19107
19212
|
|
|
19108
19213
|
// We don't support source creation for 3D secure yet
|
|
19109
|
-
if (
|
|
19110
|
-
|
|
19111
|
-
|
|
19112
|
-
|
|
19113
|
-
|
|
19114
|
-
|
|
19115
|
-
}
|
|
19214
|
+
// if (source?.card?.three_d_secure === "required") {
|
|
19215
|
+
// return handlePaymentError({
|
|
19216
|
+
// error: {
|
|
19217
|
+
// message: t("messages.cardAuthNotSupported")
|
|
19218
|
+
// }
|
|
19219
|
+
// });
|
|
19220
|
+
// }
|
|
19221
|
+
|
|
19116
19222
|
window.Pelcro.paymentMethods.create({
|
|
19117
19223
|
auth_token: window.Pelcro.user.read().auth_token,
|
|
19118
19224
|
token: source.id
|
|
19119
19225
|
}, (err, res) => {
|
|
19226
|
+
var _res$data5, _res$data5$setup_inte, _res$data6, _res$data6$setup_inte;
|
|
19120
19227
|
if (err) {
|
|
19121
19228
|
onFailure(err);
|
|
19122
19229
|
return dispatch({
|
|
@@ -19127,7 +19234,9 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
19127
19234
|
}
|
|
19128
19235
|
});
|
|
19129
19236
|
}
|
|
19130
|
-
if (res) {
|
|
19237
|
+
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") {
|
|
19238
|
+
confirmStripeIntentSetup(res, "replace", paymentMethodId);
|
|
19239
|
+
} else {
|
|
19131
19240
|
setTimeout(() => {
|
|
19132
19241
|
window.Pelcro.paymentMethods.deletePaymentMethod({
|
|
19133
19242
|
auth_token: window.Pelcro.user.read().auth_token,
|
|
@@ -19246,12 +19355,12 @@ const PaymentMethodContainerWithoutStripe = _ref => {
|
|
|
19246
19355
|
coupon_code: state === null || state === void 0 ? void 0 : state.couponCode,
|
|
19247
19356
|
address_id: selectedAddressId
|
|
19248
19357
|
}, (error, res) => {
|
|
19249
|
-
var _res$
|
|
19358
|
+
var _res$data7, _res$data8;
|
|
19250
19359
|
if (error) {
|
|
19251
19360
|
return reject(error);
|
|
19252
19361
|
}
|
|
19253
|
-
const taxAmount = (_res$
|
|
19254
|
-
const totalAmountWithTax = (_res$
|
|
19362
|
+
const taxAmount = (_res$data7 = res.data) === null || _res$data7 === void 0 ? void 0 : _res$data7.taxes;
|
|
19363
|
+
const totalAmountWithTax = (_res$data8 = res.data) === null || _res$data8 === void 0 ? void 0 : _res$data8.total;
|
|
19255
19364
|
resolve({
|
|
19256
19365
|
totalAmountWithTax,
|
|
19257
19366
|
taxAmount
|