@alipay/ams-checkout 0.0.1710212811-dev.0 → 0.0.1710212811-dev.10
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/core/bus/ability/sdk.d.ts +9 -0
- package/esm/core/bus/ability/sdk.js +55 -0
- package/esm/core/bus/index.d.ts +63 -0
- package/esm/core/bus/index.js +287 -0
- package/esm/core/bus/interface.d.ts +24 -0
- package/esm/core/bus/interface.js +31 -0
- package/esm/core/component/index.d.ts +7 -1
- package/esm/core/component/index.js +91 -17
- package/esm/core/instance/index.d.ts +1 -0
- package/esm/core/instance/index.js +2 -0
- package/esm/index.d.ts +1 -1
- package/esm/index.js +1 -1
- package/esm/{common/applepay/index.d.ts → plugin/applepay/apple.d.ts} +5 -3
- package/esm/{common/applepay/index.js → plugin/applepay/apple.js} +84 -20
- package/esm/{core/applepay/index.d.ts → plugin/applepay/component.d.ts} +5 -2
- package/esm/{core/applepay/index.js → plugin/applepay/component.js} +16 -7
- package/esm/plugin/applepay/index.d.ts +15 -0
- package/esm/plugin/applepay/index.js +99 -0
- package/esm/{common → plugin}/applepay/interface.d.ts +61 -0
- package/esm/plugin/applepay/interface.js +73 -0
- package/esm/plugin/component/index.js +9 -9
- package/esm/types/index.d.ts +47 -2
- package/esm/types/index.js +8 -0
- package/package.json +1 -1
- package/esm/common/applepay/interface.js +0 -1
@@ -6,6 +6,8 @@
|
|
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
|
export type Version = 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9;
|
9
|
+
export declare const APPLE_PAY_VERSION = 2;
|
10
|
+
export declare const APPLE_PAY_RECURRING_VERSION = 14;
|
9
11
|
export interface IApplePayValidateMerchantEvent {
|
10
12
|
validationURL: string;
|
11
13
|
}
|
@@ -35,10 +37,41 @@ export interface IApplePayPaymentContact {
|
|
35
37
|
countryCode: string;
|
36
38
|
}
|
37
39
|
export type IApplePayLineItemType = 'final' | 'pending';
|
40
|
+
export type ApplePayPaymentTiming = "immediate" | "recurring" | "deferred" | "automaticReload";
|
41
|
+
export type ApplePayRecurringPaymentDateUnit = "year" | "month" | "day" | "hour" | "minute";
|
42
|
+
/**
|
43
|
+
*
|
44
|
+
{
|
45
|
+
"label": "Subscription",
|
46
|
+
"amount": "20.00",
|
47
|
+
"type": "final",
|
48
|
+
"paymentTiming": "recurring",
|
49
|
+
"recurringPaymentStartDate": new Date("2022-01-01T00:00:00"),
|
50
|
+
"recurringPaymentIntervalUnit": "month",
|
51
|
+
"recurringPaymentIntervalCount": 6,
|
52
|
+
"recurringPaymentEndDate": new Date("2024-01-01T00:00:00"),
|
53
|
+
}
|
54
|
+
*/
|
38
55
|
export interface IApplePayLineItem {
|
56
|
+
/**
|
57
|
+
* A value that indicates whether the line item is final or pending.
|
58
|
+
*/
|
39
59
|
type: IApplePayLineItemType;
|
60
|
+
/**
|
61
|
+
* A required value that’s a short, localized description of the line item.
|
62
|
+
*/
|
40
63
|
label: string;
|
64
|
+
/**
|
65
|
+
* A required value that’s the monetary amount of the line item.
|
66
|
+
*/
|
41
67
|
amount: string;
|
68
|
+
paymentTiming?: ApplePayPaymentTiming;
|
69
|
+
recurringPaymentStartDate?: Date;
|
70
|
+
recurringPaymentEndDate?: Date;
|
71
|
+
recurringPaymentIntervalUnit?: ApplePayRecurringPaymentDateUnit;
|
72
|
+
recurringPaymentIntervalCount?: number;
|
73
|
+
deferredPaymentDate?: Date;
|
74
|
+
automaticReloadPaymentThresholdAmount?: string;
|
42
75
|
}
|
43
76
|
export type applePayShippingType = 'shipping' | 'delivery' | 'storePickup' | 'servicePickup';
|
44
77
|
export interface IApplePayShippingMethod {
|
@@ -75,6 +108,34 @@ export interface IApplePayPaymentRequest {
|
|
75
108
|
currencyCode: string;
|
76
109
|
shippingType?: applePayShippingType;
|
77
110
|
shippingMethods?: IApplePayShippingMethod[];
|
111
|
+
recurringPaymentRequest?: IApplePayRecurringPaymentRequest;
|
112
|
+
}
|
113
|
+
export interface IApplePayRecurringPaymentRequest {
|
114
|
+
/**
|
115
|
+
* A description of the recurring payment that Apple Pay displays to the user in the payment sheet.
|
116
|
+
*/
|
117
|
+
paymentDescription: string;
|
118
|
+
/**
|
119
|
+
* A localized billing agreement that the payment sheet displays to the user before the user authorizes the payment.
|
120
|
+
*/
|
121
|
+
billingAgreement?: string;
|
122
|
+
/**
|
123
|
+
* The regular billing cycle for the recurring payment, including start and end dates, an interval, and an interval count.
|
124
|
+
*/
|
125
|
+
regularBilling: IApplePayLineItem;
|
126
|
+
/**
|
127
|
+
* 订阅试用的周期控制,暂时不需要
|
128
|
+
* The trial billing cycle for the recurring payment.
|
129
|
+
*/
|
130
|
+
trialBilling?: IApplePayLineItem;
|
131
|
+
/**
|
132
|
+
* A URL to a web page where the user can update or delete the payment method for the recurring payment.
|
133
|
+
*/
|
134
|
+
managementURL: string;
|
135
|
+
/**
|
136
|
+
* A URL you provide for receiving life-cycle notifications from the Apple Pay servers about the Apple Pay merchant token for the recurring payment.
|
137
|
+
*/
|
138
|
+
tokenNotificationURL?: string;
|
78
139
|
}
|
79
140
|
export interface IApplePaySession {
|
80
141
|
supportsVersion?: (version: Version) => boolean;
|
@@ -0,0 +1,73 @@
|
|
1
|
+
/**
|
2
|
+
* Copyright (c) 2022 International Business Group, Ant Group. All rights reserved.
|
3
|
+
*
|
4
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), the rights to use, copy, modify, merge, and/or distribute the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
5
|
+
* 1. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE; and
|
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
|
+
*/
|
8
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
9
|
+
// https://developer.apple.com/documentation/apple_pay_on_the_web/apple_pay_on_the_web_version_history
|
10
|
+
|
11
|
+
export var APPLE_PAY_VERSION = 2;
|
12
|
+
export var APPLE_PAY_RECURRING_VERSION = 14;
|
13
|
+
|
14
|
+
// https://developer.apple.com/documentation/apple_pay_on_the_web/applepayvalidatemerchantevent
|
15
|
+
|
16
|
+
// https://developer.apple.com/documentation/apple_pay_on_the_web/applepaymerchantcapability
|
17
|
+
|
18
|
+
// https://developer.apple.com/documentation/apple_pay_on_the_web/applepaypaymentrequest/1916122-supportednetworks
|
19
|
+
|
20
|
+
// https://developer.apple.com/documentation/apple_pay_on_the_web/applepaycontactfield
|
21
|
+
|
22
|
+
// https://developer.apple.com/documentation/apple_pay_on_the_web/applepaypaymentcontact
|
23
|
+
|
24
|
+
// https://developer.apple.com/documentation/apple_pay_on_the_web/applepaylineitemtype
|
25
|
+
|
26
|
+
//https://developer.apple.com/documentation/apple_pay_on_the_web/applepaypaymenttiming
|
27
|
+
|
28
|
+
//https://developer.apple.com/documentation/apple_pay_on_the_web/applepayrecurringpaymentdateunit
|
29
|
+
|
30
|
+
// https://developer.apple.com/documentation/apple_pay_on_the_web/applepaylineitem
|
31
|
+
/**
|
32
|
+
*
|
33
|
+
{
|
34
|
+
"label": "Subscription",
|
35
|
+
"amount": "20.00",
|
36
|
+
"type": "final",
|
37
|
+
"paymentTiming": "recurring",
|
38
|
+
"recurringPaymentStartDate": new Date("2022-01-01T00:00:00"),
|
39
|
+
"recurringPaymentIntervalUnit": "month",
|
40
|
+
"recurringPaymentIntervalCount": 6,
|
41
|
+
"recurringPaymentEndDate": new Date("2024-01-01T00:00:00"),
|
42
|
+
}
|
43
|
+
*/
|
44
|
+
|
45
|
+
// https://developer.apple.com/documentation/apple_pay_on_the_web/applepayshippingtype
|
46
|
+
|
47
|
+
// https://developer.apple.com/documentation/apple_pay_on_the_web/applepayshippingmethod
|
48
|
+
|
49
|
+
// https://developer.apple.com/documentation/apple_pay_on_the_web/applepaypayment
|
50
|
+
|
51
|
+
// https://developer.apple.com/documentation/apple_pay_on_the_web/applepaypaymentauthorizedevent
|
52
|
+
|
53
|
+
// https://developer.apple.com/documentation/apple_pay_on_the_web/apple_pay_js_api/apple_pay_status_codes
|
54
|
+
|
55
|
+
// https://developer.apple.com/documentation/apple_pay_on_the_web/applepaypaymentauthorizationresult
|
56
|
+
|
57
|
+
// https://developer.apple.com/documentation/apple_pay_on_the_web/applepaypaymentrequest
|
58
|
+
|
59
|
+
// https://developer.apple.com/documentation/apple_pay_on_the_web/applepayrecurringpaymentrequest
|
60
|
+
|
61
|
+
// https://developer.apple.com/documentation/apple_pay_on_the_web/applepaysession
|
62
|
+
|
63
|
+
// IGetMerchantSession spi type
|
64
|
+
|
65
|
+
// ICompletePaymentAuthorized spi type
|
66
|
+
|
67
|
+
// ICompleteApplePay spi type
|
68
|
+
|
69
|
+
// ILogError spi type
|
70
|
+
|
71
|
+
// trace msg type
|
72
|
+
|
73
|
+
// IApplePayTrace spi type
|
@@ -364,7 +364,7 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
364
364
|
this._actionQueryPromise = new Promise( /*#__PURE__*/function () {
|
365
365
|
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(resolve, reject) {
|
366
366
|
var _this5$_renderParams, _this5$_renderParams2, _this5$_renderParams3, _this5$_renderParams4, _this5$_renderParams5;
|
367
|
-
var envInfo, params,
|
367
|
+
var envInfo, params, _ref3, extendInfo, enableVaultingApiOptimize, enableEasypayApiOptimize, extendInfoData, _this5$_renderParams6, _this5$_renderParams7, _ref4, _ref4$productSceneVer, productSceneVersion, _ref4$productScene, productScene, _ref5, _ref5$action, _ref5$action2, _ref5$action2$autoDeb, autoDebitWithToken, _this5$_renderParams8, _action$web, _action$wap, action, signType;
|
368
368
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
369
369
|
while (1) switch (_context2.prev = _context2.next) {
|
370
370
|
case 0:
|
@@ -380,7 +380,7 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
380
380
|
/**
|
381
381
|
* @description Simulated or unnecessary scenarios
|
382
382
|
*/
|
383
|
-
|
383
|
+
_ref3 = ((_this5$_renderParams4 = _this5._renderParams) === null || _this5$_renderParams4 === void 0 ? void 0 : _this5$_renderParams4.paymentSessionMetaData) || {}, extendInfo = _ref3.extendInfo;
|
384
384
|
enableVaultingApiOptimize = false;
|
385
385
|
enableEasypayApiOptimize = false;
|
386
386
|
try {
|
@@ -427,8 +427,8 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
427
427
|
_context2.next = 26;
|
428
428
|
break;
|
429
429
|
}
|
430
|
-
|
431
|
-
|
430
|
+
_ref4 = params.paymentSessionConfig || {}, _ref4$productSceneVer = _ref4.productSceneVersion, productSceneVersion = _ref4$productSceneVer === void 0 ? '' : _ref4$productSceneVer, _ref4$productScene = _ref4.productScene, productScene = _ref4$productScene === void 0 ? '' : _ref4$productScene;
|
431
|
+
_ref5 = ((_this5$_renderParams6 = _this5._renderParams) === null || _this5$_renderParams6 === void 0 ? void 0 : _this5$_renderParams6.paymentSessionMetaData) || {}, _ref5$action = _ref5.action, _ref5$action2 = _ref5$action === void 0 ? {} : _ref5$action, _ref5$action2$autoDeb = _ref5$action2.autoDebitWithToken, autoDebitWithToken = _ref5$action2$autoDeb === void 0 ? false : _ref5$action2$autoDeb;
|
432
432
|
if (!((_this5$_renderParams7 = _this5._renderParams) !== null && _this5$_renderParams7 !== void 0 && (_this5$_renderParams7 = _this5$_renderParams7.paymentSessionMetaData) !== null && _this5$_renderParams7 !== void 0 && (_this5$_renderParams7 = _this5$_renderParams7.action) !== null && _this5$_renderParams7 !== void 0 && _this5$_renderParams7.skipSdkQuery && enableEasypayApiOptimize)) {
|
433
433
|
_context2.next = 21;
|
434
434
|
break;
|
@@ -542,7 +542,7 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
542
542
|
|
543
543
|
// eslint-disable-next-line no-async-promise-executor
|
544
544
|
this._actionSubmitPromise = new Promise( /*#__PURE__*/function () {
|
545
|
-
var
|
545
|
+
var _ref6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(resolve) {
|
546
546
|
var _this6$_renderParams;
|
547
547
|
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
548
548
|
while (1) switch (_context3.prev = _context3.next) {
|
@@ -605,7 +605,7 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
605
605
|
}, _callee3);
|
606
606
|
}));
|
607
607
|
return function (_x3) {
|
608
|
-
return
|
608
|
+
return _ref6.apply(this, arguments);
|
609
609
|
};
|
610
610
|
}());
|
611
611
|
}
|
@@ -1196,9 +1196,9 @@ var ComponentApp = /*#__PURE__*/function () {
|
|
1196
1196
|
}
|
1197
1197
|
}, {
|
1198
1198
|
key: "handleDeclareInfo",
|
1199
|
-
value: function handleDeclareInfo(
|
1200
|
-
var
|
1201
|
-
closeDialogData =
|
1199
|
+
value: function handleDeclareInfo(_ref7) {
|
1200
|
+
var _ref7$closeDialogData = _ref7.closeDialogData,
|
1201
|
+
closeDialogData = _ref7$closeDialogData === void 0 ? {} : _ref7$closeDialogData;
|
1202
1202
|
_handleDeclareInfo({
|
1203
1203
|
closeDialogData: closeDialogData
|
1204
1204
|
});
|
package/esm/types/index.d.ts
CHANGED
@@ -135,16 +135,17 @@ export interface IpaymentSessionMetaData {
|
|
135
135
|
skipSdkQuery: boolean;
|
136
136
|
};
|
137
137
|
paymentSessionFactor?: {
|
138
|
-
|
138
|
+
extendInfo?: {
|
139
139
|
merchantCapabilities?: string[];
|
140
140
|
supportedNetworks?: string[];
|
141
141
|
};
|
142
142
|
merchantInfo?: {
|
143
143
|
registeredCountry?: string;
|
144
144
|
partnerId?: string;
|
145
|
+
merchantName?: string;
|
145
146
|
};
|
146
147
|
order?: {
|
147
|
-
orderDescription
|
148
|
+
orderDescription: string;
|
148
149
|
};
|
149
150
|
paymentAmount?: {
|
150
151
|
value?: string;
|
@@ -156,6 +157,43 @@ export interface IpaymentSessionMetaData {
|
|
156
157
|
paymentMethodViewMetaData?: any;
|
157
158
|
paymentRequestId?: string;
|
158
159
|
supportedLanguages?: any;
|
160
|
+
/**
|
161
|
+
* 当前为苹果分期场景的信息
|
162
|
+
*/
|
163
|
+
recurringInfo?: {
|
164
|
+
/**
|
165
|
+
* 代扣协议开始日期 不传为当前系统时间
|
166
|
+
*/
|
167
|
+
startDate?: number;
|
168
|
+
/**
|
169
|
+
* 代扣协议结束日期 不传不限制结束时间
|
170
|
+
*/
|
171
|
+
endDate?: number;
|
172
|
+
/**
|
173
|
+
* 付款时间间隔单位,支持:"year" "month" "day" "hour" "minute" 不传默认month
|
174
|
+
*/
|
175
|
+
intervalUnit?: string;
|
176
|
+
/**
|
177
|
+
* 付款时间间隔。比如每过6个月付款一次,intervalCount就是6, 不传默认为1
|
178
|
+
*/
|
179
|
+
intervalCount?: number;
|
180
|
+
/**
|
181
|
+
* 分期标题信息
|
182
|
+
*/
|
183
|
+
title?: string;
|
184
|
+
/**
|
185
|
+
* 分期管理页面
|
186
|
+
*/
|
187
|
+
managementURL?: string;
|
188
|
+
/**
|
189
|
+
* 苹果通知ipay MAPN信息变更的地址
|
190
|
+
*/
|
191
|
+
tokenNotificationURL?: string;
|
192
|
+
/**
|
193
|
+
* 分期协议描述
|
194
|
+
*/
|
195
|
+
agreementDescription?: string;
|
196
|
+
};
|
159
197
|
};
|
160
198
|
}
|
161
199
|
export declare enum localeEnum {
|
@@ -433,4 +471,11 @@ export interface CallbackEventInfo {
|
|
433
471
|
export interface MultipleCallbackEvents {
|
434
472
|
[key: string]: CallbackEventInfo;
|
435
473
|
}
|
474
|
+
export declare enum PaymentMethodTypeEnum {
|
475
|
+
ApplePay = "ApplePay"
|
476
|
+
}
|
477
|
+
export declare enum ApplePaySubTypeEnum {
|
478
|
+
ApplePayRecurringPayment = "ApplePayRecurringPayment"
|
479
|
+
}
|
480
|
+
export type SubPaymentMethodTypeEnum = ApplePaySubTypeEnum;
|
436
481
|
export {};
|
package/esm/types/index.js
CHANGED
@@ -164,4 +164,12 @@ export var RedirectType = /*#__PURE__*/function (RedirectType) {
|
|
164
164
|
RedirectType["NormalUrl"] = "NormalUrl";
|
165
165
|
RedirectType["Unknown"] = "Unknown";
|
166
166
|
return RedirectType;
|
167
|
+
}({});
|
168
|
+
export var PaymentMethodTypeEnum = /*#__PURE__*/function (PaymentMethodTypeEnum) {
|
169
|
+
PaymentMethodTypeEnum["ApplePay"] = "ApplePay";
|
170
|
+
return PaymentMethodTypeEnum;
|
171
|
+
}({});
|
172
|
+
export var ApplePaySubTypeEnum = /*#__PURE__*/function (ApplePaySubTypeEnum) {
|
173
|
+
ApplePaySubTypeEnum["ApplePayRecurringPayment"] = "ApplePayRecurringPayment";
|
174
|
+
return ApplePaySubTypeEnum;
|
167
175
|
}({});
|
package/package.json
CHANGED
@@ -1 +0,0 @@
|
|
1
|
-
export {};
|