@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.
- package/dist/umd/ams-checkout.min.js +1 -1
- package/esm/config/index.d.ts +7 -7
- package/esm/config/index.js +9 -21
- package/esm/constant/index.d.ts +3 -0
- package/esm/constant/index.js +3 -0
- package/esm/core/component/element/index.js +1 -1
- package/esm/core/component/element/mock.d.ts +2 -0
- package/esm/core/component/element/mock.js +129 -53
- package/esm/core/component/index.js +2 -2
- package/esm/plugin/applepay/interface.d.ts +2 -2
- package/esm/plugin/component/channel.d.ts +41 -1
- package/esm/plugin/component/channel.js +589 -1
- package/esm/plugin/component/index.d.ts +1 -1
- package/esm/plugin/component/index.js +59 -39
- package/esm/types/index.d.ts +31 -2
- package/esm/types/index.js +2 -2
- package/package.json +1 -1
package/esm/config/index.d.ts
CHANGED
@@ -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.
|
9
|
-
export declare const AMSAutoDebitAppVersion = "1.26.
|
10
|
-
export declare const AMSEasyPayAppVersion = "1.26.
|
11
|
-
export declare const AMSCashierPaymentAppVersion = "1.26.
|
12
|
-
export declare const AMSVaultingAppVersion = "1.26.
|
13
|
-
export declare const AMSPaymentElementAppVersion = "1.26.
|
14
|
-
export declare const ADDRESSElementAppVersion = "1.26.
|
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";
|
package/esm/config/index.js
CHANGED
@@ -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.
|
51
|
-
export var AMSAutoDebitAppVersion = '1.26.
|
52
|
-
export var AMSEasyPayAppVersion = '1.26.
|
53
|
-
export var AMSCashierPaymentAppVersion = '1.26.
|
54
|
-
export var AMSVaultingAppVersion = '1.26.
|
55
|
-
export var AMSPaymentElementAppVersion = '1.26.
|
56
|
-
export var ADDRESSElementAppVersion = '1.26.
|
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
|
package/esm/constant/index.d.ts
CHANGED
@@ -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";
|
package/esm/constant/index.js
CHANGED
@@ -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.
|
643
|
+
event: ElementPaymentEvent.RENDER_COMPONENT,
|
644
644
|
data: {
|
645
645
|
target: target,
|
646
646
|
source: ElementPaymentMethod.CONTAINER_ELEMENT,
|
@@ -361,7 +361,7 @@ export var sdkAction = {
|
|
361
361
|
},
|
362
362
|
success: true
|
363
363
|
};
|
364
|
-
export var
|
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
|
-
|
433
|
-
|
434
|
-
|
435
|
-
|
436
|
-
|
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
|
-
|
439
|
-
|
440
|
-
|
441
|
-
|
514
|
+
codeFormViews: [{
|
515
|
+
code: 'https://global.alipay.com/281002040092rqa01k6Ed31LA96JETxv4IP8',
|
516
|
+
codeExpireTime: '1732567070000',
|
517
|
+
displayType: 'QRCODE'
|
442
518
|
}],
|
443
|
-
|
444
|
-
|
445
|
-
|
446
|
-
|
447
|
-
|
448
|
-
|
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
|
-
|
451
|
-
|
452
|
-
|
453
|
-
|
454
|
-
|
455
|
-
|
456
|
-
|
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
|
-
|
459
|
-
|
460
|
-
|
461
|
-
|
462
|
-
|
463
|
-
|
464
|
-
|
534
|
+
orderAmountView: {
|
535
|
+
currency: 'EUR',
|
536
|
+
currencyDivider: ' ',
|
537
|
+
currencyLabel: '€',
|
538
|
+
currencySymbolPosition: 'L',
|
539
|
+
formattedValue: '1,10',
|
540
|
+
value: '1.10'
|
465
541
|
},
|
466
|
-
|
467
|
-
|
468
|
-
|
469
|
-
|
470
|
-
|
471
|
-
|
472
|
-
|
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
|
-
|
475
|
-
|
476
|
-
|
477
|
-
|
478
|
-
|
479
|
-
|
480
|
-
|
550
|
+
paymentAmountView: {
|
551
|
+
currency: 'EUR',
|
552
|
+
currencyDivider: ' ',
|
553
|
+
currencyLabel: '€',
|
554
|
+
currencySymbolPosition: 'L',
|
555
|
+
formattedValue: '1,10',
|
556
|
+
value: '1.10'
|
481
557
|
},
|
482
|
-
|
483
|
-
|
484
|
-
|
485
|
-
|
486
|
-
|
487
|
-
|
488
|
-
|
489
|
-
|
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
|
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 =
|
41
|
-
export type ApplePayRecurringPaymentDateUnit =
|
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
|
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 {};
|