@alipay/ams-checkout 0.0.1757298389-dev.18 → 0.0.1757298389-dev.19
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.
|
@@ -232,7 +232,9 @@ var ElementController = /*#__PURE__*/function () {
|
|
|
232
232
|
});
|
|
233
233
|
var readyCallback = function readyCallback(payload) {
|
|
234
234
|
_this2.elementEventCenter.endEvent(startEventId, payload);
|
|
235
|
-
resolve(payload)
|
|
235
|
+
resolve(_objectSpread(_objectSpread({}, payload || {}), {}, {
|
|
236
|
+
needChangeSessionForRetry: false
|
|
237
|
+
}));
|
|
236
238
|
};
|
|
237
239
|
if (!checkMountResult.success) {
|
|
238
240
|
_this2.handleMountError({
|
|
@@ -328,7 +330,8 @@ var ElementController = /*#__PURE__*/function () {
|
|
|
328
330
|
}
|
|
329
331
|
res = {
|
|
330
332
|
error: ERRORMESSAGE.UI_STATE_ERROR,
|
|
331
|
-
status: PaymentStatus.FAIL
|
|
333
|
+
status: PaymentStatus.FAIL,
|
|
334
|
+
needChangeSessionForRetry: false
|
|
332
335
|
};
|
|
333
336
|
this.elementEventCenter.endEvent(startEventId, res);
|
|
334
337
|
return _context4.abrupt("return", Promise.resolve(res));
|
|
@@ -339,12 +342,22 @@ var ElementController = /*#__PURE__*/function () {
|
|
|
339
342
|
_context4.next = 10;
|
|
340
343
|
return new Promise( /*#__PURE__*/function () {
|
|
341
344
|
var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(resolve) {
|
|
342
|
-
var params, processStep, _yield$_this3$onValid2, data, errorResult;
|
|
345
|
+
var that, recordResultCallback, params, processStep, _yield$_this3$onValid2, data, errorResult;
|
|
343
346
|
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
344
347
|
while (1) switch (_context3.prev = _context3.next) {
|
|
345
348
|
case 0:
|
|
346
|
-
|
|
347
|
-
|
|
349
|
+
recordResultCallback = function _recordResultCallback(result) {
|
|
350
|
+
if (result instanceof Object) {
|
|
351
|
+
var _that$elementProcesso;
|
|
352
|
+
var needChangeSessionForRetry = typeof (result === null || result === void 0 ? void 0 : result.needChangeSessionForRetry) === 'undefined' ? (_that$elementProcesso = that.elementProcessors[ElementType.payment]) === null || _that$elementProcesso === void 0 || (_that$elementProcesso = _that$elementProcesso.obtainDataRes) === null || _that$elementProcesso === void 0 || (_that$elementProcesso = _that$elementProcesso.originActionQueryResult) === null || _that$elementProcesso === void 0 ? void 0 : _that$elementProcesso.notSupportRetryPayForSameSession : result === null || result === void 0 ? void 0 : result.needChangeSessionForRetry;
|
|
353
|
+
result.needChangeSessionForRetry = needChangeSessionForRetry || false;
|
|
354
|
+
}
|
|
355
|
+
recordResult = result;
|
|
356
|
+
resolve(recordResult);
|
|
357
|
+
};
|
|
358
|
+
that = _this3;
|
|
359
|
+
_context3.prev = 2;
|
|
360
|
+
_this3.submitPayPromise = recordResultCallback;
|
|
348
361
|
params = {}; // 统一处理逻辑
|
|
349
362
|
processStep = /*#__PURE__*/function () {
|
|
350
363
|
var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(elementType, method) {
|
|
@@ -370,7 +383,7 @@ var ElementController = /*#__PURE__*/function () {
|
|
|
370
383
|
}
|
|
371
384
|
// TODO 先快速修复类型, 这里结构和标准返回不一致 @马杰
|
|
372
385
|
recordResult = data;
|
|
373
|
-
|
|
386
|
+
recordResultCallback(recordResult);
|
|
374
387
|
return _context2.abrupt("return", false);
|
|
375
388
|
case 11:
|
|
376
389
|
return _context2.abrupt("return", true);
|
|
@@ -384,43 +397,44 @@ var ElementController = /*#__PURE__*/function () {
|
|
|
384
397
|
return _ref4.apply(this, arguments);
|
|
385
398
|
};
|
|
386
399
|
}(); // 按顺序处理步骤
|
|
387
|
-
_context3.next =
|
|
400
|
+
_context3.next = 8;
|
|
388
401
|
return processStep(ElementType.auth, ElementPaymentMethod.AUTH_ELEMENT);
|
|
389
|
-
case
|
|
402
|
+
case 8:
|
|
390
403
|
if (_context3.sent) {
|
|
391
|
-
_context3.next =
|
|
404
|
+
_context3.next = 10;
|
|
392
405
|
break;
|
|
393
406
|
}
|
|
394
407
|
return _context3.abrupt("return");
|
|
395
|
-
case 8:
|
|
396
|
-
_context3.next = 10;
|
|
397
|
-
return processStep(ElementType.address, ElementPaymentMethod.ADDRESS_ELEMENT);
|
|
398
408
|
case 10:
|
|
409
|
+
_context3.next = 12;
|
|
410
|
+
return processStep(ElementType.address, ElementPaymentMethod.ADDRESS_ELEMENT);
|
|
411
|
+
case 12:
|
|
399
412
|
if (_context3.sent) {
|
|
400
|
-
_context3.next =
|
|
413
|
+
_context3.next = 14;
|
|
401
414
|
break;
|
|
402
415
|
}
|
|
403
416
|
return _context3.abrupt("return");
|
|
404
|
-
case
|
|
417
|
+
case 14:
|
|
405
418
|
if (!_this3.elementProcessors[ElementType.payment]) {
|
|
406
|
-
_context3.next =
|
|
419
|
+
_context3.next = 22;
|
|
407
420
|
break;
|
|
408
421
|
}
|
|
409
|
-
_context3.next =
|
|
422
|
+
_context3.next = 17;
|
|
410
423
|
return _this3.onValidateAndSubmitPay(_this3.elementProcessors[ElementType.payment].eventCenter, ElementPaymentMethod.PAYMENT_ELEMENT, params);
|
|
411
|
-
case
|
|
424
|
+
case 17:
|
|
412
425
|
_yield$_this3$onValid2 = _context3.sent;
|
|
413
426
|
data = _yield$_this3$onValid2.data;
|
|
427
|
+
console.log('[test] data-----', data);
|
|
414
428
|
// TODO 先快速修复类型, 这里结构和标准返回不一致 @马杰
|
|
415
429
|
// TODO checkout 返回的错误未包含 status 和 message @马杰 @薛浩
|
|
416
430
|
recordResult = data;
|
|
417
|
-
|
|
418
|
-
case
|
|
419
|
-
_context3.next =
|
|
431
|
+
recordResultCallback(recordResult);
|
|
432
|
+
case 22:
|
|
433
|
+
_context3.next = 30;
|
|
420
434
|
break;
|
|
421
|
-
case
|
|
422
|
-
_context3.prev =
|
|
423
|
-
_context3.t0 = _context3["catch"](
|
|
435
|
+
case 24:
|
|
436
|
+
_context3.prev = 24;
|
|
437
|
+
_context3.t0 = _context3["catch"](2);
|
|
424
438
|
errorResult = {
|
|
425
439
|
error: _objectSpread(_objectSpread({}, ERRORMESSAGE.ERR_DATA_STRUCT_UNRECOGNIZED), {}, {
|
|
426
440
|
context: JSON.stringify(_context3.t0)
|
|
@@ -433,12 +447,12 @@ var ElementController = /*#__PURE__*/function () {
|
|
|
433
447
|
msg: JSON.stringify(errorResult)
|
|
434
448
|
});
|
|
435
449
|
recordResult = errorResult;
|
|
436
|
-
|
|
437
|
-
case
|
|
450
|
+
recordResultCallback(errorResult);
|
|
451
|
+
case 30:
|
|
438
452
|
case "end":
|
|
439
453
|
return _context3.stop();
|
|
440
454
|
}
|
|
441
|
-
}, _callee3, null, [[
|
|
455
|
+
}, _callee3, null, [[2, 24]]);
|
|
442
456
|
}));
|
|
443
457
|
return function (_x) {
|
|
444
458
|
return _ref3.apply(this, arguments);
|