@alipay/ams-checkout 0.0.1735810732-dev.0 → 0.0.1737621505-dev.2
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 +7 -7
- package/esm/constant/index.d.ts +9 -0
- package/esm/constant/index.js +9 -0
- package/esm/core/component/element/index.d.ts +3 -0
- package/esm/core/component/element/index.js +154 -76
- package/esm/core/component/element/mock.d.ts +2 -0
- package/esm/core/component/element/mock.js +129 -53
- package/esm/core/component/element/type.d.ts +2 -2
- package/esm/core/component/element/type.js +2 -2
- package/esm/core/component/index.js +2 -2
- package/esm/foundation/core/index.js +4 -4
- package/esm/plugin/applepay/interface.d.ts +2 -2
- package/esm/plugin/component/channel.d.ts +35 -1
- package/esm/plugin/component/channel.js +551 -0
- package/esm/plugin/component/index.d.ts +1 -1
- package/esm/plugin/component/index.js +93 -39
- package/esm/types/index.d.ts +37 -3
- package/esm/types/index.js +5 -2
- package/esm/util/index.d.ts +2 -1
- package/esm/util/index.js +16 -1
- package/esm/util/versionCompare.d.ts +1 -1
- package/package.json +1 -1
@@ -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
|
};
|
@@ -12,8 +12,8 @@ export declare const addressTheme: {
|
|
12
12
|
night: string;
|
13
13
|
};
|
14
14
|
export declare enum EventCallbackCode {
|
15
|
-
|
16
|
-
|
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["
|
17
|
-
EventCallbackCode["
|
16
|
+
EventCallbackCode["FAILED"] = "FAILED";
|
17
|
+
EventCallbackCode["SUCCESS"] = "SUCCESS";
|
18
18
|
return EventCallbackCode;
|
19
19
|
}({});
|
20
20
|
export var ELEMENT_ENVIRONMENT = /*#__PURE__*/function (ELEMENT_ENVIRONMENT) {
|
@@ -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"
|
@@ -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
|
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
|
215
|
-
paymentMethod = (_this$paymentContext$
|
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 =
|
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 type
|
1
|
+
import { type EventPayload, 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,37 @@ 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 ApplePaySdk {
|
23
|
+
private APPLESDKURL;
|
24
|
+
private session;
|
25
|
+
private paymentSessionData;
|
26
|
+
private parseData;
|
27
|
+
/**
|
28
|
+
* @description 支付状态,pending:支付中,normal:正常
|
29
|
+
*/
|
30
|
+
private paymentStatus;
|
31
|
+
private logger;
|
32
|
+
constructor({ paymentSessionData, parseData, logger, }: {
|
33
|
+
paymentSessionData: string;
|
34
|
+
parseData: IPaymentSessionMetaData;
|
35
|
+
logger: Logger;
|
36
|
+
});
|
37
|
+
startPay(): Promise<unknown>;
|
38
|
+
begin(): Promise<unknown>;
|
39
|
+
private submitPay;
|
40
|
+
private setPayStatus;
|
41
|
+
initApplePaySession(): Promise<never>;
|
42
|
+
private abortSession;
|
43
|
+
private get initSessionParams();
|
44
|
+
private get isRequiredParameters();
|
45
|
+
private isCanMakePayments;
|
46
|
+
private loadApplePaySdk;
|
47
|
+
private get checkScriptIsLoaded();
|
48
|
+
/**
|
49
|
+
* @description 非标方案,sdk目前无法直接监听国内不支持弹窗的关闭操作
|
50
|
+
*/
|
51
|
+
private addEventListener;
|
52
|
+
private getDeviceId;
|
53
|
+
}
|
54
|
+
export declare const isSkipRenderPaymentMethod: (parseData: IPaymentSessionMetaData) => boolean;
|
21
55
|
export {};
|