@pisell/pisellos 0.0.244 → 0.0.245
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.
|
@@ -121,7 +121,7 @@ var CheckoutImpl = class extends import_BaseModule.BaseModule {
|
|
|
121
121
|
async initializeCheckoutAsync(params) {
|
|
122
122
|
try {
|
|
123
123
|
await this.setStatus(import_types.CheckoutStatus.Initializing);
|
|
124
|
-
const validation =
|
|
124
|
+
const validation = this.validateCheckoutParams(params);
|
|
125
125
|
if (!validation.valid) {
|
|
126
126
|
throw (0, import_utils.createCheckoutError)(
|
|
127
127
|
import_types.CheckoutErrorType.ValidationFailed,
|
|
@@ -194,7 +194,7 @@ var CheckoutImpl = class extends import_BaseModule.BaseModule {
|
|
|
194
194
|
try {
|
|
195
195
|
await this.resetStoreStateAsync();
|
|
196
196
|
await this.setStatus(import_types.CheckoutStatus.CreatingOrder);
|
|
197
|
-
const validation =
|
|
197
|
+
const validation = this.validateLocalOrderData(params.orderData);
|
|
198
198
|
if (!validation.valid) {
|
|
199
199
|
throw (0, import_utils.createCheckoutError)(
|
|
200
200
|
import_types.CheckoutErrorType.ValidationFailed,
|
|
@@ -238,13 +238,13 @@ var CheckoutImpl = class extends import_BaseModule.BaseModule {
|
|
|
238
238
|
}
|
|
239
239
|
});
|
|
240
240
|
this.store.currentOrder = paymentOrder;
|
|
241
|
-
|
|
241
|
+
this.initWalletData();
|
|
242
242
|
await this.setStatus(import_types.CheckoutStatus.OrderCreated);
|
|
243
243
|
await this.setStep(import_types.CheckoutStep.PaymentMethod);
|
|
244
244
|
if (params.autoPayment) {
|
|
245
245
|
await this.setStep(import_types.CheckoutStep.PaymentProcessing);
|
|
246
246
|
}
|
|
247
|
-
|
|
247
|
+
this.core.effects.emit(import_types.CheckoutHooks.OnOrderCreated, {
|
|
248
248
|
order: paymentOrder,
|
|
249
249
|
timestamp: Date.now()
|
|
250
250
|
});
|
|
@@ -263,7 +263,7 @@ var CheckoutImpl = class extends import_BaseModule.BaseModule {
|
|
|
263
263
|
error,
|
|
264
264
|
import_types.CheckoutErrorType.OrderCreationFailed
|
|
265
265
|
);
|
|
266
|
-
|
|
266
|
+
this.core.effects.emit(import_types.CheckoutHooks.OnOrderCreationFailed, {
|
|
267
267
|
error: this.store.lastError,
|
|
268
268
|
timestamp: Date.now()
|
|
269
269
|
});
|
|
@@ -1799,13 +1799,13 @@ var CheckoutImpl = class extends import_BaseModule.BaseModule {
|
|
|
1799
1799
|
/**
|
|
1800
1800
|
* 验证结账参数
|
|
1801
1801
|
*/
|
|
1802
|
-
|
|
1802
|
+
validateCheckoutParams(params) {
|
|
1803
1803
|
return (0, import_utils.validateCheckoutData)(params);
|
|
1804
1804
|
}
|
|
1805
1805
|
/**
|
|
1806
1806
|
* 验证本地订单数据
|
|
1807
1807
|
*/
|
|
1808
|
-
|
|
1808
|
+
validateLocalOrderData(orderData) {
|
|
1809
1809
|
var _a;
|
|
1810
1810
|
const errors = [];
|
|
1811
1811
|
if (!orderData.type) {
|