@alipay/ams-checkout 0.0.1732700846-dev.6 → 0.0.1732700846-dev.9

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.
@@ -198,6 +198,15 @@ export declare const EVENT: {
198
198
  initSecuritySDK: {
199
199
  name: string;
200
200
  };
201
+ closePaymentPolling: {
202
+ name: string;
203
+ };
204
+ onPollingEnd: {
205
+ name: string;
206
+ };
207
+ getApplePayToken: {
208
+ name: string;
209
+ };
201
210
  };
202
211
  export declare const COMPONENT_CONTAINER_ID = "ams-component-container";
203
212
  export declare const COMPONENT_SECTION_ID = "ams-component-section";
@@ -200,6 +200,15 @@ export var EVENT = {
200
200
  },
201
201
  initSecuritySDK: {
202
202
  name: 'initSecuritySDK'
203
+ },
204
+ closePaymentPolling: {
205
+ name: 'closePaymentPolling'
206
+ },
207
+ onPollingEnd: {
208
+ name: 'onPollingEnd'
209
+ },
210
+ getApplePayToken: {
211
+ name: 'getApplePayToken'
203
212
  }
204
213
  };
205
214
  export var COMPONENT_CONTAINER_ID = 'ams-component-container';
@@ -33,6 +33,7 @@ export declare class ElementComponent {
33
33
  private mountAuth;
34
34
  private mountAddress;
35
35
  private mountPayment;
36
+ mountErrorHandle(): void;
36
37
  mount(renderOptions: AddressMountOptions, sdkSelector: string): AddressMountResult;
37
38
  mount(renderOptions: PaymentMountOptions, sdkSelector: string): PaymentMountResult;
38
39
  mount(renderOptions: LinkAuthMountOptions, sdkSelector: string): LinkAuthMountResult;
@@ -27,6 +27,8 @@ import { ElementPaymentComponent } from "./components/payment";
27
27
  // import { oneAccount, sdkAction, submitResult } from './mock';
28
28
  import { v4 as uuid } from 'uuid';
29
29
  import { addressTheme, ELEMENT_ENVIRONMENT, ThemeType } from "./type";
30
+ import { LogConfig, Logger } from "../../../util/logger";
31
+ var logger = new Logger(LogConfig, true);
30
32
  var ElementProcessor = /*#__PURE__*/function () {
31
33
  function ElementProcessor(options) {
32
34
  _classCallCheck(this, ElementProcessor);
@@ -210,12 +212,7 @@ export var ElementComponent = /*#__PURE__*/function () {
210
212
  elementProps: renderOptions.elementProps
211
213
  }, _mountParams)).then(function (result) {
212
214
  if (!result) {
213
- var _this4$_options$onEve, _this4$_options2;
214
- (_this4$_options$onEve = (_this4$_options2 = _this4._options).onEventCallback) === null || _this4$_options$onEve === void 0 || _this4$_options$onEve.call(_this4$_options2, {
215
- code: EventCallbackCode.Failed,
216
- message: 'Address Component loading failed'
217
- });
218
- return undefined;
215
+ return _this4.mountErrorHandle();
219
216
  }
220
217
  _this4.eventService.addIFrame(result);
221
218
  _this4.iframes[ElementPaymentMethod.ADDRESS_ELEMENT] = result;
@@ -228,9 +225,9 @@ export var ElementComponent = /*#__PURE__*/function () {
228
225
  });
229
226
  // 渲染卡支付组件
230
227
  _defineProperty(this, "mountPayment", function (renderOptions, sdkSelector) {
231
- var _this4$_options3;
228
+ var _this4$_options2;
232
229
  var _mountParams = {
233
- appearance: renderOptions.appearance || ((_this4$_options3 = _this4._options) === null || _this4$_options3 === void 0 ? void 0 : _this4$_options3.appearance) || {
230
+ appearance: renderOptions.appearance || ((_this4$_options2 = _this4._options) === null || _this4$_options2 === void 0 ? void 0 : _this4$_options2.appearance) || {
234
231
  theme: ThemeType.Default
235
232
  }
236
233
  };
@@ -240,12 +237,7 @@ export var ElementComponent = /*#__PURE__*/function () {
240
237
  elementProps: renderOptions.elementProps
241
238
  }, _mountParams)).then(function (result) {
242
239
  if (!result) {
243
- var _this4$_options$onEve2, _this4$_options4;
244
- (_this4$_options$onEve2 = (_this4$_options4 = _this4._options).onEventCallback) === null || _this4$_options$onEve2 === void 0 || _this4$_options$onEve2.call(_this4$_options4, {
245
- code: EventCallbackCode.Failed,
246
- message: 'Payment Component loading failed'
247
- });
248
- return undefined;
240
+ return _this4.mountErrorHandle();
249
241
  }
250
242
  _this4.eventService.addIFrame(result);
251
243
  _this4.iframes[ElementPaymentMethod.PAYMENT_ELEMENT] = result;
@@ -341,7 +333,7 @@ export var ElementComponent = /*#__PURE__*/function () {
341
333
  _defineProperty(this, "validatePromiseFuncs", function () {
342
334
  return new Promise( /*#__PURE__*/function () {
343
335
  var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(resolve) {
344
- var params, _result$data, _result$data2, result, _result$data3, _result$data4, _result, _result2$data, _result2$data2, _result2$data3, _result2;
336
+ var params, _result$data, _result$data2, result, _result$data3, _result$data4, _result, _result2$data, _result2;
345
337
  return _regeneratorRuntime().wrap(function _callee$(_context) {
346
338
  while (1) switch (_context.prev = _context.next) {
347
339
  case 0:
@@ -379,7 +371,7 @@ export var ElementComponent = /*#__PURE__*/function () {
379
371
  return _context.abrupt("return", resolve(undefined));
380
372
  case 17:
381
373
  if (!(_this4.launchSource.includes(ElementPaymentMethod.PAYMENT_ELEMENT) || !_this4.isConnect)) {
382
- _context.next = 32;
374
+ _context.next = 30;
383
375
  break;
384
376
  }
385
377
  _context.prev = 18;
@@ -388,29 +380,29 @@ export var ElementComponent = /*#__PURE__*/function () {
388
380
  case 21:
389
381
  _result2 = _context.sent;
390
382
  console.log('element submit validate payment---------', _result2, _this4.isConnect);
391
- params.paymentFactors = (_result2$data = _result2.data) === null || _result2$data === void 0 || (_result2$data = _result2$data.data) === null || _result2$data === void 0 ? void 0 : _result2$data.paymentFactors;
392
- params.paymentMethod = (_result2$data2 = _result2.data) === null || _result2$data2 === void 0 || (_result2$data2 = _result2$data2.data) === null || _result2$data2 === void 0 ? void 0 : _result2$data2.paymentMethod;
393
- if (_result2 !== null && _result2 !== void 0 && (_result2$data3 = _result2.data) !== null && _result2$data3 !== void 0 && _result2$data3.success) {
394
- _context.next = 27;
383
+ // params.paymentFactors = result.data?.data?.paymentFactors;
384
+ // params.paymentMethod = result.data?.data?.paymentMethod;
385
+ if (_result2 !== null && _result2 !== void 0 && (_result2$data = _result2.data) !== null && _result2$data !== void 0 && _result2$data.success) {
386
+ _context.next = 25;
395
387
  break;
396
388
  }
397
389
  return _context.abrupt("return", resolve(undefined));
398
- case 27:
399
- _context.next = 32;
390
+ case 25:
391
+ _context.next = 30;
400
392
  break;
401
- case 29:
402
- _context.prev = 29;
393
+ case 27:
394
+ _context.prev = 27;
403
395
  _context.t0 = _context["catch"](18);
404
396
  return _context.abrupt("return", resolve(undefined));
405
- case 32:
397
+ case 30:
406
398
  // params.paymentFactors = paymentResult.data?.data.paymentFactors;
407
399
  // params.paymentMethod = paymentResult.data?.data.paymentMethod;
408
400
  resolve(params);
409
- case 33:
401
+ case 31:
410
402
  case "end":
411
403
  return _context.stop();
412
404
  }
413
- }, _callee, null, [[18, 29]]);
405
+ }, _callee, null, [[18, 27]]);
414
406
  }));
415
407
  return function (_x) {
416
408
  return _ref.apply(this, arguments);
@@ -426,6 +418,9 @@ export var ElementComponent = /*#__PURE__*/function () {
426
418
  this.componentsCount = 0;
427
419
  this.iframes = {};
428
420
  this.mountOptions = {};
421
+ logger.logInfo({
422
+ title: 'a3753.b101271.c386688'
423
+ });
429
424
  this.createElement();
430
425
  }
431
426
 
@@ -442,10 +437,10 @@ export var ElementComponent = /*#__PURE__*/function () {
442
437
  sessionData = _parseSessionData2[1];
443
438
  this.parseData = parseData;
444
439
  this.sessionData = sessionData;
445
- this.isConnect = ((_parseData$connectFac = parseData.connectFactor) === null || _parseData$connectFac === void 0 ? void 0 : _parseData$connectFac.enableConnect) && (parseData === null || parseData === void 0 || (_parseData$paymentSes = parseData.paymentSessionConfig) === null || _parseData$paymentSes === void 0 ? void 0 : _parseData$paymentSes.productScene) === ProductSceneEnum.ELEMENT_PAYMENT;
440
+ this.isConnect = (parseData === null || parseData === void 0 || (_parseData$connectFac = parseData.connectFactor) === null || _parseData$connectFac === void 0 ? void 0 : _parseData$connectFac.enableConnect) && (parseData === null || parseData === void 0 || (_parseData$paymentSes = parseData.paymentSessionConfig) === null || _parseData$paymentSes === void 0 ? void 0 : _parseData$paymentSes.productScene) === ProductSceneEnum.ELEMENT_PAYMENT;
446
441
  this.elementContainer = new AntomSDKCore();
447
442
  this.elementContainer.registerProcessor(ProductSceneEnum.ELEMENT_PAYMENT, '', new ElementProcessor({
448
- paymentSessionConfig: parseData.paymentSessionConfig,
443
+ paymentSessionConfig: parseData === null || parseData === void 0 ? void 0 : parseData.paymentSessionConfig,
449
444
  sessionData: sessionData,
450
445
  environment: this._options.environment,
451
446
  locale: this._options.locale,
@@ -459,15 +454,19 @@ export var ElementComponent = /*#__PURE__*/function () {
459
454
  if (!_this5.isConnect) return;
460
455
  var bizFlowBehavior = _this5.elementContainer.getBizFlowBehavior();
461
456
  if (!(bizFlowBehavior !== null && bizFlowBehavior !== void 0 && (_bizFlowBehavior$data = bizFlowBehavior.data) !== null && _bizFlowBehavior$data !== void 0 && _bizFlowBehavior$data.success)) {
462
- var _this5$_options, _this5$_options$onEve, _bizFlowBehavior$data2;
457
+ var _this5$_options, _this5$_options$onEve;
458
+ console.log('demo event callback----', {
459
+ code: EventCallbackCode.FAILED,
460
+ message: 'INTERNAL_FAILED'
461
+ });
463
462
  _this5 === null || _this5 === void 0 || (_this5$_options = _this5._options) === null || _this5$_options === void 0 || (_this5$_options$onEve = _this5$_options.onEventCallback) === null || _this5$_options$onEve === void 0 || _this5$_options$onEve.call(_this5$_options, {
464
- code: EventCallbackCode.Failed,
465
- message: (bizFlowBehavior === null || bizFlowBehavior === void 0 || (_bizFlowBehavior$data2 = bizFlowBehavior.data) === null || _bizFlowBehavior$data2 === void 0 ? void 0 : _bizFlowBehavior$data2.errorMsg) || 'start biz flow fail, please retry.'
463
+ code: EventCallbackCode.FAILED,
464
+ message: 'INTERNAL_FAILED'
466
465
  });
467
466
  } else {
468
- var _bizFlowBehavior$data3, _bizFlowBehavior$data4;
469
- _this5.oneAccountRes = bizFlowBehavior === null || bizFlowBehavior === void 0 || (_bizFlowBehavior$data3 = bizFlowBehavior.data) === null || _bizFlowBehavior$data3 === void 0 ? void 0 : _bizFlowBehavior$data3.oneAccountRes;
470
- _this5.sdkActionRes = bizFlowBehavior === null || bizFlowBehavior === void 0 || (_bizFlowBehavior$data4 = bizFlowBehavior.data) === null || _bizFlowBehavior$data4 === void 0 ? void 0 : _bizFlowBehavior$data4.sdkActionRes;
467
+ var _bizFlowBehavior$data2, _bizFlowBehavior$data3;
468
+ _this5.oneAccountRes = bizFlowBehavior === null || bizFlowBehavior === void 0 || (_bizFlowBehavior$data2 = bizFlowBehavior.data) === null || _bizFlowBehavior$data2 === void 0 ? void 0 : _bizFlowBehavior$data2.oneAccountRes;
469
+ _this5.sdkActionRes = bizFlowBehavior === null || bizFlowBehavior === void 0 || (_bizFlowBehavior$data3 = bizFlowBehavior.data) === null || _bizFlowBehavior$data3 === void 0 ? void 0 : _bizFlowBehavior$data3.sdkActionRes;
471
470
  _this5.afterInit();
472
471
  }
473
472
  });
@@ -499,9 +498,14 @@ export var ElementComponent = /*#__PURE__*/function () {
499
498
  }, this.isConnect);
500
499
  } catch (error) {
501
500
  var _this$_options$onEven, _this$_options;
501
+ console.log('demo event callback----', {
502
+ code: EventCallbackCode.FAILED,
503
+ message: 'INTERNAL_FAILED'
504
+ });
502
505
  (_this$_options$onEven = (_this$_options = this._options).onEventCallback) === null || _this$_options$onEven === void 0 || _this$_options$onEven.call(_this$_options, {
503
- code: EventCallbackCode.Failed,
504
- message: 'create sdk fail'
506
+ code: EventCallbackCode.FAILED,
507
+ message: 'INTERNAL_FAILED'
508
+ // message: 'create sdk fail',
505
509
  });
506
510
  }
507
511
 
@@ -562,6 +566,11 @@ export var ElementComponent = /*#__PURE__*/function () {
562
566
  (_this6 === null || _this6 === void 0 ? void 0 : _this6.authBase) && (_this6 === null || _this6 === void 0 || (_this6$authBase = _this6.authBase) === null || _this6$authBase === void 0 ? void 0 : _this6$authBase.update(result.data.height));
563
567
  }
564
568
  });
569
+ this.eventService.listen(ElementPaymentEvent.SEND_MUITI_APP_EVENT_TO_SDK, function (result) {
570
+ var _this6$_options$onEve, _this6$_options;
571
+ console.log('demo event callback----', result.data);
572
+ (_this6$_options$onEve = (_this6$_options = _this6._options).onEventCallback) === null || _this6$_options$onEve === void 0 || _this6$_options$onEve.call(_this6$_options, result.data);
573
+ });
565
574
  this.eventService.listen(ElementPaymentEvent.CALLBACK, function (result) {
566
575
  var _this6$eventCallback;
567
576
  console.log('antom sdk 组件事件回调');
@@ -689,31 +698,40 @@ export var ElementComponent = /*#__PURE__*/function () {
689
698
  url: url
690
699
  }).then(function (result) {
691
700
  if (!result) {
692
- var _this8$_options$onEve, _this8$_options;
693
- (_this8$_options$onEve = (_this8$_options = _this8._options).onEventCallback) === null || _this8$_options$onEve === void 0 || _this8$_options$onEve.call(_this8$_options, {
694
- code: EventCallbackCode.Failed,
695
- message: 'Auth Component loading failed'
696
- });
697
- return undefined;
701
+ return _this8.mountErrorHandle();
698
702
  }
699
703
  _this8.eventService.addIFrame(result);
700
704
  _this8.iframes[ElementPaymentMethod.AUTH_ELEMENT] = result;
701
705
  });
702
706
  return {};
703
707
  }
708
+ }, {
709
+ key: "mountErrorHandle",
710
+ value: function mountErrorHandle() {
711
+ var _this$_options$onEven2, _this$_options3;
712
+ console.log('demo event callback----', {
713
+ code: EventCallbackCode.FAILED,
714
+ message: 'INTERNAL_FAILED'
715
+ });
716
+ (_this$_options$onEven2 = (_this$_options3 = this._options).onEventCallback) === null || _this$_options$onEven2 === void 0 || _this$_options$onEven2.call(_this$_options3, {
717
+ code: EventCallbackCode.FAILED,
718
+ message: 'INTERNAL_FAILED'
719
+ });
720
+ logger.logError({
721
+ title: 'a3753.b101271.c386691'
722
+ });
723
+ }
704
724
  }, {
705
725
  key: "mount",
706
726
  value: function mount(renderOptions, sdkSelector) {
727
+ logger.logInfo({
728
+ title: 'a3753.b101271.c386690'
729
+ });
707
730
  if (typeof sdkSelector === 'string') {
708
731
  var _this$_options$loadin4, _renderOptions$debugP, _renderOptions$debugP2;
709
732
  var element = document.querySelector(sdkSelector);
710
733
  if (!element) {
711
- var _this$_options$onEven2, _this$_options3;
712
- (_this$_options$onEven2 = (_this$_options3 = this._options).onEventCallback) === null || _this$_options$onEven2 === void 0 || _this$_options$onEven2.call(_this$_options3, {
713
- code: EventCallbackCode.Failed,
714
- message: 'Unable to obtain selector'
715
- });
716
- return undefined;
734
+ return this.mountErrorHandle();
717
735
  }
718
736
  this.componentsCount = this.componentsCount + 1;
719
737
  if (!this.loading && (_this$_options$loadin4 = this._options.loading) !== null && _this$_options$loadin4 !== void 0 && _this$_options$loadin4.onStartLoading && this.isConnect) {
@@ -735,11 +753,7 @@ export var ElementComponent = /*#__PURE__*/function () {
735
753
  return this.mountPayment(renderOptions, sdkSelector);
736
754
  }
737
755
  } else {
738
- this._options.onEventCallback({
739
- code: EventCallbackCode.Failed,
740
- message: 'Invalid argument for mount method'
741
- });
742
- return undefined;
756
+ return this.mountErrorHandle();
743
757
  }
744
758
  }
745
759
 
@@ -777,7 +791,7 @@ export var ElementComponent = /*#__PURE__*/function () {
777
791
  function () {
778
792
  var _submitPayment = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
779
793
  var _this$_options$loadin7, _this$_options$loadin10;
780
- var _this$_options$loadin8, _this$_options$loadin9, validateRes, _this$_options$loadin11, _this$_options$loadin12;
794
+ var _this$_options$loadin8, _this$_options$loadin9, _this$_options$loadin11, _this$_options$loadin12;
781
795
  return _regeneratorRuntime().wrap(function _callee2$(_context2) {
782
796
  while (1) switch (_context2.prev = _context2.next) {
783
797
  case 0:
@@ -789,19 +803,11 @@ export var ElementComponent = /*#__PURE__*/function () {
789
803
  _context2.next = 3;
790
804
  return this.validatePromiseFuncs();
791
805
  case 3:
792
- validateRes = _context2.sent;
793
- if (!validateRes) {
794
- _context2.next = 7;
795
- break;
796
- }
797
- _context2.next = 7;
798
- return this.onSubmit(validateRes);
799
- case 7:
800
806
  if ((_this$_options$loadin10 = this._options.loading) !== null && _this$_options$loadin10 !== void 0 && _this$_options$loadin10.onEndLoading) {
801
807
  (_this$_options$loadin11 = this._options.loading) === null || _this$_options$loadin11 === void 0 || (_this$_options$loadin12 = _this$_options$loadin11.onEndLoading) === null || _this$_options$loadin12 === void 0 || _this$_options$loadin12.call(_this$_options$loadin11);
802
808
  }
803
809
  return _context2.abrupt("return");
804
- case 9:
810
+ case 5:
805
811
  case "end":
806
812
  return _context2.stop();
807
813
  }
@@ -12,8 +12,8 @@ export declare const addressTheme: {
12
12
  night: string;
13
13
  };
14
14
  export declare enum EventCallbackCode {
15
- Failed = "Failed",
16
- Completed = "Completed"
15
+ FAILED = "FAILED",
16
+ SUCCESS = "SUCCESS"
17
17
  }
18
18
  export declare enum ELEMENT_ENVIRONMENT {
19
19
  DEV = "DEV",
@@ -13,8 +13,8 @@ export var ThemeType = /*#__PURE__*/function (ThemeType) {
13
13
  }({});
14
14
  export var addressTheme = _defineProperty(_defineProperty({}, ThemeType.Default, 'LIGHT'), ThemeType.Night, 'NIGHT');
15
15
  export var EventCallbackCode = /*#__PURE__*/function (EventCallbackCode) {
16
- EventCallbackCode["Failed"] = "Failed";
17
- EventCallbackCode["Completed"] = "Completed";
16
+ EventCallbackCode["FAILED"] = "FAILED";
17
+ EventCallbackCode["SUCCESS"] = "SUCCESS";
18
18
  return EventCallbackCode;
19
19
  }({});
20
20
  export var ELEMENT_ENVIRONMENT = /*#__PURE__*/function (ELEMENT_ENVIRONMENT) {
@@ -178,7 +178,7 @@ export var AntomSDKCore = /*#__PURE__*/function () {
178
178
  key: "startBizFlow",
179
179
  value: function () {
180
180
  var _startBizFlow = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(options) {
181
- var _this$paymentContext$, _this$paymentContext$2;
181
+ var _this$paymentContext$, _this$paymentContext$2, _this$paymentContext$3;
182
182
  var paymentSession, displayInfo, _convertPaymentSessio, paymentSessionId, paymentSessionMetaData, mid, webAppMatchConfig, webAppVersion, productScene, paymentMethod, _this$bizFlowStartBeh, payload;
183
183
  return _regeneratorRuntime().wrap(function _callee3$(_context3) {
184
184
  while (1) switch (_context3.prev = _context3.next) {
@@ -201,7 +201,7 @@ export var AntomSDKCore = /*#__PURE__*/function () {
201
201
  sdkMetaData: this.sdkMetaData
202
202
  };
203
203
  // upgrade WebApp version
204
- mid = this.paymentContext.paymentSessionObj.clientId;
204
+ mid = (_this$paymentContext$ = this.paymentContext.paymentSessionObj) === null || _this$paymentContext$ === void 0 ? void 0 : _this$paymentContext$.clientId;
205
205
  webAppMatchConfig = parseWebAppMatchConfig(this.paymentContext.paymentSessionObj.extendInfo);
206
206
  webAppVersion = getWebAppVersion(this.sdkMetaData, mid, webAppMatchConfig);
207
207
  this.sdkMetaData.webAppVersion = webAppVersion;
@@ -211,8 +211,8 @@ export var AntomSDKCore = /*#__PURE__*/function () {
211
211
  ServiceProvider.getInstance(this.instanceId).update(this.paymentContext);
212
212
 
213
213
  // Invoke processor
214
- productScene = (_this$paymentContext$ = this.paymentContext.paymentSessionObj) === null || _this$paymentContext$ === void 0 || (_this$paymentContext$ = _this$paymentContext$.paymentSessionConfig) === null || _this$paymentContext$ === void 0 ? void 0 : _this$paymentContext$.productScene;
215
- paymentMethod = (_this$paymentContext$2 = this.paymentContext.paymentSessionObj) === null || _this$paymentContext$2 === void 0 || (_this$paymentContext$2 = _this$paymentContext$2.paymentMethodInfoView) === null || _this$paymentContext$2 === void 0 ? void 0 : _this$paymentContext$2.paymentMethodType;
214
+ productScene = (_this$paymentContext$2 = this.paymentContext.paymentSessionObj) === null || _this$paymentContext$2 === void 0 || (_this$paymentContext$2 = _this$paymentContext$2.paymentSessionConfig) === null || _this$paymentContext$2 === void 0 ? void 0 : _this$paymentContext$2.productScene;
215
+ paymentMethod = (_this$paymentContext$3 = this.paymentContext.paymentSessionObj) === null || _this$paymentContext$3 === void 0 || (_this$paymentContext$3 = _this$paymentContext$3.paymentMethodInfoView) === null || _this$paymentContext$3 === void 0 ? void 0 : _this$paymentContext$3.paymentMethodType;
216
216
  _context3.prev = 13;
217
217
  if (!this.productProcessors["".concat(productScene, "|").concat(paymentMethod)]) {
218
218
  _context3.next = 20;
@@ -37,8 +37,8 @@ export interface IApplePayPaymentContact {
37
37
  countryCode: string;
38
38
  }
39
39
  export type IApplePayLineItemType = 'final' | 'pending';
40
- export type ApplePayPaymentTiming = "immediate" | "recurring" | "deferred" | "automaticReload";
41
- export type ApplePayRecurringPaymentDateUnit = "year" | "month" | "day" | "hour" | "minute";
40
+ export type ApplePayPaymentTiming = 'immediate' | 'recurring' | 'deferred' | 'automaticReload';
41
+ export type ApplePayRecurringPaymentDateUnit = 'year' | 'month' | 'day' | 'hour' | 'minute';
42
42
  /**
43
43
  *
44
44
  {
@@ -1,4 +1,5 @@
1
- import type { EventPayload, IPaymentSessionMetaData } from '../../types';
1
+ import { EventPayloadContext, type EventPayload, type IPaymentMethod, type IPaymentSessionMetaData } from '../../types';
2
+ import { Logger } from '../../util/logger';
2
3
  export type IChannelBehavior = {
3
4
  usePaymentSessionAsQueryResult: boolean;
4
5
  submitPayInSdk: boolean;
@@ -18,4 +19,43 @@ type GetDoubleFaParams = {
18
19
  export declare function getChannelBehavior(paymentSessionMetaData?: IPaymentSessionMetaData): IChannelBehavior | undefined;
19
20
  export declare function getDoubleFaUrl(params: GetDoubleFaParams): string;
20
21
  export declare const handleGooglePay: (data: EventPayload) => Promise<unknown>;
22
+ export declare class ApplePayService {
23
+ private APPLESDKURL;
24
+ private applePaySession;
25
+ private paymentSessionData;
26
+ private sessionResult;
27
+ /**
28
+ * @description 支付状态,pending:支付中,normal:正常
29
+ */
30
+ private paymentStatus;
31
+ /**
32
+ * @description paymentRequest
33
+ */
34
+ private paymentRequest;
35
+ private logger;
36
+ private dispatchToApp;
37
+ private paymentMethod;
38
+ constructor({ sessionData, paymentSessionMetaData, paymentMethod, logger, dispatchToApp, }: {
39
+ sessionData: string;
40
+ paymentSessionMetaData: IPaymentSessionMetaData;
41
+ paymentMethod: IPaymentMethod;
42
+ logger: Logger;
43
+ dispatchToApp: (payload: {
44
+ context: EventPayloadContext;
45
+ }) => void;
46
+ });
47
+ private startPay;
48
+ private setApplePayStatus;
49
+ private submitPay;
50
+ submit(): Promise<void>;
51
+ private getDeviceId;
52
+ private initApplePaySession;
53
+ private isCanMakePayments;
54
+ private loadApplePaySdk;
55
+ private abortPaySession;
56
+ private addEventListener;
57
+ private get initSessionParams();
58
+ private get isRequiredParameters();
59
+ private get checkScriptIsLoaded();
60
+ }
21
61
  export {};