@alipay/ams-checkout 0.0.1745808793-dev.5 → 0.0.1745808793-dev.7

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.
@@ -79,8 +79,8 @@ export var EasySafePayProcessor = /*#__PURE__*/function () {
79
79
  this.channelBehavior = ChannelCustomize.getChannelBehavior(paymentContext.paymentSessionObj);
80
80
 
81
81
  // 首次支付
82
- isFirstTimeToPay = !autoDebitWithToken; // 处理ESP1.0极速外跳支付场景
83
- if (!(productSceneVersion === '1.0' && isFirstTimeToPay && requireFastSdk)) {
82
+ isFirstTimeToPay = !autoDebitWithToken; // 处理ESP极速外跳支付场景
83
+ if (!(isFirstTimeToPay && requireFastSdk)) {
84
84
  _context.next = 12;
85
85
  break;
86
86
  }
@@ -245,8 +245,8 @@ export var EasySafePayProcessor = /*#__PURE__*/function () {
245
245
  key: "processQuery",
246
246
  value: function () {
247
247
  var _processQuery = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
248
- var _this$paymentContext3, _this$paymentContext4;
249
- var queryParams, extendInfo, extendInfoData, needQueryRender, requestBizId, requester, _this$paymentContext$5, res;
248
+ var _this$paymentContext3, _this$paymentContext4, _this$paymentContext5, _this$paymentContext$5, _this$paymentContext6, _this$paymentContext7;
249
+ var queryParams, extendInfo, needAccountConfirmPage, isFirstTimeToPay, needQueryRender, extendInfoData, requestBizId, requester, _this$paymentContext$6, res;
250
250
  return _regeneratorRuntime().wrap(function _callee2$(_context2) {
251
251
  while (1) switch (_context2.prev = _context2.next) {
252
252
  case 0:
@@ -254,20 +254,23 @@ export var EasySafePayProcessor = /*#__PURE__*/function () {
254
254
  paymentSessionData: ((_this$paymentContext3 = this.paymentContext) === null || _this$paymentContext3 === void 0 ? void 0 : _this$paymentContext3.paymentSessionId) || '',
255
255
  paymentSessionConfig: (_this$paymentContext4 = this.paymentContext) === null || _this$paymentContext4 === void 0 || (_this$paymentContext4 = _this$paymentContext4.paymentSessionObj) === null || _this$paymentContext4 === void 0 ? void 0 : _this$paymentContext4.paymentSessionConfig
256
256
  };
257
- extendInfo = this.paymentContext.paymentSessionObj.extendInfo;
257
+ extendInfo = (_this$paymentContext5 = this.paymentContext) === null || _this$paymentContext5 === void 0 ? void 0 : _this$paymentContext5.paymentSessionObj.extendInfo;
258
+ needAccountConfirmPage = (_this$paymentContext$5 = (_this$paymentContext6 = this.paymentContext) === null || _this$paymentContext6 === void 0 ? void 0 : _this$paymentContext6.paymentSessionObj.needAccountConfirmPage) !== null && _this$paymentContext$5 !== void 0 ? _this$paymentContext$5 : true;
259
+ isFirstTimeToPay = !((_this$paymentContext7 = this.paymentContext) !== null && _this$paymentContext7 !== void 0 && (_this$paymentContext7 = _this$paymentContext7.paymentSessionObj.action) !== null && _this$paymentContext7 !== void 0 && _this$paymentContext7.autoDebitWithToken);
260
+ needQueryRender = true;
258
261
  try {
259
262
  extendInfoData = JSON.parse(extendInfo);
260
263
  needQueryRender = isEmpty(extendInfoData.needQueryRender) || extendInfoData.needQueryRender === true;
261
- this.allowQueryCall = needQueryRender;
262
264
  } catch (error) {
263
265
  console.log(error);
264
266
  }
267
+ this.allowQueryCall = needQueryRender && isFirstTimeToPay && needAccountConfirmPage;
265
268
  if (this.allowQueryCall) {
266
- _context2.next = 5;
269
+ _context2.next = 9;
267
270
  break;
268
271
  }
269
272
  return _context2.abrupt("return", null);
270
- case 5:
273
+ case 9:
271
274
  requestBizId = uuid();
272
275
  this.logger.logInfo({
273
276
  title: 'sdk_event_sdkQuery'
@@ -276,12 +279,12 @@ export var EasySafePayProcessor = /*#__PURE__*/function () {
276
279
  requestId: requestBizId
277
280
  });
278
281
  requester = ServiceProvider.getInstance(this.instanceId).getService('Requester');
279
- _context2.prev = 8;
280
- _context2.next = 11;
282
+ _context2.prev = 12;
283
+ _context2.next = 15;
281
284
  return requester.request(_objectSpread(_objectSpread({}, queryParams), {}, {
282
285
  actionType: 'init',
283
286
  integrationType: 'SDK',
284
- sdkVersion: (_this$paymentContext$5 = this.paymentContext.sdkMetaData.sdkVersion) !== null && _this$paymentContext$5 !== void 0 ? _this$paymentContext$5 : '1.0.0'
287
+ sdkVersion: (_this$paymentContext$6 = this.paymentContext.sdkMetaData.sdkVersion) !== null && _this$paymentContext$6 !== void 0 ? _this$paymentContext$6 : '1.0.0'
285
288
  }), {
286
289
  env: this.initConfig.environment,
287
290
  timeout: this.SDK_REQUEST_TIMEOUT,
@@ -289,7 +292,7 @@ export var EasySafePayProcessor = /*#__PURE__*/function () {
289
292
  needEnvInfo: true,
290
293
  'Operation-Type': 'com.ipay.iexpcashier.sdkAction.query'
291
294
  });
292
- case 11:
295
+ case 15:
293
296
  res = _context2.sent;
294
297
  this.logger.logInfo({
295
298
  title: 'sdk_event_sdkQueryEnd'
@@ -299,9 +302,9 @@ export var EasySafePayProcessor = /*#__PURE__*/function () {
299
302
  rpcTraceId: res.traceId
300
303
  });
301
304
  return _context2.abrupt("return", res);
302
- case 16:
303
- _context2.prev = 16;
304
- _context2.t0 = _context2["catch"](8);
305
+ case 20:
306
+ _context2.prev = 20;
307
+ _context2.t0 = _context2["catch"](12);
305
308
  this.logger.logError({
306
309
  title: 'sdk_event_sdkQuery_failed'
307
310
  }, {
@@ -311,11 +314,11 @@ export var EasySafePayProcessor = /*#__PURE__*/function () {
311
314
  rpcTraceId: _context2.t0 === null || _context2.t0 === void 0 ? void 0 : _context2.t0.traceId
312
315
  });
313
316
  return _context2.abrupt("return", null);
314
- case 20:
317
+ case 24:
315
318
  case "end":
316
319
  return _context2.stop();
317
320
  }
318
- }, _callee2, this, [[8, 16]]);
321
+ }, _callee2, this, [[12, 20]]);
319
322
  }));
320
323
  function processQuery() {
321
324
  return _processQuery.apply(this, arguments);
@@ -326,21 +329,21 @@ export var EasySafePayProcessor = /*#__PURE__*/function () {
326
329
  key: "processSubmitPay",
327
330
  value: function () {
328
331
  var _processSubmitPay = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
329
- var _this$paymentContext5, _this$paymentContext6, _this$paymentContext7, _this$channelBehavior2, _this$channelBehavior3, _this$paymentContext$7, _this$paymentContext8;
330
- var submitParams, _ref3, _ref3$productSceneVer, productSceneVersion, _ref4, _ref4$action, _ref4$action2, _ref4$action2$enableS, enableSignAgreement, _ref4$action2$autoDeb, autoDebitWithToken, _this$paymentContext$6, paymentMethodType, isAppWebview, backScheme, requestBizId, extParams, requester, _this$paymentContext$8, res;
332
+ var _this$paymentContext8, _this$paymentContext9, _this$paymentContext10, _this$channelBehavior2, _this$channelBehavior3, _this$paymentContext$8, _this$paymentContext11;
333
+ var submitParams, _ref3, _ref3$productSceneVer, productSceneVersion, _ref4, _ref4$action, _ref4$action2, _ref4$action2$enableS, enableSignAgreement, _ref4$action2$autoDeb, autoDebitWithToken, _this$paymentContext$7, paymentMethodType, isAppWebview, backScheme, requestBizId, extParams, requester, _this$paymentContext$9, res;
331
334
  return _regeneratorRuntime().wrap(function _callee3$(_context3) {
332
335
  while (1) switch (_context3.prev = _context3.next) {
333
336
  case 0:
334
337
  submitParams = {
335
- paymentSessionData: ((_this$paymentContext5 = this.paymentContext) === null || _this$paymentContext5 === void 0 ? void 0 : _this$paymentContext5.paymentSessionId) || '',
336
- paymentSessionConfig: (_this$paymentContext6 = this.paymentContext) === null || _this$paymentContext6 === void 0 || (_this$paymentContext6 = _this$paymentContext6.paymentSessionObj) === null || _this$paymentContext6 === void 0 ? void 0 : _this$paymentContext6.paymentSessionConfig
338
+ paymentSessionData: ((_this$paymentContext8 = this.paymentContext) === null || _this$paymentContext8 === void 0 ? void 0 : _this$paymentContext8.paymentSessionId) || '',
339
+ paymentSessionConfig: (_this$paymentContext9 = this.paymentContext) === null || _this$paymentContext9 === void 0 || (_this$paymentContext9 = _this$paymentContext9.paymentSessionObj) === null || _this$paymentContext9 === void 0 ? void 0 : _this$paymentContext9.paymentSessionConfig
337
340
  };
338
341
  _ref3 = submitParams.paymentSessionConfig || {}, _ref3$productSceneVer = _ref3.productSceneVersion, productSceneVersion = _ref3$productSceneVer === void 0 ? '' : _ref3$productSceneVer;
339
- _ref4 = ((_this$paymentContext7 = this.paymentContext) === null || _this$paymentContext7 === void 0 ? void 0 : _this$paymentContext7.paymentSessionObj) || {}, _ref4$action = _ref4.action, _ref4$action2 = _ref4$action === void 0 ? {} : _ref4$action, _ref4$action2$enableS = _ref4$action2.enableSignAgreement, enableSignAgreement = _ref4$action2$enableS === void 0 ? false : _ref4$action2$enableS, _ref4$action2$autoDeb = _ref4$action2.autoDebitWithToken, autoDebitWithToken = _ref4$action2$autoDeb === void 0 ? false : _ref4$action2$autoDeb;
342
+ _ref4 = ((_this$paymentContext10 = this.paymentContext) === null || _this$paymentContext10 === void 0 ? void 0 : _this$paymentContext10.paymentSessionObj) || {}, _ref4$action = _ref4.action, _ref4$action2 = _ref4$action === void 0 ? {} : _ref4$action, _ref4$action2$enableS = _ref4$action2.enableSignAgreement, enableSignAgreement = _ref4$action2$enableS === void 0 ? false : _ref4$action2$enableS, _ref4$action2$autoDeb = _ref4$action2.autoDebitWithToken, autoDebitWithToken = _ref4$action2$autoDeb === void 0 ? false : _ref4$action2$autoDeb;
340
343
  if (productSceneVersion === '2.0' && !autoDebitWithToken) {
341
344
  ///EasyPay 2.0 首次传signAgreement字段
342
345
  submitParams['signAgreement'] = enableSignAgreement;
343
- paymentMethodType = (_this$paymentContext$6 = this.paymentContext.paymentSessionObj) === null || _this$paymentContext$6 === void 0 || (_this$paymentContext$6 = _this$paymentContext$6.paymentMethodInfoView) === null || _this$paymentContext$6 === void 0 ? void 0 : _this$paymentContext$6.paymentMethodType;
346
+ paymentMethodType = (_this$paymentContext$7 = this.paymentContext.paymentSessionObj) === null || _this$paymentContext$7 === void 0 || (_this$paymentContext$7 = _this$paymentContext$7.paymentMethodInfoView) === null || _this$paymentContext$7 === void 0 ? void 0 : _this$paymentContext$7.paymentMethodType;
344
347
  isAppWebview = this.paymentContext.startBizFlowOptions.isAppWebview;
345
348
  if (paymentMethodType == 'ALIPAY_CN' && !isAppWebview) {
346
349
  backScheme = getBackScheme(undefined, this.logger);
@@ -371,11 +374,11 @@ export var EasySafePayProcessor = /*#__PURE__*/function () {
371
374
  extParams = ((_this$channelBehavior2 = this.channelBehavior) === null || _this$channelBehavior2 === void 0 || (_this$channelBehavior3 = _this$channelBehavior2.buildSubmitPayExtParams) === null || _this$channelBehavior3 === void 0 ? void 0 : _this$channelBehavior3.call(_this$channelBehavior2, {
372
375
  instanceId: this.instanceId,
373
376
  locale: this.initConfig.locale,
374
- paymentMethodType: (_this$paymentContext$7 = this.paymentContext.paymentSessionObj) === null || _this$paymentContext$7 === void 0 || (_this$paymentContext$7 = _this$paymentContext$7.paymentMethodInfoView) === null || _this$paymentContext$7 === void 0 ? void 0 : _this$paymentContext$7.paymentMethodType,
377
+ paymentMethodType: (_this$paymentContext$8 = this.paymentContext.paymentSessionObj) === null || _this$paymentContext$8 === void 0 || (_this$paymentContext$8 = _this$paymentContext$8.paymentMethodInfoView) === null || _this$paymentContext$8 === void 0 ? void 0 : _this$paymentContext$8.paymentMethodType,
375
378
  paymentSessionData: this.paymentContext.paymentSessionId,
376
379
  env: this.initConfig.environment,
377
380
  sdkVersion: this.paymentContext.sdkMetaData.sdkVersion,
378
- notRedirectAfterComplete: ((_this$paymentContext8 = this.paymentContext) === null || _this$paymentContext8 === void 0 || (_this$paymentContext8 = _this$paymentContext8.startBizFlowOptions) === null || _this$paymentContext8 === void 0 || (_this$paymentContext8 = _this$paymentContext8.submitPayRequestExtra) === null || _this$paymentContext8 === void 0 ? void 0 : _this$paymentContext8.notRedirectAfterComplete) === true
381
+ notRedirectAfterComplete: ((_this$paymentContext11 = this.paymentContext) === null || _this$paymentContext11 === void 0 || (_this$paymentContext11 = _this$paymentContext11.startBizFlowOptions) === null || _this$paymentContext11 === void 0 || (_this$paymentContext11 = _this$paymentContext11.submitPayRequestExtra) === null || _this$paymentContext11 === void 0 ? void 0 : _this$paymentContext11.notRedirectAfterComplete) === true
379
382
  })) || {}; // 二次支付不再需要该参数
380
383
  if (!autoDebitWithToken) {
381
384
  extParams.complianceSDK = true;
@@ -386,7 +389,7 @@ export var EasySafePayProcessor = /*#__PURE__*/function () {
386
389
  _context3.t0 = requester;
387
390
  _context3.t1 = _objectSpread(_objectSpread({}, submitParams), {}, {
388
391
  integrationType: 'SDK',
389
- sdkVersion: (_this$paymentContext$8 = this.paymentContext.sdkMetaData.sdkVersion) !== null && _this$paymentContext$8 !== void 0 ? _this$paymentContext$8 : '1.0.0'
392
+ sdkVersion: (_this$paymentContext$9 = this.paymentContext.sdkMetaData.sdkVersion) !== null && _this$paymentContext$9 !== void 0 ? _this$paymentContext$9 : '1.0.0'
390
393
  });
391
394
  _context3.t2 = this.initConfig.environment;
392
395
  _context3.t3 = this.SDK_REQUEST_TIMEOUT;
@@ -445,13 +448,13 @@ export var EasySafePayProcessor = /*#__PURE__*/function () {
445
448
  key: "acquireApdidToken",
446
449
  value: function () {
447
450
  var _acquireApdidToken = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
448
- var _this$paymentContext$9;
451
+ var _this$paymentContext$10;
449
452
  var securityService, productScene, deviceId;
450
453
  return _regeneratorRuntime().wrap(function _callee4$(_context4) {
451
454
  while (1) switch (_context4.prev = _context4.next) {
452
455
  case 0:
453
456
  securityService = ServiceProvider.getInstance(this.instanceId).getService('Security');
454
- productScene = (_this$paymentContext$9 = this.paymentContext.paymentSessionObj) === null || _this$paymentContext$9 === void 0 || (_this$paymentContext$9 = _this$paymentContext$9.paymentSessionConfig) === null || _this$paymentContext$9 === void 0 ? void 0 : _this$paymentContext$9.productScene;
457
+ productScene = (_this$paymentContext$10 = this.paymentContext.paymentSessionObj) === null || _this$paymentContext$10 === void 0 || (_this$paymentContext$10 = _this$paymentContext$10.paymentSessionConfig) === null || _this$paymentContext$10 === void 0 ? void 0 : _this$paymentContext$10.productScene;
455
458
  deviceId = securityService.getDeviceId({
456
459
  productScene: productScene
457
460
  });
@@ -471,15 +474,15 @@ export var EasySafePayProcessor = /*#__PURE__*/function () {
471
474
  key: "initSecuritySDK",
472
475
  value: function () {
473
476
  var _initSecuritySDK = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {
474
- var _this$paymentContext$10, _this$paymentContext$11, _this$paymentContext$12, _this$paymentContext$13, _this$paymentContext$14, _this$paymentContext$15, productSceneVersion, nonInitSecuritySDK, signButtonDisplay, userSignAgreement, isFirstTimeToPay, shouldInitSecuritySDK;
477
+ var _this$paymentContext$11, _this$paymentContext$12, _this$paymentContext$13, _this$paymentContext$14, _this$paymentContext$15, _this$paymentContext$16, productSceneVersion, nonInitSecuritySDK, signButtonDisplay, userSignAgreement, isFirstTimeToPay, shouldInitSecuritySDK;
475
478
  return _regeneratorRuntime().wrap(function _callee5$(_context5) {
476
479
  while (1) switch (_context5.prev = _context5.next) {
477
480
  case 0:
478
481
  _context5.prev = 0;
479
482
  productSceneVersion = this.paymentContext.paymentSessionObj.paymentSessionConfig.productSceneVersion;
480
- nonInitSecuritySDK = (_this$paymentContext$10 = (_this$paymentContext$11 = this.paymentContext.paymentSessionObj.action) === null || _this$paymentContext$11 === void 0 ? void 0 : _this$paymentContext$11.nonInitSecuritySDK) !== null && _this$paymentContext$10 !== void 0 ? _this$paymentContext$10 : false;
481
- signButtonDisplay = (_this$paymentContext$12 = (_this$paymentContext$13 = this.paymentContext.paymentSessionObj.action) === null || _this$paymentContext$13 === void 0 ? void 0 : _this$paymentContext$13.signButtonDisplay) !== null && _this$paymentContext$12 !== void 0 ? _this$paymentContext$12 : false;
482
- userSignAgreement = (_this$paymentContext$14 = (_this$paymentContext$15 = this.paymentContext.paymentSessionObj.action) === null || _this$paymentContext$15 === void 0 ? void 0 : _this$paymentContext$15.userSignAgreement) !== null && _this$paymentContext$14 !== void 0 ? _this$paymentContext$14 : false;
483
+ nonInitSecuritySDK = (_this$paymentContext$11 = (_this$paymentContext$12 = this.paymentContext.paymentSessionObj.action) === null || _this$paymentContext$12 === void 0 ? void 0 : _this$paymentContext$12.nonInitSecuritySDK) !== null && _this$paymentContext$11 !== void 0 ? _this$paymentContext$11 : false;
484
+ signButtonDisplay = (_this$paymentContext$13 = (_this$paymentContext$14 = this.paymentContext.paymentSessionObj.action) === null || _this$paymentContext$14 === void 0 ? void 0 : _this$paymentContext$14.signButtonDisplay) !== null && _this$paymentContext$13 !== void 0 ? _this$paymentContext$13 : false;
485
+ userSignAgreement = (_this$paymentContext$15 = (_this$paymentContext$16 = this.paymentContext.paymentSessionObj.action) === null || _this$paymentContext$16 === void 0 ? void 0 : _this$paymentContext$16.userSignAgreement) !== null && _this$paymentContext$15 !== void 0 ? _this$paymentContext$15 : false;
483
486
  isFirstTimeToPay = !this.paymentContext.paymentSessionObj.action.autoDebitWithToken;
484
487
  shouldInitSecuritySDK = false;
485
488
  if (nonInitSecuritySDK) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alipay/ams-checkout",
3
- "version": "0.0.1745808793-dev.5",
3
+ "version": "0.0.1745808793-dev.7",
4
4
  "description": "",
5
5
  "author": "",
6
6
  "main": "esm/index.js",