@alipay/ams-checkout 0.0.1745390310-dev.6 → 0.0.1746673215-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.
@@ -1,540 +0,0 @@
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
- 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;
11
- export interface IApplePayValidateMerchantEvent {
12
- validationURL: string;
13
- }
14
- export type ApplePayMerchantCapability = 'supports3DS' | 'supportsEMV' | 'supportsCredit' | 'supportsDebit';
15
- export type PaymentNetwork = 'amex' | 'cartesBancaires' | 'chinaUnionPay' | 'discover' | 'eftpos' | 'electron' | 'elo' | 'interac' | 'jcb' | 'mada' | 'maestro' | 'masterCard' | 'privateLabel' | 'visa' | 'vPay';
16
- export interface IApplePayContactField {
17
- email: string;
18
- name: string;
19
- phone: string;
20
- postalAddress: string;
21
- phoneticName: string;
22
- }
23
- export declare enum RedirectTypeEnum {
24
- TWO_D = "TWO_D",
25
- THREE_D_IDENTIFICATION = "THREE_D_IDENTIFICATION",
26
- THREE_D_ENROLLED = "THREE_D_ENROLLED"
27
- }
28
- export declare enum PaymentStatusType {
29
- SUCCESS = "SUCCESS",
30
- PROCESSING = "PROCESSING",
31
- FAIL = "FAIL",
32
- CANCELLED = "CANCELLED",
33
- EXPIRED = "EXPIRED"
34
- }
35
- export type DisplayType = 'TEXT_BUTTON' | 'TEXT_ICON' | 'QRCODE' | 'QRCODE_IMAGE' | 'TEXT_REMINDER';
36
- export interface Instructions {
37
- /**
38
- * @description title
39
- */
40
- title: string;
41
- /**
42
- * @description steps
43
- */
44
- steps: string;
45
- /**
46
- * @description unfold
47
- */
48
- unfolded?: boolean;
49
- }
50
- export interface ApplePayPaymentSessionRequest {
51
- validateUrl: string;
52
- paymentSessionData: string;
53
- }
54
- export interface ActionForm {
55
- redirectUrl?: string;
56
- method?: 'POST' | 'GET';
57
- actionFormType?: any;
58
- parameters?: string;
59
- redirectType: RedirectTypeEnum;
60
- challengeType?: 'EMAIL_OTP' | string;
61
- paymentCodeExpireTime?: string;
62
- verifyId?: string;
63
- }
64
- export interface RateInfo {
65
- rateId: string;
66
- effectiveTime: string;
67
- expireTime: string;
68
- rate: {
69
- rate: string;
70
- rateValue: number;
71
- exchangeCurrency: string;
72
- baseCurrency: string;
73
- exchangeRelation: string;
74
- };
75
- }
76
- export interface CodeFormViews {
77
- /**
78
- * @description title
79
- */
80
- title: string;
81
- /**
82
- * @description code
83
- */
84
- code: string;
85
- /**
86
- * @description priority
87
- */
88
- priority: string;
89
- /**
90
- * @description displayType
91
- */
92
- displayType: DisplayType;
93
- /**
94
- * @description catogory
95
- */
96
- catogory?: string;
97
- /**
98
- * @description instructions
99
- */
100
- instructions?: Instructions[];
101
- label: string;
102
- /**
103
- * A+ 钱包展码过期时间
104
- */
105
- codeExpireTime?: string;
106
- }
107
- export interface IPaymentFeeChargeInfo {
108
- preChargeNo: string;
109
- chargeAmount: IAmount;
110
- chargeAmountView: IAmountView;
111
- }
112
- export interface InstructionGuideView {
113
- expireCountDown?: string;
114
- instructionGuideContent?: string;
115
- instructionGuideUrl?: string;
116
- logoUrl?: string;
117
- paymentMethodType?: string;
118
- }
119
- export interface CashierSubmitPayResult {
120
- actionForm?: ActionForm;
121
- applinkUrl?: string;
122
- normalUrl?: string;
123
- schemeUrl?: string;
124
- authUrl?: string;
125
- appIdentifier?: string;
126
- success: boolean;
127
- errorCode?: string;
128
- errorMessage?: string;
129
- errorStatus?: string;
130
- extendInfo?: any;
131
- rateInfo?: RateInfo;
132
- codeFormViews?: CodeFormViews[];
133
- paymentFeeChargeInfo?: IPaymentFeeChargeInfo;
134
- orderAmount: IAmount;
135
- orderAmountView: IAmountView;
136
- paymentAmount: IAmount;
137
- paymentAmountView: IAmountView;
138
- paymentExchangeAmount: IAmount;
139
- paymentExchangeAmountView?: IAmountView;
140
- instructionGuideView?: InstructionGuideView;
141
- paymentStatus?: PaymentStatusType;
142
- paymentResultCode?: string;
143
- paymentResultMessage?: string;
144
- }
145
- export interface IApplePayPaymentContact {
146
- phoneNumber: string;
147
- emailAddress: string;
148
- givenName: string;
149
- familyName: string;
150
- phoneticGivenName: string;
151
- phoneticFamilyName: string;
152
- addressLines: string;
153
- subLocality: string;
154
- locality: string;
155
- postalCode: string;
156
- subAdministrativeArea: string;
157
- administrativeArea: string;
158
- country: string;
159
- countryCode: string;
160
- }
161
- export type IApplePayLineItemType = 'final' | 'pending';
162
- export type ApplePayPaymentTiming = 'immediate' | 'recurring' | 'deferred' | 'automaticReload';
163
- export type ApplePayRecurringPaymentDateUnit = 'year' | 'month' | 'day' | 'hour' | 'minute';
164
- /**
165
- *
166
- {
167
- "label": "Subscription",
168
- "amount": "20.00",
169
- "type": "final",
170
- "paymentTiming": "recurring",
171
- "recurringPaymentStartDate": new Date("2022-01-01T00:00:00"),
172
- "recurringPaymentIntervalUnit": "month",
173
- "recurringPaymentIntervalCount": 6,
174
- "recurringPaymentEndDate": new Date("2024-01-01T00:00:00"),
175
- }
176
- */
177
- export interface IApplePayLineItem {
178
- /**
179
- * A value that indicates whether the line item is final or pending.
180
- */
181
- type: IApplePayLineItemType;
182
- /**
183
- * A required value that’s a short, localized description of the line item.
184
- */
185
- label: string;
186
- /**
187
- * A required value that’s the monetary amount of the line item.
188
- */
189
- amount: string;
190
- paymentTiming?: ApplePayPaymentTiming;
191
- recurringPaymentStartDate?: Date;
192
- recurringPaymentEndDate?: Date;
193
- recurringPaymentIntervalUnit?: ApplePayRecurringPaymentDateUnit;
194
- recurringPaymentIntervalCount?: number;
195
- deferredPaymentDate?: Date;
196
- automaticReloadPaymentThresholdAmount?: string;
197
- }
198
- export type applePayShippingType = 'shipping' | 'delivery' | 'storePickup' | 'servicePickup';
199
- export interface IApplePayShippingMethod {
200
- label: string;
201
- detail: string;
202
- amount: string;
203
- identifier: string;
204
- }
205
- export interface IApplePayPayment {
206
- token: any;
207
- billingContact?: IApplePayPaymentContact;
208
- shippingContact?: IApplePayPaymentContact;
209
- }
210
- export interface IApplePayPaymentAuthorizedEvent {
211
- payment: IApplePayPayment;
212
- }
213
- export type status = 'STATUS_SUCCESS' | 'STATUS_FAILURE' | 'STATUS_INVALID_BILLING_POSTAL_ADDRESS' | 'STATUS_INVALID_SHIPPING_POSTAL_ADDRESS' | 'STATUS_INVALID_SHIPPING_CONTACT' | 'STATUS_PIN_INCORRECT' | 'STATUS_PIN_LOCKOUT' | 'STATUS_PIN_REQUIRED';
214
- export interface IApplePayPaymentAuthorizationResult {
215
- status: any;
216
- errors?: string[];
217
- }
218
- export interface IApplePayPaymentRequest {
219
- merchantCapabilities?: string[];
220
- supportedNetworks?: string[];
221
- countryCode: string;
222
- requiredBillingContactFields?: IApplePayContactField[];
223
- billingContact?: IApplePayPaymentContact;
224
- requiredShippingContactFields?: IApplePayContactField[];
225
- shippingContact?: IApplePayPaymentContact;
226
- applicationData?: string;
227
- supportedCountries?: string[];
228
- total: IApplePayLineItem;
229
- lineItems?: IApplePayLineItem[];
230
- currencyCode: string;
231
- shippingType?: applePayShippingType;
232
- shippingMethods?: IApplePayShippingMethod[];
233
- recurringPaymentRequest?: IApplePayRecurringPaymentRequest;
234
- }
235
- export interface IApplePayRecurringPaymentRequest {
236
- /**
237
- * A description of the recurring payment that Apple Pay displays to the user in the payment sheet.
238
- */
239
- paymentDescription: string;
240
- /**
241
- * A localized billing agreement that the payment sheet displays to the user before the user authorizes the payment.
242
- */
243
- billingAgreement?: string;
244
- /**
245
- * The regular billing cycle for the recurring payment, including start and end dates, an interval, and an interval count.
246
- */
247
- regularBilling: IApplePayLineItem;
248
- /**
249
- * 订阅试用的周期控制,暂时不需要
250
- * The trial billing cycle for the recurring payment.
251
- */
252
- trialBilling?: IApplePayLineItem;
253
- /**
254
- * A URL to a web page where the user can update or delete the payment method for the recurring payment.
255
- */
256
- managementURL: string;
257
- /**
258
- * A URL you provide for receiving life-cycle notifications from the Apple Pay servers about the Apple Pay merchant token for the recurring payment.
259
- */
260
- tokenNotificationURL?: string;
261
- }
262
- export interface IApplePaySession {
263
- supportsVersion?: (version: Version) => boolean;
264
- canMakePayments?: () => boolean;
265
- canMakePaymentsWithActiveCard?: (merchantIdentifier: string) => Promise<boolean>;
266
- begin: () => void;
267
- onvalidatemerchant: (event: IApplePayValidateMerchantEvent) => void;
268
- completeMerchantValidation: (merchantSession: any) => void;
269
- onpaymentauthorized: (event: IApplePayPaymentAuthorizedEvent) => void;
270
- completePayment: (result: IApplePayPaymentAuthorizationResult) => void;
271
- oncancel?: () => void;
272
- abort?: () => void;
273
- }
274
- export type IGetMerchantSession = (params: {
275
- displayName?: string;
276
- merchantIdentifier?: string;
277
- validationUrl: string;
278
- }) => Promise<any>;
279
- export type ICompletePaymentAuthorized = (params: {
280
- paymentToken?: string;
281
- billingContact?: any;
282
- shippingContact?: any;
283
- }) => Promise<any>;
284
- export type ICompleteApplePay = (data: any) => void;
285
- export type ILogError = (code: string, msg: string, error?: any) => void;
286
- export declare enum ProductSceneEnum {
287
- 'EASY_PAY' = "EASY_PAY",
288
- 'CASHIER_PAYMENT' = "CASHIER_PAYMENT",
289
- 'AUTO_DEBIT' = "AUTO_DEBIT",
290
- 'AUTO_DEBIT_PAY' = "AUTO_DEBIT_PAY",
291
- 'VAULTING' = "VAULTING",
292
- 'FLASH_BUY' = "FLASH_BUY",
293
- 'CARD_APPLE_PAY' = "CARD_APPLE_PAY",
294
- 'CHECKOUT_PAYMENT' = "CHECKOUT_PAYMENT"
295
- }
296
- export type ApplePaySubTypeEnum = 'ApplePayRecurringPayment';
297
- export interface frontModulesToBeLoadedInterface {
298
- acquirerName: string;
299
- scriptUrl: string;
300
- }
301
- export declare enum PaymentMethodCategoryTypeEnum {
302
- 'CARD' = "CARD",
303
- 'WALLET' = "WALLET",
304
- 'BANK' = "BANK",
305
- 'APM' = "APM"
306
- }
307
- export interface IpaymentSessionConfig {
308
- productScene: ProductSceneEnum;
309
- paymentMethodCategoryType: PaymentMethodCategoryTypeEnum;
310
- productSceneVersion: string;
311
- }
312
- export interface IpaymentSecurityConfig {
313
- appId: string;
314
- appName: string;
315
- bizToken: string;
316
- gateway: string;
317
- h5gateway: string;
318
- tokenCollectTime?: string;
319
- dataPollingInterval?: string;
320
- workSpaceId: string;
321
- }
322
- export declare enum eventCodeEnum {
323
- SDK_START_OF_LOADING = "SDK_START_OF_LOADING",
324
- SDK_END_OF_LOADING = "SDK_END_OF_LOADING",
325
- SDK_INTERNAL_ERROR = "SDK_INTERNAL_ERROR",
326
- SDK_CREATEPAYMENT_PARAMETER_ERROR = "SDK_CREATEPAYMENT_PARAMETER_ERROR",
327
- SDK_INIT_PARAMETER_ERROR = "SDK_INIT_PARAMETER_ERROR",
328
- SDK_CREATECOMPONENT_ERROR = "SDK_CREATECOMPONENT_ERROR",
329
- SDK_CALL_URL_ERROR = "SDK_CALL_URL_ERROR",
330
- SDK_CALL_URL_SUCCESS = "SDK_CALL_URL_SUCCESS",
331
- SDK_PAYMENT_SUCCESSFUL = "SDK_PAYMENT_SUCCESSFUL",
332
- SDK_PAYMENT_FAIL = "SDK_PAYMENT_FAIL",
333
- SDK_PAYMENT_ERROR = "SDK_PAYMENT_ERROR",
334
- SDK_PAYMENT_CANCEL = "SDK_PAYMENT_CANCEL",
335
- /**
336
- * 当前为Apple Pay发起了Pay请求,但是用户关闭了页面
337
- */
338
- SDK_PAYMENT_PROCESSING = "SDK_PAYMENT_PROCESSING",
339
- SDK_PAYMENT_WARN = "SDK_PAYMENT_WARN",
340
- SDK_PAYMENT_SHIPPINGCHANGE = "SDK_PAYMENT_SHIPPINGCHANGE",
341
- SDK_PAYMENT_APPROVE = "SDK_PAYMENT_APPROVE"
342
- }
343
- export declare enum environmentEnum {
344
- sandbox = "sandbox",
345
- prod = "prod",
346
- light_sandbox = "light_sandbox"
347
- }
348
- export declare enum redirectTypeEnum {
349
- UNSAFE_BROWSER = "UNSAFE_BROWSER",// 非安全浏览器
350
- SAFETY_BROWSER = "SAFETY_BROWSER",// 安全浏览器
351
- INVOKE_SDK = "INVOKE_SDK"
352
- }
353
- export interface RequestInterface {
354
- countryCode: string;
355
- currencyCode: string;
356
- merchantCapabilities: string[];
357
- supportedNetworks: string[];
358
- total: {
359
- label: string;
360
- type: string;
361
- amount: string;
362
- };
363
- }
364
- export interface ApplePayPaymentRequest {
365
- version?: number;
366
- supportedNetworks: string[];
367
- requiredBillingContactFields?: string[];
368
- requiredShippingContactFields?: string[];
369
- merchantInfo: {
370
- instMid: string;
371
- merchantName: string;
372
- countryCode: string;
373
- };
374
- paymentAmount: {
375
- value: string;
376
- currency: string;
377
- };
378
- order?: {
379
- orderDescription: string;
380
- };
381
- merchantCapabilities: string[];
382
- }
383
- export interface ApplyPayParams {
384
- isScriptLoaded: boolean;
385
- isScriptLoadSucceed: boolean;
386
- paymentRequest: ApplePayPaymentRequest;
387
- paymentSessionData: string;
388
- isDarkTheme?: boolean;
389
- isAbbreviation?: boolean;
390
- device?: string;
391
- loading?: boolean;
392
- disabled?: boolean;
393
- className?: string;
394
- paymentStartFn: () => void;
395
- paymentEndFn: (result: any) => void;
396
- doSubmit: (paymentMethod: IPaymentMethod) => any;
397
- paymentMethod: IPaymentMethod;
398
- checkDisabledBeforeSubmit?: (paymentMethod: IPaymentMethod) => Promise<boolean>;
399
- isExpressBtn?: boolean;
400
- productScene?: 'ELEMENT';
401
- }
402
- export interface AppleResultData {
403
- status: boolean;
404
- result?: any;
405
- error?: {
406
- errorCode: string;
407
- };
408
- }
409
- export interface ISubPaymentElementView {
410
- defaultText: string;
411
- defaultValue: string;
412
- elementMandatory: boolean;
413
- elementRegx?: string;
414
- elementType: string;
415
- extendInfo: string;
416
- paramIllegalText: string;
417
- paymentElementKey: string;
418
- title: string;
419
- validateFunction?: string;
420
- isPart?: boolean;
421
- isPartEnd?: boolean;
422
- }
423
- interface CurrencyConfiguration {
424
- supportedMerchantRegion: string[];
425
- }
426
- export interface CurrencySupportConfiguration {
427
- [currencyCode: string]: CurrencyConfiguration;
428
- }
429
- export interface IAmount {
430
- amount?: string;
431
- currency: string;
432
- currencyLabel: string;
433
- formattedAmount?: string;
434
- formattedAmountWithCurrency?: string;
435
- value: string;
436
- __extendInfo__?: {
437
- traceId?: string;
438
- rpc?: string;
439
- amountKey?: string;
440
- };
441
- }
442
- export interface IAmountView {
443
- currency: string;
444
- currencyDivider: string;
445
- currencyLabel: string;
446
- currencySymbolPosition: 'L' | 'R';
447
- formattedValue: string;
448
- value: string;
449
- __extendInfo__?: {
450
- traceId?: string;
451
- rpc?: string;
452
- amountKey?: string;
453
- };
454
- }
455
- export declare enum InterActionTypeEnum {
456
- COLLECT_REDIRECT = "COLLECT_REDIRECT",
457
- SHOW_CODE = "SHOW_CODE",
458
- COLLECT_SHOW_CODE = "COLLECT_SHOW_CODE",
459
- REDIRECT = "REDIRECT"
460
- }
461
- export interface IPaymentElement {
462
- defaultText?: string;
463
- defaultValue: string;
464
- elementMandatory: boolean;
465
- elementType: string;
466
- extendInfo: string;
467
- paymentElementKey: string;
468
- subPaymentElementView?: ISubPaymentElementView[];
469
- title: string;
470
- paymentMethodType?: string;
471
- linkPaymentElementKey?: string;
472
- bankDataNeedPageRequest?: boolean;
473
- topHasOtherElement?: boolean;
474
- }
475
- export interface IPaymentMethod {
476
- paymentMethodKey?: string;
477
- antomPage?: string;
478
- redirectUrl?: string;
479
- icon?: string;
480
- iconName?: string;
481
- logoList?: Array<{
482
- cardBrand: string;
483
- logoUrl: string;
484
- }>;
485
- bankInfoList?: {
486
- bankIdentifierCode?: string;
487
- bankShortName?: string;
488
- logoUrl?: string;
489
- logo?: {
490
- logoUrl?: string;
491
- };
492
- }[];
493
- paymentMethod?: string;
494
- paymentMethodName: string;
495
- paymentMethodType: string;
496
- category?: string;
497
- paymentElements?: IPaymentElement[];
498
- paymentMethodId?: string;
499
- paymentMethodDetail?: {
500
- last4?: string;
501
- requireIssuerAuthentication?: string;
502
- applePayProps?: {
503
- environment?: string;
504
- paymentRequest?: ApplePayPaymentRequest;
505
- };
506
- googlePayProps?: any;
507
- };
508
- interActionType?: InterActionTypeEnum;
509
- recommend?: boolean;
510
- expressCheckout?: boolean;
511
- webRedirectType?: string;
512
- paymentCurrencyList?: string[];
513
- paymentAmount?: IAmount;
514
- paymentAmountView?: IAmountView;
515
- paymentQuoteId?: string;
516
- paymentFactors?: {
517
- [key: string]: any;
518
- };
519
- subPaymentMethodView?: IPaymentMethod[];
520
- currencySupportConfiguration?: CurrencySupportConfiguration;
521
- refundNonInsured?: boolean;
522
- }
523
- export interface RequestData {
524
- merchantCapabilities?: string[];
525
- supportedNetworks?: string[];
526
- countryCode: string;
527
- requiredBillingContactFields?: IApplePayContactField[];
528
- billingContact?: IApplePayPaymentContact;
529
- requiredShippingContactFields?: IApplePayContactField[];
530
- shippingContact?: IApplePayPaymentContact;
531
- applicationData?: string;
532
- supportedCountries?: string[];
533
- total: IApplePayLineItem;
534
- lineItems?: IApplePayLineItem[];
535
- currencyCode: string;
536
- shippingType?: applePayShippingType;
537
- shippingMethods?: IApplePayShippingMethod[];
538
- recurringPaymentRequest?: IApplePayRecurringPaymentRequest;
539
- }
540
- export {};