@alipay/ams-checkout 0.0.1734681171-dev.0 → 0.0.1735610050-dev.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.
@@ -5,10 +5,10 @@ export declare const sdkVersion: string;
5
5
  /**
6
6
  * @description: 目前应用层分为v1和v2,会存在两个应用版本号不是同步发布的情况。所以需要把默认的应用版本号配置抽离出来。
7
7
  */
8
- export declare const AMSCheckoutAppVersion = "1.26.1";
9
- export declare const AMSAutoDebitAppVersion = "1.26.1";
10
- export declare const AMSEasyPayAppVersion = "1.26.1";
11
- export declare const AMSCashierPaymentAppVersion = "1.26.1";
12
- export declare const AMSVaultingAppVersion = "1.26.1";
13
- export declare const AMSPaymentElementAppVersion = "1.26.1";
14
- export declare const ADDRESSElementAppVersion = "1.26.1";
8
+ export declare const AMSCheckoutAppVersion = "1.26.0";
9
+ export declare const AMSAutoDebitAppVersion = "1.26.0";
10
+ export declare const AMSEasyPayAppVersion = "1.26.0";
11
+ export declare const AMSCashierPaymentAppVersion = "1.26.0";
12
+ export declare const AMSVaultingAppVersion = "1.26.0";
13
+ export declare const AMSPaymentElementAppVersion = "1.26.0";
14
+ export declare const ADDRESSElementAppVersion = "1.26.0";
@@ -6,25 +6,13 @@
6
6
  * 2. If applicable, the use of the Software is also subject to the terms and conditions of any non-disclosure agreement signed by you and the relevant Ant Group entity.
7
7
  */
8
8
  import json from "../../package.json";
9
-
10
- /*
11
- export const marmotMap: Record<string, string> = {
9
+ export var marmotMap = {
12
10
  dev: 'http://page.alipay.net/page/antom-web-checkout/src/component-app',
13
11
  sit: 'http://page.test.alipay.net/page/antom-web-checkout/src/component-app',
14
12
  pre: 'https://pre.ac.alipay.com/page/antom-web-checkout/src/component-app',
15
13
  sandbox: 'https://ac.alipay.com/page/antom-web-checkout/src/component-app',
16
14
  light_sandbox: 'https://ac.alipay.com/page/antom-web-checkout/src/component-app',
17
- prod: 'https://ac.alipay.com/page/antom-web-checkout/src/component-app',
18
- };
19
- */
20
-
21
- // FIXME: for popmart test
22
- export var marmotMap = {
23
- dev: 'http://dev.page.alipay.net/page/antom-web-checkout/feat-small-font-size/src/component-app',
24
- pre: 'https://pre.ac.alipay.com/page/antom-web-checkout/feat-small-font-size/src/component-app',
25
- sandbox: 'https://pre.ac.alipay.com/page/antom-web-checkout/feat-small-font-size/src/component-app',
26
- light_sandbox: 'https://pre.ac.alipay.com/page/antom-web-checkout/feat-small-font-size/src/component-app',
27
- prod: 'https://pre.ac.alipay.com/page/antom-web-checkout/feat-small-font-size/src/component-app'
15
+ prod: 'https://ac.alipay.com/page/antom-web-checkout/src/component-app'
28
16
  };
29
17
  export var marmotConfigMap = {
30
18
  dev: 'https://config-dev.marmot-cloud.com/config/data/antom-sdk-config/en_US.json',
@@ -47,10 +35,10 @@ export var sdkVersion = json.version;
47
35
  /**
48
36
  * @description: 目前应用层分为v1和v2,会存在两个应用版本号不是同步发布的情况。所以需要把默认的应用版本号配置抽离出来。
49
37
  */
50
- export var AMSCheckoutAppVersion = '1.26.1'; // 兜底版本号
51
- export var AMSAutoDebitAppVersion = '1.26.1'; // 代扣
52
- export var AMSEasyPayAppVersion = '1.26.1'; // easypay
53
- export var AMSCashierPaymentAppVersion = '1.26.1'; // 收银台(卡、apm)
54
- export var AMSVaultingAppVersion = '1.26.1'; // 绑卡
55
- export var AMSPaymentElementAppVersion = '1.26.1'; // payment element
56
- export var ADDRESSElementAppVersion = '1.26.1'; // address element
38
+ export var AMSCheckoutAppVersion = '1.26.0'; // 兜底版本号
39
+ export var AMSAutoDebitAppVersion = '1.26.0'; // 代扣
40
+ export var AMSEasyPayAppVersion = '1.26.0'; // easypay
41
+ export var AMSCashierPaymentAppVersion = '1.26.0'; // 收银台(卡、apm)
42
+ export var AMSVaultingAppVersion = '1.26.0'; // 绑卡
43
+ export var AMSPaymentElementAppVersion = '1.26.0'; // payment element
44
+ export var ADDRESSElementAppVersion = '1.26.0'; // address element
@@ -198,6 +198,9 @@ export declare const EVENT: {
198
198
  initSecuritySDK: {
199
199
  name: string;
200
200
  };
201
+ getApplePayToken: {
202
+ name: string;
203
+ };
201
204
  };
202
205
  export declare const COMPONENT_CONTAINER_ID = "ams-component-container";
203
206
  export declare const COMPONENT_SECTION_ID = "ams-component-section";
@@ -200,6 +200,9 @@ export var EVENT = {
200
200
  },
201
201
  initSecuritySDK: {
202
202
  name: 'initSecuritySDK'
203
+ },
204
+ getApplePayToken: {
205
+ name: 'getApplePayToken'
203
206
  }
204
207
  };
