@alipay/ams-checkout 0.0.1704122903-dev.3 → 0.0.1704337820-dev.1
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/common/applepay/index.d.ts +48 -0
- package/esm/common/applepay/index.js +171 -0
- package/esm/common/applepay/interface.d.ts +102 -0
- package/esm/common/applepay/interface.js +1 -0
- package/esm/config/request.js +3 -3
- package/esm/core/applepay/index.d.ts +31 -0
- package/esm/core/applepay/index.js +369 -0
- package/esm/core/component/index.d.ts +3 -1
- package/esm/core/component/index.js +2 -2
- package/esm/index.d.ts +3 -0
- package/esm/index.js +18 -8
- package/esm/plugin/component/index.d.ts +2 -1
- package/esm/plugin/component/index.js +7 -4
- package/esm/request/index.js +14 -8
- package/esm/service/index.d.ts +9 -1
- package/esm/service/index.js +31 -0
- package/esm/types/index.d.ts +54 -3
- package/esm/types/index.js +13 -0
- package/esm/util/security.d.ts +1 -0
- package/esm/util/security.js +1 -1
- package/package.json +56 -1
package/esm/service/index.js
CHANGED
@@ -78,6 +78,14 @@ function _antomConfig() {
|
|
78
78
|
export function submitPayInfo(_x6, _x7, _x8) {
|
79
79
|
return _submitPayInfo.apply(this, arguments);
|
80
80
|
}
|
81
|
+
|
82
|
+
/**
|
83
|
+
* Get merchant session by Apple Pay
|
84
|
+
* @param paymentSessionData
|
85
|
+
* @param params
|
86
|
+
* @param options
|
87
|
+
* @param logger
|
88
|
+
*/
|
81
89
|
function _submitPayInfo() {
|
82
90
|
_submitPayInfo = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(params, options, logger) {
|
83
91
|
var hostSign;
|
@@ -97,4 +105,27 @@ function _submitPayInfo() {
|
|
97
105
|
}, _callee3);
|
98
106
|
}));
|
99
107
|
return _submitPayInfo.apply(this, arguments);
|
108
|
+
}
|
109
|
+
export function getApplePayPaymentSession(_x9, _x10, _x11, _x12) {
|
110
|
+
return _getApplePayPaymentSession.apply(this, arguments);
|
111
|
+
}
|
112
|
+
function _getApplePayPaymentSession() {
|
113
|
+
_getApplePayPaymentSession = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(paymentSessionData, params, options, logger) {
|
114
|
+
var hostSign;
|
115
|
+
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
116
|
+
while (1) switch (_context4.prev = _context4.next) {
|
117
|
+
case 0:
|
118
|
+
hostSign = (paymentSessionData || '').split('&&')[1] || '';
|
119
|
+
console.log('getApplePayPaymentSession hostSign', hostSign);
|
120
|
+
return _context4.abrupt("return", request(params, _objectSpread(_objectSpread({}, options), {}, {
|
121
|
+
hostSign: hostSign,
|
122
|
+
'Operation-Type': 'com.ipay.iexpcashier.cashier.createApplePayPaymentSession'
|
123
|
+
}), logger));
|
124
|
+
case 3:
|
125
|
+
case "end":
|
126
|
+
return _context4.stop();
|
127
|
+
}
|
128
|
+
}, _callee4);
|
129
|
+
}));
|
130
|
+
return _getApplePayPaymentSession.apply(this, arguments);
|
100
131
|
}
|
package/esm/types/index.d.ts
CHANGED
@@ -24,6 +24,8 @@ export interface IoptionsParams {
|
|
24
24
|
};
|
25
25
|
product?: string;
|
26
26
|
}
|
27
|
+
export interface IApplePayOptionsParams extends Pick<IoptionsParams, 'locale' | 'environment' | 'onEventCallback' | 'analytics'> {
|
28
|
+
}
|
27
29
|
export type Iselector = string;
|
28
30
|
export declare enum renderDisplayTypeEnum {
|
29
31
|
'popup' = "popup",
|
@@ -51,7 +53,8 @@ export declare enum productSceneEnum {
|
|
51
53
|
'CASHIER_PAYMENT' = "CASHIER_PAYMENT",
|
52
54
|
'AUTO_DEBIT' = "AUTO_DEBIT",
|
53
55
|
'VAULTING' = "VAULTING",
|
54
|
-
'FLASH_BUY' = "FLASH_BUY"
|
56
|
+
'FLASH_BUY' = "FLASH_BUY",
|
57
|
+
'CARD_APPLE_PAY' = "CARD_APPLE_PAY"
|
55
58
|
}
|
56
59
|
export declare enum paymentMethodCategoryTypeEnum {
|
57
60
|
'CARD' = "CARD",
|
@@ -68,14 +71,21 @@ export interface DeviceIdParameter {
|
|
68
71
|
export interface IcreateComponent {
|
69
72
|
sessionData: string;
|
70
73
|
paymentSessionData?: string;
|
71
|
-
appearance?: Record<string, any>;
|
72
74
|
notRedirectAfterComplete?: boolean;
|
75
|
+
appearance?: Record<string, any>;
|
76
|
+
merchantAppointParam?: IMerchantAppointParam;
|
73
77
|
}
|
74
78
|
export interface IappendIframeNodesParams extends IcreateComponent {
|
75
79
|
paymentSessionMetaData: IpaymentSessionMetaData;
|
76
80
|
renderDisplayType: renderDisplayTypeEnum;
|
77
81
|
selector?: Iselector;
|
78
82
|
}
|
83
|
+
export interface IMerchantAppointParam {
|
84
|
+
storedCard?: IStoredCard;
|
85
|
+
}
|
86
|
+
export interface IStoredCard {
|
87
|
+
needCVV?: boolean;
|
88
|
+
}
|
79
89
|
export interface IbillingAddress {
|
80
90
|
region?: string;
|
81
91
|
address1?: string;
|
@@ -122,6 +132,26 @@ export interface IpaymentSessionMetaData {
|
|
122
132
|
autoDebitWithToken: boolean;
|
123
133
|
skipSdkQuery: boolean;
|
124
134
|
};
|
135
|
+
paymentSessionFactor?: {
|
136
|
+
applePay?: {
|
137
|
+
merchantCapabilities?: string[];
|
138
|
+
supportedNetworks?: string[];
|
139
|
+
};
|
140
|
+
merchantInfo?: {
|
141
|
+
registeredCountry?: string;
|
142
|
+
partnerId?: string;
|
143
|
+
};
|
144
|
+
order?: {
|
145
|
+
orderDescription?: string;
|
146
|
+
};
|
147
|
+
paymentAmount?: {
|
148
|
+
value?: string;
|
149
|
+
currency?: string;
|
150
|
+
};
|
151
|
+
paymentMethodInfo?: {
|
152
|
+
paymentMethodType?: string;
|
153
|
+
};
|
154
|
+
};
|
125
155
|
}
|
126
156
|
export declare enum localeEnum {
|
127
157
|
'en-US' = "en-US"
|
@@ -281,6 +311,7 @@ export interface CashierSdkActionQueryRequest {
|
|
281
311
|
paymentSessionConfig?: IpaymentSessionConfig;
|
282
312
|
paymentMethodType?: string;
|
283
313
|
notRedirectAfterComplete?: boolean;
|
314
|
+
merchantAppointParam?: IMerchantAppointParam;
|
284
315
|
extParams?: any;
|
285
316
|
}
|
286
317
|
export interface CashierSubmitPayRequest {
|
@@ -323,6 +354,23 @@ export interface CashierSdkActionQueryResult {
|
|
323
354
|
schemeUrl?: string;
|
324
355
|
authUrl?: string;
|
325
356
|
}
|
357
|
+
/**
|
358
|
+
* Get App Pay Payment Session Request.
|
359
|
+
*/
|
360
|
+
export interface ApplePayPaymentSessionRequest {
|
361
|
+
validateUrl: string;
|
362
|
+
paymentSessionData: string;
|
363
|
+
}
|
364
|
+
/**
|
365
|
+
* Get App Pay Payment Session Result.
|
366
|
+
*/
|
367
|
+
export interface ApplePayPaymentSessionResult {
|
368
|
+
merchantSessionObject: string;
|
369
|
+
success: boolean;
|
370
|
+
errorCode?: string;
|
371
|
+
errorMessage?: string;
|
372
|
+
message?: string;
|
373
|
+
}
|
326
374
|
export declare enum redirectTypeEnum {
|
327
375
|
UNSAFE_BROWSER = "UNSAFE_BROWSER",
|
328
376
|
SAFETY_BROWSER = "SAFETY_BROWSER",
|
@@ -355,7 +403,10 @@ export declare enum eventCodeEnum {
|
|
355
403
|
SDK_INIT_PARAMETER_ERROR = "SDK_INIT_PARAMETER_ERROR",
|
356
404
|
SDK_CREATECOMPONENT_ERROR = "SDK_CREATECOMPONENT_ERROR",
|
357
405
|
SDK_CALL_URL_ERROR = "SDK_CALL_URL_ERROR",
|
358
|
-
SDK_CALL_URL_SUCCESS = "SDK_CALL_URL_SUCCESS"
|
406
|
+
SDK_CALL_URL_SUCCESS = "SDK_CALL_URL_SUCCESS",
|
407
|
+
SDK_PAYMENT_FINISH = "SDK_PAYMENT_FINISH",
|
408
|
+
SDK_PAYMENT_FAIL = "SDK_PAYMENT_FAIL",
|
409
|
+
SDK_PAYMENT_CANCEL = "SDK_PAYMENT_CANCEL"
|
359
410
|
}
|
360
411
|
export declare enum RedirectType {
|
361
412
|
ApplinkUrl = "ApplinkUrl",
|
package/esm/types/index.js
CHANGED
@@ -30,6 +30,7 @@ export var productSceneEnum = /*#__PURE__*/function (productSceneEnum) {
|
|
30
30
|
productSceneEnum["AUTO_DEBIT"] = "AUTO_DEBIT";
|
31
31
|
productSceneEnum["VAULTING"] = "VAULTING";
|
32
32
|
productSceneEnum["FLASH_BUY"] = "FLASH_BUY";
|
33
|
+
productSceneEnum["CARD_APPLE_PAY"] = "CARD_APPLE_PAY";
|
33
34
|
return productSceneEnum;
|
34
35
|
}({});
|
35
36
|
export var paymentMethodCategoryTypeEnum = /*#__PURE__*/function (paymentMethodCategoryTypeEnum) {
|
@@ -125,6 +126,15 @@ export var errorEnum = /*#__PURE__*/function (errorEnum) {
|
|
125
126
|
errorEnum["GETSIGNPARAMSERROR"] = "GETSIGNPARAMSERROR";
|
126
127
|
return errorEnum;
|
127
128
|
}({});
|
129
|
+
|
130
|
+
/**
|
131
|
+
* Get App Pay Payment Session Request.
|
132
|
+
*/
|
133
|
+
|
134
|
+
/**
|
135
|
+
* Get App Pay Payment Session Result.
|
136
|
+
*/
|
137
|
+
|
128
138
|
export var redirectTypeEnum = /*#__PURE__*/function (redirectTypeEnum) {
|
129
139
|
redirectTypeEnum["UNSAFE_BROWSER"] = "UNSAFE_BROWSER";
|
130
140
|
redirectTypeEnum["SAFETY_BROWSER"] = "SAFETY_BROWSER";
|
@@ -140,6 +150,9 @@ export var eventCodeEnum = /*#__PURE__*/function (eventCodeEnum) {
|
|
140
150
|
eventCodeEnum["SDK_CREATECOMPONENT_ERROR"] = "SDK_CREATECOMPONENT_ERROR";
|
141
151
|
eventCodeEnum["SDK_CALL_URL_ERROR"] = "SDK_CALL_URL_ERROR";
|
142
152
|
eventCodeEnum["SDK_CALL_URL_SUCCESS"] = "SDK_CALL_URL_SUCCESS";
|
153
|
+
eventCodeEnum["SDK_PAYMENT_FINISH"] = "SDK_PAYMENT_FINISH";
|
154
|
+
eventCodeEnum["SDK_PAYMENT_FAIL"] = "SDK_PAYMENT_FAIL";
|
155
|
+
eventCodeEnum["SDK_PAYMENT_CANCEL"] = "SDK_PAYMENT_CANCEL";
|
143
156
|
return eventCodeEnum;
|
144
157
|
}({});
|
145
158
|
export var RedirectType = /*#__PURE__*/function (RedirectType) {
|
package/esm/util/security.d.ts
CHANGED
package/esm/util/security.js
CHANGED
@@ -24,7 +24,7 @@ export var securityHost = {
|
|
24
24
|
US: 'https://open-na-global.alipay.com/api/open/risk_client',
|
25
25
|
DE: 'https://open-de-global.alipay.com/api/open/risk_client'
|
26
26
|
};
|
27
|
-
export var sceneMap = _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({}, productSceneEnum.CASHIER_PAYMENT, 'Acquirer'), productSceneEnum.AUTO_DEBIT, 'Acquirer'), productSceneEnum.VAULTING, 'Acquirer'), "EASYPAY", 'EasyPay'), productSceneEnum.EASY_PAY, 'EasyPay'), productSceneEnum.FLASH_BUY, 'OneAccount');
|
27
|
+
export var sceneMap = _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({}, productSceneEnum.CASHIER_PAYMENT, 'Acquirer'), productSceneEnum.AUTO_DEBIT, 'Acquirer'), productSceneEnum.VAULTING, 'Acquirer'), productSceneEnum.CARD_APPLE_PAY, 'Acquirer'), "EASYPAY", 'EasyPay'), productSceneEnum.EASY_PAY, 'EasyPay'), productSceneEnum.FLASH_BUY, 'OneAccount');
|
28
28
|
export var getSecurityHost = function getSecurityHost(region) {
|
29
29
|
return securityHost[region] || securityHost[SecurityRegionEnum.SG];
|
30
30
|
};
|
package/package.json
CHANGED
@@ -1 +1,56 @@
|
|
1
|
-
{
|
1
|
+
{
|
2
|
+
"name": "@alipay/ams-checkout",
|
3
|
+
"version": "0.0.1704337820-dev.1",
|
4
|
+
"description": "",
|
5
|
+
"author": "",
|
6
|
+
"main": "esm/index.js",
|
7
|
+
"module": "esm/index.js",
|
8
|
+
"typings": "esm/index.d.ts",
|
9
|
+
"files": [
|
10
|
+
"dist",
|
11
|
+
"esm",
|
12
|
+
"LEGAL.md",
|
13
|
+
"LICENSE",
|
14
|
+
"README.md"
|
15
|
+
],
|
16
|
+
"scripts": {
|
17
|
+
"build": "father build",
|
18
|
+
"ci": "npm run lint",
|
19
|
+
"cov": "jest --coverage",
|
20
|
+
"format": "prettier --write --no-error-on-unmatched-pattern \"**/*.{js,jsx,ts,tsx,md,json,css,less}\"",
|
21
|
+
"lint": "eslint ./src",
|
22
|
+
"test": "jest"
|
23
|
+
},
|
24
|
+
"dependencies": {
|
25
|
+
"axios": "^1.3.4",
|
26
|
+
"uuid": "^9.0.0"
|
27
|
+
},
|
28
|
+
"devDependencies": {
|
29
|
+
"@babel/core": "^7.20.7",
|
30
|
+
"@babel/preset-env": "^7.20.2",
|
31
|
+
"@testing-library/jest-dom": "^5.1.1",
|
32
|
+
"@testing-library/react": "^9.5.0",
|
33
|
+
"@types/jest": "^29.2.4",
|
34
|
+
"@types/uuid": "^9.0.0",
|
35
|
+
"@typescript-eslint/eslint-plugin": "latest",
|
36
|
+
"@typescript-eslint/parser": "^5.60.0",
|
37
|
+
"babel-jest": "^29.3.1",
|
38
|
+
"babel-loader": "^9.1.0",
|
39
|
+
"babel-plugin-import": "^1.13.0",
|
40
|
+
"eslint": "^8.36.0",
|
41
|
+
"eslint-plugin-prettier": "latest",
|
42
|
+
"father": "^4.2.3",
|
43
|
+
"jest": "^29.5.0",
|
44
|
+
"jest-environment-jsdom": "^29.3.1",
|
45
|
+
"prettier": "^2.8.4",
|
46
|
+
"prettier-plugin-organize-imports": "^3.2.3",
|
47
|
+
"prettier-plugin-packagejson": "^2.4.5",
|
48
|
+
"ts-jest": "^29.0.3",
|
49
|
+
"ts-node": "^10.9.1",
|
50
|
+
"typescript": "^4.9.5"
|
51
|
+
},
|
52
|
+
"engines": {},
|
53
|
+
"publishConfig": {
|
54
|
+
"access": "public"
|
55
|
+
}
|
56
|
+
}
|