@alipay/ams-checkout 0.0.1704337820-dev.1 → 0.0.1704984575-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/request.js +3 -3
- package/esm/core/component/index.d.ts +1 -3
- package/esm/core/component/index.js +2 -2
- package/esm/index.d.ts +0 -3
- package/esm/index.js +8 -18
- package/esm/plugin/component/index.d.ts +1 -2
- package/esm/plugin/component/index.js +21 -27
- package/esm/request/index.js +8 -14
- package/esm/service/index.d.ts +1 -9
- package/esm/service/index.js +0 -31
- package/esm/types/index.d.ts +3 -54
- package/esm/types/index.js +0 -13
- package/esm/util/security.d.ts +0 -1
- package/esm/util/security.js +1 -1
- package/package.json +1 -56
- package/esm/common/applepay/index.d.ts +0 -48
- package/esm/common/applepay/index.js +0 -171
- package/esm/common/applepay/interface.d.ts +0 -102
- package/esm/common/applepay/interface.js +0 -1
- package/esm/core/applepay/index.d.ts +0 -31
- package/esm/core/applepay/index.js +0 -369
package/esm/config/request.js
CHANGED
@@ -12,8 +12,8 @@ var _queryParse = queryParse(),
|
|
12
12
|
groupId = _queryParse.groupId,
|
13
13
|
host = _queryParse.requestHost;
|
14
14
|
export var requestHost = {
|
15
|
-
local: 'http://imgs-
|
16
|
-
dev: host || 'http://imgs-
|
15
|
+
local: 'http://imgs-6517.sggz00b.dev.alipay.net/mgw.htm',
|
16
|
+
dev: host || 'http://imgs-6517.sggz00b.dev.alipay.net/mgw.htm',
|
17
17
|
sit: host || 'http://imgs-9.sggz00a.test.alipay.net/mgw.htm',
|
18
18
|
pre: 'https://imgs-sea-pre.alipay.com/mgw.htm',
|
19
19
|
prod: 'https://imgs-sea-global.alipay.com/mgw.htm',
|
@@ -22,7 +22,7 @@ export var requestHost = {
|
|
22
22
|
export var clientId = '5J5Y8X4E2Y25GR00690';
|
23
23
|
export var tntInstId = 'ALIPW3SG';
|
24
24
|
export var appId = 'ANTOM_PAYMENT_WEB';
|
25
|
-
export var sofaId = groupId || '
|
25
|
+
export var sofaId = groupId || 'GROUP_20230913102142';
|
26
26
|
export var hostSignMap = function hostSignMap(hostSign, env) {
|
27
27
|
var map = {
|
28
28
|
SG: 'https://imgs-sea-global.alipay.com/mgw.htm',
|
@@ -1,8 +1,6 @@
|
|
1
1
|
import ComponentApp from '../../plugin/component';
|
2
|
-
import {
|
2
|
+
import { IcreateComponent, IoptionsParams, Iselector, Isubmit } from '../../types';
|
3
3
|
import CoreInstance from '../instance/index';
|
4
|
-
export declare const getComponentSign: (params: IpaymentSessionMetaData) => componentSignEnum;
|
5
|
-
export declare const parseSessionData: (sessionData: string) => [IpaymentSessionMetaData, string];
|
6
4
|
export declare class AMSComponent extends CoreInstance {
|
7
5
|
_componentApp: ComponentApp;
|
8
6
|
constructor(options: IoptionsParams);
|
@@ -33,7 +33,7 @@ import { getOrSetStorageId, isPC } from "../../util";
|
|
33
33
|
import { createIframeNode } from "../../util/createIframeNode";
|
34
34
|
import { getSecurityConfigStorageKey } from "../../util/security";
|
35
35
|
import CoreInstance from "../instance/index";
|
36
|
-
|
36
|
+
var getComponentSign = function getComponentSign(params) {
|
37
37
|
var _params$paymentSessio = params.paymentSessionConfig,
|
38
38
|
_params$paymentSessio2 = _params$paymentSessio === void 0 ? {} : _params$paymentSessio,
|
39
39
|
_params$paymentSessio3 = _params$paymentSessio2.productScene,
|
@@ -42,7 +42,7 @@ export var getComponentSign = function getComponentSign(params) {
|
|
42
42
|
paymentMethodCategoryType = _params$paymentSessio4 === void 0 ? '' : _params$paymentSessio4;
|
43
43
|
return productScene && paymentMethodCategoryType ? "".concat(productScene, "_").concat(paymentMethodCategoryType) : componentSignEnum.NONE;
|
44
44
|
};
|
45
|
-
|
45
|
+
var parseSessionData = function parseSessionData(sessionData) {
|
46
46
|
try {
|
47
47
|
return [JSON.parse(atob(sessionData.split('&&')[3])), sessionData.split('&&').slice(0, 3).join('&&')];
|
48
48
|
} catch (error) {
|
package/esm/index.d.ts
CHANGED
@@ -1,11 +1,8 @@
|
|
1
1
|
import { AMSComponent } from './core/component/index';
|
2
2
|
import { IoptionsParams } from './types';
|
3
|
-
import ApplePayComponent from './core/applepay';
|
4
3
|
export * from './types';
|
5
4
|
export declare class AMSCheckout extends AMSComponent {
|
6
5
|
}
|
7
|
-
export declare class AMSApplePay extends ApplePayComponent {
|
8
|
-
}
|
9
6
|
export declare class AMSAutoDebit extends AMSCheckout {
|
10
7
|
constructor(options: IoptionsParams);
|
11
8
|
}
|
package/esm/index.js
CHANGED
@@ -20,7 +20,6 @@ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.g
|
|
20
20
|
*/
|
21
21
|
import { productSceneEnum } from "./types/index";
|
22
22
|
import { AMSComponent } from "./core/component/index";
|
23
|
-
import ApplePayComponent from "./core/applepay";
|
24
23
|
export * from "./types";
|
25
24
|
export var AMSCheckout = /*#__PURE__*/function (_AMSComponent) {
|
26
25
|
_inherits(AMSCheckout, _AMSComponent);
|
@@ -31,60 +30,51 @@ export var AMSCheckout = /*#__PURE__*/function (_AMSComponent) {
|
|
31
30
|
}
|
32
31
|
return _createClass(AMSCheckout);
|
33
32
|
}(AMSComponent);
|
34
|
-
export var AMSApplePay = /*#__PURE__*/function (_ApplePayComponent) {
|
35
|
-
_inherits(AMSApplePay, _ApplePayComponent);
|
36
|
-
var _super2 = _createSuper(AMSApplePay);
|
37
|
-
function AMSApplePay() {
|
38
|
-
_classCallCheck(this, AMSApplePay);
|
39
|
-
return _super2.apply(this, arguments);
|
40
|
-
}
|
41
|
-
return _createClass(AMSApplePay);
|
42
|
-
}(ApplePayComponent);
|
43
33
|
export var AMSAutoDebit = /*#__PURE__*/function (_AMSCheckout) {
|
44
34
|
_inherits(AMSAutoDebit, _AMSCheckout);
|
45
|
-
var
|
35
|
+
var _super2 = _createSuper(AMSAutoDebit);
|
46
36
|
function AMSAutoDebit(options) {
|
47
37
|
_classCallCheck(this, AMSAutoDebit);
|
48
38
|
var _options = Object.assign({}, options, {
|
49
39
|
product: productSceneEnum.AUTO_DEBIT
|
50
40
|
});
|
51
|
-
return
|
41
|
+
return _super2.call(this, _options);
|
52
42
|
}
|
53
43
|
return _createClass(AMSAutoDebit);
|
54
44
|
}(AMSCheckout);
|
55
45
|
export var AMSEasyPay = /*#__PURE__*/function (_AMSCheckout2) {
|
56
46
|
_inherits(AMSEasyPay, _AMSCheckout2);
|
57
|
-
var
|
47
|
+
var _super3 = _createSuper(AMSEasyPay);
|
58
48
|
function AMSEasyPay(options) {
|
59
49
|
_classCallCheck(this, AMSEasyPay);
|
60
50
|
var _options = Object.assign({}, options, {
|
61
51
|
product: productSceneEnum.EASY_PAY
|
62
52
|
});
|
63
|
-
return
|
53
|
+
return _super3.call(this, _options);
|
64
54
|
}
|
65
55
|
return _createClass(AMSEasyPay);
|
66
56
|
}(AMSCheckout);
|
67
57
|
export var AMSCashierPayment = /*#__PURE__*/function (_AMSCheckout3) {
|
68
58
|
_inherits(AMSCashierPayment, _AMSCheckout3);
|
69
|
-
var
|
59
|
+
var _super4 = _createSuper(AMSCashierPayment);
|
70
60
|
function AMSCashierPayment(options) {
|
71
61
|
_classCallCheck(this, AMSCashierPayment);
|
72
62
|
var _options = Object.assign({}, options, {
|
73
63
|
product: productSceneEnum.CASHIER_PAYMENT
|
74
64
|
});
|
75
|
-
return
|
65
|
+
return _super4.call(this, _options);
|
76
66
|
}
|
77
67
|
return _createClass(AMSCashierPayment);
|
78
68
|
}(AMSCheckout);
|
79
69
|
export var AMSVaulting = /*#__PURE__*/function (_AMSCheckout4) {
|
80
70
|
_inherits(AMSVaulting, _AMSCheckout4);
|
81
|
-
var
|
71
|
+
var _super5 = _createSuper(AMSVaulting);
|
82
72
|
function AMSVaulting(options) {
|
83
73
|
_classCallCheck(this, AMSVaulting);
|
84
74
|
var _options = Object.assign({}, options, {
|
85
75
|
product: productSceneEnum.VAULTING
|
86
76
|
});
|
87
|
-
return
|
77
|
+
return _super5.call(this, _options);
|
88
78
|
}
|
89
79
|
return _createClass(AMSVaulting);
|
90
80
|
}(AMSCheckout);
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import type AMSCheckout from '../../core/instance';
|
2
|
-
import type { eventPayload, eventPayloadContext, IappendIframeNodesParams,
|
2
|
+
import type { eventPayload, eventPayloadContext, IappendIframeNodesParams, Iselector } from '../../types';
|
3
3
|
import { componentSignEnum, platformEnum, renderDisplayTypeEnum } from '../../types';
|
4
4
|
type IrenderFuncParams = (context: ComponentApp, selector: Iselector, renderDisplayType: renderDisplayTypeEnum) => Promise<void>;
|
5
5
|
export default class ComponentApp {
|
@@ -23,7 +23,6 @@ export default class ComponentApp {
|
|
23
23
|
private _appLocationSearch;
|
24
24
|
private _renderDisplayType;
|
25
25
|
private _multipleCallbackEvents;
|
26
|
-
_merchantAppointParam: IMerchantAppointParam;
|
27
26
|
constructor();
|
28
27
|
/**
|
29
28
|
* @description Cancel listening and destroy the dom
|
@@ -48,8 +48,7 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
48
48
|
_defineProperty(this, "_appLocationSearch", void 0);
|
49
49
|
_defineProperty(this, "_renderDisplayType", renderDisplayTypeEnum.popup);
|
50
50
|
_defineProperty(this, "_multipleCallbackEvents", void 0);
|
51
|
-
|
52
|
-
this._appVersion = '1.8.0';
|
51
|
+
this._appVersion = '1.7.1';
|
53
52
|
this._isInitComponent = false;
|
54
53
|
this._selector = "#".concat(COMPONENT_SECTION_ID);
|
55
54
|
this.createIframeNode = function () {
|
@@ -241,7 +240,6 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
241
240
|
this._componentSign = componentSign;
|
242
241
|
if ((_renderParams = renderParams) !== null && _renderParams !== void 0 && _renderParams.selector) this._selector = renderParams.selector;
|
243
242
|
this._renderDisplayType = renderParams.renderDisplayType;
|
244
|
-
this._merchantAppointParam = renderParams.merchantAppointParam;
|
245
243
|
var insertedNode = this._renderDisplayType === renderDisplayTypeEnum.inline ? "#".concat(COMPONENT_CONTAINER_ID) : this._selector;
|
246
244
|
this.initLoggerMeta();
|
247
245
|
this.AMSSDK.logger.logInfo({
|
@@ -341,7 +339,7 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
341
339
|
this._actionQueryPromise = new Promise( /*#__PURE__*/function () {
|
342
340
|
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(resolve, reject) {
|
343
341
|
var _this5$_renderParams, _this5$_renderParams2, _this5$_renderParams3, _this5$_renderParams4;
|
344
|
-
var envInfo, params,
|
342
|
+
var envInfo, params, _this5$_renderParams5, _ref3, _ref3$productSceneVer, productSceneVersion, _ref3$productScene, productScene, _ref4, _ref4$action, _ref4$action2, _ref4$action2$autoDeb, autoDebitWithToken, _this5$_renderParams6, _action$web, _action$wap, action, signType;
|
345
343
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
346
344
|
while (1) switch (_context2.prev = _context2.next) {
|
347
345
|
case 0:
|
@@ -351,8 +349,7 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
351
349
|
params = {
|
352
350
|
paymentSessionData: _this5._renderParams && ((_this5$_renderParams = _this5._renderParams) === null || _this5$_renderParams === void 0 ? void 0 : _this5$_renderParams.sessionData) || '',
|
353
351
|
paymentSessionConfig: (_this5$_renderParams2 = _this5._renderParams) === null || _this5$_renderParams2 === void 0 || (_this5$_renderParams2 = _this5$_renderParams2.paymentSessionMetaData) === null || _this5$_renderParams2 === void 0 ? void 0 : _this5$_renderParams2.paymentSessionConfig,
|
354
|
-
notRedirectAfterComplete: ((_this5$_renderParams3 = _this5._renderParams) === null || _this5$_renderParams3 === void 0 ? void 0 : _this5$_renderParams3.notRedirectAfterComplete) === true
|
355
|
-
merchantAppointParam: _this5._merchantAppointParam
|
352
|
+
notRedirectAfterComplete: ((_this5$_renderParams3 = _this5._renderParams) === null || _this5$_renderParams3 === void 0 ? void 0 : _this5$_renderParams3.notRedirectAfterComplete) === true
|
356
353
|
};
|
357
354
|
/**
|
358
355
|
* @description Simulated or unnecessary scenarios
|
@@ -367,7 +364,7 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
367
364
|
}));
|
368
365
|
case 4:
|
369
366
|
if (!(componentSignEnum.CASHIER_PAYMENT_CARD === _this5._componentSign || componentSignEnum.VAULTING_CARD === _this5._componentSign)) {
|
370
|
-
_context2.next =
|
367
|
+
_context2.next = 10;
|
371
368
|
break;
|
372
369
|
}
|
373
370
|
params.paymentMethodType = 'CARD';
|
@@ -375,62 +372,60 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
375
372
|
return _this5.getDeviceIdAndLog();
|
376
373
|
case 8:
|
377
374
|
envInfo.deviceId = _context2.sent;
|
378
|
-
|
379
|
-
search = window.location.search;
|
380
|
-
if (window.navigator.userAgent.indexOf('miniProgram') > -1 || search.indexOf('miniProgram') > -1) {
|
375
|
+
if (window.navigator.userAgent.indexOf('miniProgram') > -1) {
|
381
376
|
envInfo.extendInfo = {
|
382
377
|
WAP_SUB_TYPE: 'WECHAT_MINI_PROGRAM'
|
383
378
|
};
|
384
379
|
}
|
385
|
-
case
|
380
|
+
case 10:
|
386
381
|
if (!(componentSignEnum.EASY_PAY_WALLET === _this5._componentSign)) {
|
387
|
-
_context2.next =
|
382
|
+
_context2.next = 18;
|
388
383
|
break;
|
389
384
|
}
|
390
385
|
_ref3 = params.paymentSessionConfig || {}, _ref3$productSceneVer = _ref3.productSceneVersion, productSceneVersion = _ref3$productSceneVer === void 0 ? '' : _ref3$productSceneVer, _ref3$productScene = _ref3.productScene, productScene = _ref3$productScene === void 0 ? '' : _ref3$productScene;
|
391
386
|
_ref4 = ((_this5$_renderParams5 = _this5._renderParams) === null || _this5$_renderParams5 === void 0 ? void 0 : _this5$_renderParams5.paymentSessionMetaData) || {}, _ref4$action = _ref4.action, _ref4$action2 = _ref4$action === void 0 ? {} : _ref4$action, _ref4$action2$autoDeb = _ref4$action2.autoDebitWithToken, autoDebitWithToken = _ref4$action2$autoDeb === void 0 ? false : _ref4$action2$autoDeb;
|
392
387
|
if (!(productScene === productSceneEnum.EASY_PAY && productSceneVersion === '2.0' && !autoDebitWithToken)) {
|
393
|
-
_context2.next =
|
388
|
+
_context2.next = 15;
|
394
389
|
break;
|
395
390
|
}
|
396
391
|
return _context2.abrupt("return", resolve({
|
397
392
|
message: 'sdk no need to make query request',
|
398
393
|
success: true
|
399
394
|
}));
|
400
|
-
case
|
401
|
-
_context2.next =
|
395
|
+
case 15:
|
396
|
+
_context2.next = 17;
|
402
397
|
return _this5.getDeviceIdAndLog();
|
403
|
-
case
|
398
|
+
case 17:
|
404
399
|
envInfo.deviceId = _context2.sent;
|
405
|
-
case
|
400
|
+
case 18:
|
406
401
|
if (!(componentSignEnum.AUTO_DEBIT_WALLET === _this5._componentSign)) {
|
407
|
-
_context2.next =
|
402
|
+
_context2.next = 28;
|
408
403
|
break;
|
409
404
|
}
|
410
405
|
action = ((_this5$_renderParams6 = _this5._renderParams) === null || _this5$_renderParams6 === void 0 || (_this5$_renderParams6 = _this5$_renderParams6.paymentSessionMetaData) === null || _this5$_renderParams6 === void 0 ? void 0 : _this5$_renderParams6.action) || {};
|
411
406
|
signType = isPC() ? action === null || action === void 0 || (_action$web = action.web) === null || _action$web === void 0 ? void 0 : _action$web.signType : action === null || action === void 0 || (_action$wap = action.wap) === null || _action$wap === void 0 ? void 0 : _action$wap.signType;
|
412
407
|
if (!(signType === 'SMS')) {
|
413
|
-
_context2.next =
|
408
|
+
_context2.next = 23;
|
414
409
|
break;
|
415
410
|
}
|
416
411
|
return _context2.abrupt("return", resolve({
|
417
412
|
message: 'sdk no need to make query request',
|
418
413
|
success: true
|
419
414
|
}));
|
420
|
-
case
|
415
|
+
case 23:
|
421
416
|
if (!(!signType || signType !== 'REDIRECT')) {
|
422
|
-
_context2.next =
|
417
|
+
_context2.next = 25;
|
423
418
|
break;
|
424
419
|
}
|
425
420
|
return _context2.abrupt("return", resolve({
|
426
421
|
success: false
|
427
422
|
}));
|
428
|
-
case
|
429
|
-
_context2.next =
|
423
|
+
case 25:
|
424
|
+
_context2.next = 27;
|
430
425
|
return _this5.getDeviceIdAndLog();
|
431
|
-
case
|
426
|
+
case 27:
|
432
427
|
envInfo.deviceId = _context2.sent;
|
433
|
-
case
|
428
|
+
case 28:
|
434
429
|
_this5.AMSSDK.logger.logInfo({
|
435
430
|
title: 'sdk_event_sdkQuery'
|
436
431
|
}, {
|
@@ -466,7 +461,7 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
466
461
|
paymentSessionConfig: JSON.stringify(params.paymentSessionConfig)
|
467
462
|
}).send();
|
468
463
|
});
|
469
|
-
case
|
464
|
+
case 30:
|
470
465
|
case "end":
|
471
466
|
return _context2.stop();
|
472
467
|
}
|
@@ -1224,7 +1219,6 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
1224
1219
|
renderDisplayType: (_this$_renderParams8 = this._renderParams) === null || _this$_renderParams8 === void 0 ? void 0 : _this$_renderParams8.renderDisplayType,
|
1225
1220
|
appearance: (_this$_renderParams9 = this._renderParams) === null || _this$_renderParams9 === void 0 ? void 0 : _this$_renderParams9.appearance,
|
1226
1221
|
notRedirectAfterComplete: ((_this$_renderParams10 = this._renderParams) === null || _this$_renderParams10 === void 0 ? void 0 : _this$_renderParams10.notRedirectAfterComplete) === true,
|
1227
|
-
merchantAppointParam: this._merchantAppointParam,
|
1228
1222
|
envInfo: {
|
1229
1223
|
screenHeight: screen.height,
|
1230
1224
|
screenWidth: screen.width
|
package/esm/request/index.js
CHANGED
@@ -50,8 +50,6 @@ function requestInstance(options) {
|
|
50
50
|
withCredentials: (_options$withCredenti = options.withCredentials) !== null && _options$withCredenti !== void 0 ? _options$withCredenti : true,
|
51
51
|
method: (options === null || options === void 0 ? void 0 : options.method) || 'POST'
|
52
52
|
});
|
53
|
-
console.log('baseURL', baseURL);
|
54
|
-
console.log('_headers', _headers);
|
55
53
|
return instance.request;
|
56
54
|
}
|
57
55
|
|
@@ -99,25 +97,21 @@ function _request() {
|
|
99
97
|
})];
|
100
98
|
startTime = Date.now();
|
101
99
|
_context.prev = 5;
|
102
|
-
console.log('requestInstance options', options);
|
103
|
-
console.log('requestInstance -data', _data);
|
104
100
|
myRequest = requestInstance(options);
|
105
|
-
_context.next =
|
101
|
+
_context.next = 9;
|
106
102
|
return myRequest({
|
107
103
|
data: _data
|
108
104
|
});
|
109
|
-
case
|
105
|
+
case 9:
|
110
106
|
_yield$myRequest = _context.sent;
|
111
107
|
data = _yield$myRequest.data;
|
112
108
|
headers = _yield$myRequest.headers;
|
113
|
-
console.log('requestInstance data', data);
|
114
|
-
console.log('requestInstance headers', headers);
|
115
109
|
resData = data || {};
|
116
110
|
traceId = get(headers, 'Mgw-TraceId') || get(headers, 'mgw-traceid', '');
|
117
111
|
resData.traceId = traceId || '';
|
118
112
|
handleGetWayError = fomatGetwayError(headers, traceId);
|
119
113
|
if (!(handleGetWayError !== null && handleGetWayError !== void 0 && handleGetWayError.errorCode)) {
|
120
|
-
_context.next =
|
114
|
+
_context.next = 21;
|
121
115
|
break;
|
122
116
|
}
|
123
117
|
errorMessage = (resData === null || resData === void 0 ? void 0 : resData.errorMessage) || (handleGetWayError === null || handleGetWayError === void 0 ? void 0 : handleGetWayError.errorMessage);
|
@@ -136,7 +130,7 @@ function _request() {
|
|
136
130
|
errorCode: errorCode,
|
137
131
|
success: false
|
138
132
|
}));
|
139
|
-
case
|
133
|
+
case 21:
|
140
134
|
logger.reportRPC({
|
141
135
|
name: options === null || options === void 0 ? void 0 : options['Operation-Type'],
|
142
136
|
label: 'request',
|
@@ -147,8 +141,8 @@ function _request() {
|
|
147
141
|
traceId: traceId
|
148
142
|
}).send();
|
149
143
|
return _context.abrupt("return", resData);
|
150
|
-
case
|
151
|
-
_context.prev =
|
144
|
+
case 25:
|
145
|
+
_context.prev = 25;
|
152
146
|
_context.t0 = _context["catch"](5);
|
153
147
|
_error = safeJson(_context.t0 === null || _context.t0 === void 0 ? void 0 : _context.t0.message, {
|
154
148
|
success: false,
|
@@ -170,11 +164,11 @@ function _request() {
|
|
170
164
|
errorCode: _errorCode,
|
171
165
|
errorMessage: _error === null || _error === void 0 ? void 0 : _error.message
|
172
166
|
}));
|
173
|
-
case
|
167
|
+
case 32:
|
174
168
|
case "end":
|
175
169
|
return _context.stop();
|
176
170
|
}
|
177
|
-
}, _callee, null, [[5,
|
171
|
+
}, _callee, null, [[5, 25]]);
|
178
172
|
}));
|
179
173
|
return _request.apply(this, arguments);
|
180
174
|
}
|
package/esm/service/index.d.ts
CHANGED
@@ -1,13 +1,5 @@
|
|
1
|
-
import {
|
1
|
+
import { CashierSdkActionQueryRequest, CashierSdkActionQueryResult, CashierSubmitPayRequest, CashierSubmitPayResult, RequestConfig } from '../types';
|
2
2
|
import { Logger } from '../util/logger';
|
3
3
|
export declare function queryPaymentInfo(params: CashierSdkActionQueryRequest, options: RequestConfig, logger: Logger): Promise<CashierSdkActionQueryResult>;
|
4
4
|
export declare function antomConfig(options: RequestConfig, logger: Logger): Promise<any>;
|
5
5
|
export declare function submitPayInfo(params: CashierSubmitPayRequest, options: RequestConfig, logger: Logger): Promise<CashierSubmitPayResult>;
|
6
|
-
/**
|
7
|
-
* Get merchant session by Apple Pay
|
8
|
-
* @param paymentSessionData
|
9
|
-
* @param params
|
10
|
-
* @param options
|
11
|
-
* @param logger
|
12
|
-
*/
|
13
|
-
export declare function getApplePayPaymentSession(paymentSessionData: string, params: ApplePayPaymentSessionRequest, options: RequestConfig, logger: Logger): Promise<ApplePayPaymentSessionResult>;
|
package/esm/service/index.js
CHANGED
@@ -78,14 +78,6 @@ 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
|
-
*/
|
89
81
|
function _submitPayInfo() {
|
90
82
|
_submitPayInfo = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(params, options, logger) {
|
91
83
|
var hostSign;
|
@@ -105,27 +97,4 @@ function _submitPayInfo() {
|
|
105
97
|
}, _callee3);
|
106
98
|
}));
|
107
99
|
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);
|
131
100
|
}
|
package/esm/types/index.d.ts
CHANGED
@@ -24,8 +24,6 @@ export interface IoptionsParams {
|
|
24
24
|
};
|
25
25
|
product?: string;
|
26
26
|
}
|
27
|
-
export interface IApplePayOptionsParams extends Pick<IoptionsParams, 'locale' | 'environment' | 'onEventCallback' | 'analytics'> {
|
28
|
-
}
|
29
27
|
export type Iselector = string;
|
30
28
|
export declare enum renderDisplayTypeEnum {
|
31
29
|
'popup' = "popup",
|
@@ -53,8 +51,7 @@ export declare enum productSceneEnum {
|
|
53
51
|
'CASHIER_PAYMENT' = "CASHIER_PAYMENT",
|
54
52
|
'AUTO_DEBIT' = "AUTO_DEBIT",
|
55
53
|
'VAULTING' = "VAULTING",
|
56
|
-
'FLASH_BUY' = "FLASH_BUY"
|
57
|
-
'CARD_APPLE_PAY' = "CARD_APPLE_PAY"
|
54
|
+
'FLASH_BUY' = "FLASH_BUY"
|
58
55
|
}
|
59
56
|
export declare enum paymentMethodCategoryTypeEnum {
|
60
57
|
'CARD' = "CARD",
|
@@ -71,21 +68,14 @@ export interface DeviceIdParameter {
|
|
71
68
|
export interface IcreateComponent {
|
72
69
|
sessionData: string;
|
73
70
|
paymentSessionData?: string;
|
74
|
-
notRedirectAfterComplete?: boolean;
|
75
71
|
appearance?: Record<string, any>;
|
76
|
-
|
72
|
+
notRedirectAfterComplete?: boolean;
|
77
73
|
}
|
78
74
|
export interface IappendIframeNodesParams extends IcreateComponent {
|
79
75
|
paymentSessionMetaData: IpaymentSessionMetaData;
|
80
76
|
renderDisplayType: renderDisplayTypeEnum;
|
81
77
|
selector?: Iselector;
|
82
78
|
}
|
83
|
-
export interface IMerchantAppointParam {
|
84
|
-
storedCard?: IStoredCard;
|
85
|
-
}
|
86
|
-
export interface IStoredCard {
|
87
|
-
needCVV?: boolean;
|
88
|
-
}
|
89
79
|
export interface IbillingAddress {
|
90
80
|
region?: string;
|
91
81
|
address1?: string;
|
@@ -132,26 +122,6 @@ export interface IpaymentSessionMetaData {
|
|
132
122
|
autoDebitWithToken: boolean;
|
133
123
|
skipSdkQuery: boolean;
|
134
124
|
};
|
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
|
-
};
|
155
125
|
}
|
156
126
|
export declare enum localeEnum {
|
157
127
|
'en-US' = "en-US"
|
@@ -311,7 +281,6 @@ export interface CashierSdkActionQueryRequest {
|
|
311
281
|
paymentSessionConfig?: IpaymentSessionConfig;
|
312
282
|
paymentMethodType?: string;
|
313
283
|
notRedirectAfterComplete?: boolean;
|
314
|
-
merchantAppointParam?: IMerchantAppointParam;
|
315
284
|
extParams?: any;
|
316
285
|
}
|
317
286
|
export interface CashierSubmitPayRequest {
|
@@ -354,23 +323,6 @@ export interface CashierSdkActionQueryResult {
|
|
354
323
|
schemeUrl?: string;
|
355
324
|
authUrl?: string;
|
356
325
|
}
|
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
|
-
}
|
374
326
|
export declare enum redirectTypeEnum {
|
375
327
|
UNSAFE_BROWSER = "UNSAFE_BROWSER",
|
376
328
|
SAFETY_BROWSER = "SAFETY_BROWSER",
|
@@ -403,10 +355,7 @@ export declare enum eventCodeEnum {
|
|
403
355
|
SDK_INIT_PARAMETER_ERROR = "SDK_INIT_PARAMETER_ERROR",
|
404
356
|
SDK_CREATECOMPONENT_ERROR = "SDK_CREATECOMPONENT_ERROR",
|
405
357
|
SDK_CALL_URL_ERROR = "SDK_CALL_URL_ERROR",
|
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"
|
358
|
+
SDK_CALL_URL_SUCCESS = "SDK_CALL_URL_SUCCESS"
|
410
359
|
}
|
411
360
|
export declare enum RedirectType {
|
412
361
|
ApplinkUrl = "ApplinkUrl",
|
package/esm/types/index.js
CHANGED
@@ -30,7 +30,6 @@ 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";
|
34
33
|
return productSceneEnum;
|
35
34
|
}({});
|
36
35
|
export var paymentMethodCategoryTypeEnum = /*#__PURE__*/function (paymentMethodCategoryTypeEnum) {
|
@@ -126,15 +125,6 @@ export var errorEnum = /*#__PURE__*/function (errorEnum) {
|
|
126
125
|
errorEnum["GETSIGNPARAMSERROR"] = "GETSIGNPARAMSERROR";
|
127
126
|
return errorEnum;
|
128
127
|
}({});
|
129
|
-
|
130
|
-
/**
|
131
|
-
* Get App Pay Payment Session Request.
|
132
|
-
*/
|
133
|
-
|
134
|
-
/**
|
135
|
-
* Get App Pay Payment Session Result.
|
136
|
-
*/
|
137
|
-
|
138
128
|
export var redirectTypeEnum = /*#__PURE__*/function (redirectTypeEnum) {
|
139
129
|
redirectTypeEnum["UNSAFE_BROWSER"] = "UNSAFE_BROWSER";
|
140
130
|
redirectTypeEnum["SAFETY_BROWSER"] = "SAFETY_BROWSER";
|
@@ -150,9 +140,6 @@ export var eventCodeEnum = /*#__PURE__*/function (eventCodeEnum) {
|
|
150
140
|
eventCodeEnum["SDK_CREATECOMPONENT_ERROR"] = "SDK_CREATECOMPONENT_ERROR";
|
151
141
|
eventCodeEnum["SDK_CALL_URL_ERROR"] = "SDK_CALL_URL_ERROR";
|
152
142
|
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";
|
156
143
|
return eventCodeEnum;
|
157
144
|
}({});
|
158
145
|
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(
|
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');
|
28
28
|
export var getSecurityHost = function getSecurityHost(region) {
|
29
29
|
return securityHost[region] || securityHost[SecurityRegionEnum.SG];
|
30
30
|
};
|
package/package.json
CHANGED
@@ -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
|
-
}
|
1
|
+
{"name":"@alipay/ams-checkout","version":"0.0.1704984575-dev.0","description":"","author":"","main":"esm/index.js","module":"esm/index.js","typings":"esm/index.d.ts","files":["dist","esm","LEGAL.md","LICENSE","README.md"],"scripts":{"build":"father build","ci":"npm run lint","cov":"jest --coverage","format":"prettier --write --no-error-on-unmatched-pattern \"**/*.{js,jsx,ts,tsx,md,json,css,less}\"","lint":"eslint ./src","test":"jest"},"dependencies":{"axios":"^1.3.4","uuid":"^9.0.0"},"devDependencies":{"@babel/core":"^7.20.7","@babel/preset-env":"^7.20.2","@testing-library/jest-dom":"^5.1.1","@testing-library/react":"^9.5.0","@types/jest":"^29.2.4","@types/uuid":"^9.0.0","@typescript-eslint/eslint-plugin":"latest","@typescript-eslint/parser":"^5.60.0","babel-jest":"^29.3.1","babel-loader":"^9.1.0","babel-plugin-import":"^1.13.0","eslint":"^8.36.0","eslint-plugin-prettier":"latest","father":"^4.2.3","jest":"^29.5.0","jest-environment-jsdom":"^29.3.1","prettier":"^2.8.4","prettier-plugin-organize-imports":"^3.2.3","prettier-plugin-packagejson":"^2.4.5","ts-jest":"^29.0.3","ts-node":"^10.9.1","typescript":"^4.9.5"},"engines":{},"publishConfig":{"access":"public"}}
|