205
208
  export var COMPONENT_CONTAINER_ID = 'ams-component-container';
@@ -640,7 +640,7 @@ export var ElementComponent = /*#__PURE__*/function () {
640
640
  params.queryResult = _this7.sdkActionRes;
641
641
  }
642
642
  _this7.eventService.emitAndListen({
643
- event: ElementPaymentEvent.INITIAL_DATA_READY,
643
+ event: ElementPaymentEvent.RENDER_COMPONENT,
644
644
  data: {
645
645
  target: target,
646
646
  source: ElementPaymentMethod.CONTAINER_ELEMENT,
@@ -1,4 +1,6 @@
1
1
  export declare const sdkAction: any;
2
+ export declare const oneAccount1: any;
3
+ export declare const oneAccount2: any;
2
4
  export declare const oneAccount: any;
3
5
  export declare const paymentResult: any;
4
6
  export declare const submitResult: any;
@@ -361,7 +361,7 @@ export var sdkAction = {
361
361
  },
362
362
  success: true
363
363
  };
364
- export var oneAccount = {
364
+ export var oneAccount1 = {
365
365
  accountInfo: {
366
366
  accountStatus: 'EFFECTIVE',
367
367
  email: 'test10@test.com',
@@ -375,7 +375,23 @@ export var oneAccount = {
375
375
  },
376
376
  errorActions: {},
377
377
  extendInfo: {},
378
- paymentMethods: [],
378
+ paymentMethods: [{
379
+ paymentMethodType: 'CARD',
380
+ iconName: 'VISA',
381
+ icon: 'https://cdn.marmot-cloud.com/storage/2022/8/2/bc7cb991-c8e2-4379-945f-aadae2bdf932.svg',
382
+ paymentMethodId: 'card-id',
383
+ paymentMethodDetail: {
384
+ last4: '**** 1233'
385
+ }
386
+ }, {
387
+ paymentMethodType: 'CARD',
388
+ iconName: 'VISA2',
389
+ icon: 'https://cdn.marmot-cloud.com/storage/2022/8/2/bc7cb991-c8e2-4379-945f-aadae2bdf932.svg',
390
+ paymentMethodId: 'card-id2',
391
+ paymentMethodDetail: {
392
+ last4: '**** 1235'
393
+ }
394
+ }],
379
395
  shippings: [{
380
396
  notes: '',
381
397
  prefer: '1',
@@ -397,6 +413,66 @@ export var oneAccount = {
397
413
  }],
398
414
  success: true
399
415
  };
416
+ export var oneAccount2 = {
417
+ accountInfo: {
418
+ email: 'xxxxx@163.com',
419
+ accountStatus: 'UNREGISTERED'
420
+ },
421
+ goods: {
422
+ goodsName: 'xxxxx@163.com',
423
+ goodsImageUrl: '',
424
+ goodsQuantity: 100,
425
+ goodsUnitAmount: {
426
+ currency: 'EUR',
427
+ value: 100,
428
+ currencyLabel: ''
429
+ }
430
+ },
431
+ paymentMethods: [],
432
+ links: {
433
+ privacyLink: 'https://global.alipay.com/docs/ac/Platform/bahzqeb-',
434
+ cookieLink: 'https://global.alipay.com/docs/ac/Platform/x1rhufzj'
435
+ },
436
+ metaData: {
437
+ countryList: [{
438
+ countryName: 'China',
439
+ default: true
440
+ }, {
441
+ countryName: 'Singapore',
442
+ default: false
443
+ }]
444
+ },
445
+ errorActions: {},
446
+ extendInfo: {},
447
+ merchantId: '111xT8bLnciQgqcy20+oOJoWUEbPMTwI0YILNBIicpASIs=',
448
+ needInstallmentAbility: false,
449
+ needOtherElements: false,
450
+ orderDescription: 'AMSDM_GIFT',
451
+ success: true,
452
+ supportedLanguages: [{
453
+ locale: 'en_US',
454
+ preferred: true,
455
+ title: 'English'
456
+ }, {
457
+ country: 'BR',
458
+ locale: 'pt_BR',
459
+ preferred: false,
460
+ title: 'Português'
461
+ }, {
462
+ country: 'KR',
463
+ locale: 'ko_KR',
464
+ preferred: false,
465
+ title: '한국어'
466
+ }, {
467
+ country: 'MX,CL,PE',
468
+ locale: 'es_ES',
469
+ preferred: false,
470
+ title: 'Español'
471
+ }]
472
+ };
473
+ export var oneAccount = oneAccount1;
474
+ // export const oneAccount = oneAccount2;
475
+
400
476
  export var paymentResult = {
401
477
  success: true,
402
478
  data: {
@@ -429,63 +505,63 @@ export var paymentResult = {
429
505
  target: 'CONTAINER_ELEMENT'
430
506
  };
431
507
  export var submitResult = {
432
- "actionForm": {
433
- "actionFormType": "RedirectActionForm",
434
- "method": "GET",
435
- "normalUrl": "https://open-sea.alipayplus.com/api/open/v1/ac/cashier/self/codevalue/checkout.htm?codeValue=https%3A%2F%2Fglobal.alipay.com%2F281002040092rqa01k6Ed31LA96JETxv4IP8",
436
- "redirectUrl": "https://open-sea.alipayplus.com/api/open/v1/ac/cashier/self/codevalue/checkout.htm?codeValue=https%3A%2F%2Fglobal.alipay.com%2F281002040092rqa01k6Ed31LA96JETxv4IP8"
508
+ actionForm: {
509
+ actionFormType: 'RedirectActionForm',
510
+ method: 'GET',
511
+ normalUrl: 'https://open-sea.alipayplus.com/api/open/v1/ac/cashier/self/codevalue/checkout.htm?codeValue=https%3A%2F%2Fglobal.alipay.com%2F281002040092rqa01k6Ed31LA96JETxv4IP8',
512
+ redirectUrl: 'https://open-sea.alipayplus.com/api/open/v1/ac/cashier/self/codevalue/checkout.htm?codeValue=https%3A%2F%2Fglobal.alipay.com%2F281002040092rqa01k6Ed31LA96JETxv4IP8'
437
513
  },
438
- "codeFormViews": [{
439
- "code": "https://global.alipay.com/281002040092rqa01k6Ed31LA96JETxv4IP8",
440
- "codeExpireTime": "1732567070000",
441
- "displayType": "QRCODE"
514
+ codeFormViews: [{
515
+ code: 'https://global.alipay.com/281002040092rqa01k6Ed31LA96JETxv4IP8',
516
+ codeExpireTime: '1732567070000',
517
+ displayType: 'QRCODE'
442
518
  }],
443
- "errorActions": {},
444
- "extendInfo": {
445
- "iconName": "AlipayHK",
446
- "paymentRedirectUrl": "http://gol.alipay.net:8080/amsdemo/result?paymentRequestId=amsdmpay_20240410_143002_4shkjh123",
447
- "icon": "https://cdn.marmot-cloud.com/storage/2024/05/15/97dbcec8-7bdd-464b-b49a-5d9af6d98c0b.svg",
448
- "paymentMethod": "ALIPAY_HK"
519
+ errorActions: {},
520
+ extendInfo: {
521
+ iconName: 'AlipayHK',
522
+ paymentRedirectUrl: 'http://gol.alipay.net:8080/amsdemo/result?paymentRequestId=amsdmpay_20240410_143002_4shkjh123',
523
+ icon: 'https://cdn.marmot-cloud.com/storage/2024/05/15/97dbcec8-7bdd-464b-b49a-5d9af6d98c0b.svg',
524
+ paymentMethod: 'ALIPAY_HK'
449
525
  },
450
- "orderAmount": {
451
- "amount": "1.10",
452
- "currency": "EUR",
453
- "currencyLabel": "",
454
- "formattedAmount": "1,10",
455
- "formattedAmountWithCurrency": "€ 1,10",
456
- "value": "110"
526
+ orderAmount: {
527
+ amount: '1.10',
528
+ currency: 'EUR',
529
+ currencyLabel: '',
530
+ formattedAmount: '1,10',
531
+ formattedAmountWithCurrency: '€ 1,10',
532
+ value: '110'
457
533
  },
458
- "orderAmountView": {
459
- "currency": "EUR",
460
- "currencyDivider": " ",
461
- "currencyLabel": "",
462
- "currencySymbolPosition": "L",
463
- "formattedValue": "1,10",
464
- "value": "1.10"
534
+ orderAmountView: {
535
+ currency: 'EUR',
536
+ currencyDivider: ' ',
537
+ currencyLabel: '',
538
+ currencySymbolPosition: 'L',
539
+ formattedValue: '1,10',
540
+ value: '1.10'
465
541
  },
466
- "paymentAmount": {
467
- "amount": "1.10",
468
- "currency": "EUR",
469
- "currencyLabel": "",
470
- "formattedAmount": "1,10",
471
- "formattedAmountWithCurrency": "€ 1,10",
472
- "value": "110"
542
+ paymentAmount: {
543
+ amount: '1.10',
544
+ currency: 'EUR',
545
+ currencyLabel: '',
546
+ formattedAmount: '1,10',
547
+ formattedAmountWithCurrency: '€ 1,10',
548
+ value: '110'
473
549
  },
474
- "paymentAmountView": {
475
- "currency": "EUR",
476
- "currencyDivider": " ",
477
- "currencyLabel": "",
478
- "currencySymbolPosition": "L",
479
- "formattedValue": "1,10",
480
- "value": "1.10"
550
+ paymentAmountView: {
551
+ currency: 'EUR',
552
+ currencyDivider: ' ',
553
+ currencyLabel: '',
554
+ currencySymbolPosition: 'L',
555
+ formattedValue: '1,10',
556
+ value: '1.10'
481
557
  },
482
- "paymentMethodType": "ALIPAY_HK",
483
- "paymentResultCode": "PAYMENT_IN_PROCESS",
484
- "paymentStatus": "PROCESSING",
485
- "serverTime": "1731566233772",
486
- "success": true,
487
- "supportedLanguages": [{
488
- "locale": "en_US",
489
- "preferred": true
558
+ paymentMethodType: 'ALIPAY_HK',
559
+ paymentResultCode: 'PAYMENT_IN_PROCESS',
560
+ paymentStatus: 'PROCESSING',
561
+ serverTime: '1731566233772',
562
+ success: true,
563
+ supportedLanguages: [{
564
+ locale: 'en_US',
565
+ preferred: true
490
566
  }]
491
567
  };
@@ -40,7 +40,7 @@ import { ApplePayBusSubscriber } from "../../plugin/applepay";
40
40
  import ComponentApp from "../../plugin/component";
41
41
  import { ExtendPlugin } from "../../plugin/const";
42
42
  import { PaypalBusSubscriber } from "../../plugin/paypal";
43
- import { ComponentSignEnum, ComponentSignEnumV2, EnvironmentEnum, modeEnum, networkModeEnum, ProductSceneEnum, DisplayTypeEnum } from "../../types";
43
+ import { ComponentSignEnum, ComponentSignEnumV2, DisplayTypeEnum, EnvironmentEnum, modeEnum, networkModeEnum, ProductSceneEnum } from "../../types";
44
44
  import { getOrSetStorageId, isPC, parseBase64ToString } from "../../util";
45
45
  import { createIframeNode, createPreloadIframeNode } from "../../util/createIframeNode";
46
46
  import { getSecurityConfigStorageKey } from "../../util/security";
@@ -101,7 +101,7 @@ var handleParams = function handleParams(params, _this) {
101
101
  parseData = _handleSessionData2[0],
102
102
  sessionData = _handleSessionData2[1];
103
103
  var componentSign = getComponentSign(parseData);
104
- if (_toConsumableArray(Object.values(ComponentSignEnumV2)).includes(componentSign) && _params.renderDisplayType === DisplayTypeEnum.popup) {
104
+ if (_toConsumableArray(Object.values(ComponentSignEnumV2)).includes(componentSign) && _params.renderDisplayType === DisplayTypeEnum.popup && window.location.href.indexOf('popup=true') === -1) {
105
105
  return Promise.reject({
106
106
  code: ERRORMESSAGE.CREATEPAYMENT_PARAMETER_ERROR.code,
107
107
  message: "unsupported payment method"
@@ -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 { Logger } from "../../util/logger";
2
+ import { EventPayloadContext, type EventPayload, type IPaymentMethod, type IPaymentSessionMetaData } from '../../types';
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 {};