@alipay/ams-checkout 2.0.27 → 2.0.28
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/ams-checkout.js +3 -3
- package/dist/ams-checkout.min.js +1 -1
- package/esm/config/index.js +1 -1
- package/esm/core/component/ckp/index.js +21 -1
- package/esm/core/component/element/modernElementController/adapter.js +3 -3
- package/esm/core/component/element/modernElementController/index.d.ts +2 -0
- package/esm/core/component/element/modernElementController/index.js +103 -93
- package/esm/modern/index.js +1 -1
- package/esm/modern/tools.js +1 -1
- package/esm/tsdoc-metadata.json +1 -1
- package/esm/util/logger.js +1 -1
- package/package.json +1 -1
- package/types.d.ts +137 -39
- package/types.untrimmed.d.ts +140 -36
package/esm/tsdoc-metadata.json
CHANGED
package/esm/util/logger.js
CHANGED
package/package.json
CHANGED
package/types.d.ts
CHANGED
|
@@ -221,7 +221,7 @@ export declare class AntomSDK extends BaseElementsFactory {
|
|
|
221
221
|
elements(): Elements;
|
|
222
222
|
createElement(elementType: 'payment', options?: PaymentAppConfig): PaymentElement;
|
|
223
223
|
createElement(elementType: 'vaulting', options?: VaultingAppConfig): VaultingElement;
|
|
224
|
-
createElement(elementType: 'CVV', options
|
|
224
|
+
createElement(elementType: 'CVV', options: CVVAppConfig): CVVElement;
|
|
225
225
|
createElement(elementType: 'express', options?: ExpressAppConfig): ExpressElement;
|
|
226
226
|
getElement(elementType: 'payment', options?: PaymentAppConfig): PaymentElement;
|
|
227
227
|
getElement(elementType: 'vaulting', options?: VaultingAppConfig): VaultingElement;
|
|
@@ -293,9 +293,29 @@ export declare const AntomSDKErrorCodes: {
|
|
|
293
293
|
*/
|
|
294
294
|
readonly AMOUNT_VALUE_EMPTY: "AMOUNT_VALUE_EMPTY";
|
|
295
295
|
/**
|
|
296
|
-
* @description
|
|
296
|
+
* @description 金额格式非法(仅允许 ASCII 数字字符串)
|
|
297
297
|
*/
|
|
298
298
|
readonly AMOUNT_VALUE_INVALID: "AMOUNT_VALUE_INVALID";
|
|
299
|
+
/**
|
|
300
|
+
* @description Amount currency does not match the payment session currency
|
|
301
|
+
*/
|
|
302
|
+
readonly AMOUNT_CURRENCY_MISMATCH: "AMOUNT_CURRENCY_MISMATCH";
|
|
303
|
+
/**
|
|
304
|
+
* @description Amount currency is not supported
|
|
305
|
+
*/
|
|
306
|
+
readonly AMOUNT_CURRENCY_UNSUPPORTED: "AMOUNT_CURRENCY_UNSUPPORTED";
|
|
307
|
+
/**
|
|
308
|
+
* @description Amount currency precision is not supported
|
|
309
|
+
*/
|
|
310
|
+
readonly AMOUNT_PRECISION_UNSUPPORTED: "AMOUNT_PRECISION_UNSUPPORTED";
|
|
311
|
+
/**
|
|
312
|
+
* @description Amount conversion timed out
|
|
313
|
+
*/
|
|
314
|
+
readonly AMOUNT_RESOLVE_TIMEOUT: "AMOUNT_RESOLVE_TIMEOUT";
|
|
315
|
+
/**
|
|
316
|
+
* @description Amount conversion failed
|
|
317
|
+
*/
|
|
318
|
+
readonly AMOUNT_RESOLVE_FAILED: "AMOUNT_RESOLVE_FAILED";
|
|
299
319
|
readonly GENERATE_ELEMENT_KEY_FAILED: "GENERATE_ELEMENT_KEY_FAILED";
|
|
300
320
|
readonly ELEMENT_INIT_FAILED: "ELEMENT_INIT_FAILED";
|
|
301
321
|
readonly MOUNT_TIMEOUT: "MOUNT_TIMEOUT";
|
|
@@ -308,8 +328,8 @@ export declare const AntomSDKErrorCodes: {
|
|
|
308
328
|
readonly ELEMENT_DEFINE_ERROR: "ELEMENT_DEFINE_ERROR";
|
|
309
329
|
readonly ELEMENT_ALREADY_REGISTERED: "ELEMENT_ALREADY_REGISTERED";
|
|
310
330
|
readonly CANNOT_CREATE_SAME_ELEMENT_TWICE: "CANNOT_CREATE_SAME_ELEMENT_TWICE";
|
|
311
|
-
readonly GROUPS_ONLY_ONE_MAIN_ELEMENT: "GROUPS_ONLY_ONE_MAIN_ELEMENT";
|
|
312
|
-
readonly GROUPS_NOT_FOUND_MAIN_ELEMENT: "GROUPS_NOT_FOUND_MAIN_ELEMENT";
|
|
331
|
+
readonly GROUPS_ONLY_ONE_MAIN_ELEMENT: "GROUPS_ONLY_ONE_MAIN_ELEMENT"; /** @deprecated 传入 elements 时无需重复传递,且不会覆盖 Element 的会话。 */
|
|
332
|
+
readonly GROUPS_NOT_FOUND_MAIN_ELEMENT: "GROUPS_NOT_FOUND_MAIN_ELEMENT"; /** 无 UI 模式必填,仅用于创建内部 CVVElement。 */
|
|
313
333
|
readonly NOT_SUPPORT_ELEMENT: "NOT_SUPPORT_ELEMENT";
|
|
314
334
|
readonly NOT_SUPPORT_SUBMIT: "NOT_SUPPORT_SUBMIT";
|
|
315
335
|
readonly UPDATE_CONFIG_TIMEOUT: "UPDATE_CONFIG_TIMEOUT";
|
|
@@ -2129,18 +2149,22 @@ export declare interface ConfirmCardSetupOptions {
|
|
|
2129
2149
|
redirect?: 'always' | 'if_required';
|
|
2130
2150
|
}
|
|
2131
2151
|
|
|
2132
|
-
export declare
|
|
2133
|
-
sessionData: string;
|
|
2134
|
-
/**
|
|
2135
|
-
* @description 传入已挂载的 CVVElement / PaymentElement / Elements 实例,不传则使用无 UI 自动提交模式
|
|
2136
|
-
*/
|
|
2137
|
-
elements?: BaseMainElement | BaseElements;
|
|
2152
|
+
export declare type ConfirmPaymentOptions = PaymentSubmitParams & {
|
|
2138
2153
|
appearance?: CVVAppearance;
|
|
2139
2154
|
/**
|
|
2140
2155
|
* @description 集成用户自定义信息(如 cardHolderName)
|
|
2141
2156
|
*/
|
|
2142
2157
|
params?: Record<string, unknown>;
|
|
2143
|
-
}
|
|
2158
|
+
} & ({
|
|
2159
|
+
/** 已挂载的 Element;确认时使用其创建时绑定的会话。 */
|
|
2160
|
+
elements: BaseMainElement | BaseElements;
|
|
2161
|
+
/** @deprecated 传入 elements 时无需重复传递,且不会覆盖 Element 的会话。 */
|
|
2162
|
+
sessionData?: string;
|
|
2163
|
+
} | {
|
|
2164
|
+
elements?: undefined;
|
|
2165
|
+
/** 无 UI 模式必填,仅用于创建内部 CVVElement。 */
|
|
2166
|
+
sessionData: string;
|
|
2167
|
+
});
|
|
2144
2168
|
|
|
2145
2169
|
/**
|
|
2146
2170
|
* @description Connect流程参数
|
|
@@ -2281,9 +2305,9 @@ export declare interface CVVAppConfig extends BaseElementAppConfig {
|
|
|
2281
2305
|
/** CVV appearance configuration including optional alias-only Rules. */
|
|
2282
2306
|
appearance?: CVVAppearance;
|
|
2283
2307
|
/**
|
|
2284
|
-
* @description
|
|
2308
|
+
* @description 创建时必填的支付会话;不可通过 updateConfig 或 submit 替换
|
|
2285
2309
|
*/
|
|
2286
|
-
sessionData
|
|
2310
|
+
sessionData: string;
|
|
2287
2311
|
/* Excluded from this release type: paymentSessionConfig */
|
|
2288
2312
|
/* Excluded from this release type: renderData */
|
|
2289
2313
|
/* Excluded from this release type: sdkVersion */
|
|
@@ -2309,14 +2333,10 @@ export declare type CVVAppearanceProps = {
|
|
|
2309
2333
|
*/
|
|
2310
2334
|
export declare class CVVElement extends BaseMainElement<CVVElementConfig, CVVElementEvents> {
|
|
2311
2335
|
static elementType: string;
|
|
2336
|
+
private readonly sessionData;
|
|
2312
2337
|
constructor(name: string, config: CVVElementConfig);
|
|
2313
2338
|
/* Excluded from this release type: setup */
|
|
2314
|
-
|
|
2315
|
-
* Updates CVV configuration while preserving the public Rules clear semantics.
|
|
2316
|
-
* @param newConfig Partial CVV configuration patch.
|
|
2317
|
-
* @returns The WebApp update acknowledgement.
|
|
2318
|
-
*/
|
|
2319
|
-
updateConfig(newConfig: Partial<CVVAppConfig>): Promise<CVVElementEvents['OPENSDK@UPDATE_CONFIG_REPLY']>;
|
|
2339
|
+
/* Excluded from this release type: updateConfig */
|
|
2320
2340
|
/* Excluded from this release type: submit */
|
|
2321
2341
|
protected focus(): void;
|
|
2322
2342
|
protected blur(): void;
|
|
@@ -2328,20 +2348,10 @@ export declare class CVVElement extends BaseMainElement<CVVElementConfig, CVVEle
|
|
|
2328
2348
|
* @description CVV element config type
|
|
2329
2349
|
*/
|
|
2330
2350
|
export declare interface CVVElementConfig extends BaseElementConfig<CVVAppConfig> {
|
|
2351
|
+
appConfig: CVVAppConfig;
|
|
2331
2352
|
}
|
|
2332
2353
|
|
|
2333
|
-
export declare interface CVVElementEvents extends AntomBridgeEventMap<CVVAppConfig, CVVSubmitParams
|
|
2334
|
-
/**
|
|
2335
|
-
* @description Emitted event about form
|
|
2336
|
-
*/
|
|
2337
|
-
form: {
|
|
2338
|
-
errors?: Array<{
|
|
2339
|
-
field: string | number;
|
|
2340
|
-
message: string;
|
|
2341
|
-
currentValue: any;
|
|
2342
|
-
}>;
|
|
2343
|
-
message: string;
|
|
2344
|
-
};
|
|
2354
|
+
export declare interface CVVElementEvents extends AntomBridgeEventMap<CVVAppConfig, CVVSubmitParams & Pick<CVVAppConfig, 'sessionData'>> {
|
|
2345
2355
|
/**
|
|
2346
2356
|
* @description Emitted when the element is destroy
|
|
2347
2357
|
*/
|
|
@@ -2385,10 +2395,6 @@ export declare type CVVSubmitErrorCodes = 'NOT_FIND_MAINELEMENT' | 'SESSION_DATA
|
|
|
2385
2395
|
* @description CVV 支付提交参数
|
|
2386
2396
|
*/
|
|
2387
2397
|
export declare interface CVVSubmitParams {
|
|
2388
|
-
/**
|
|
2389
|
-
* 支付会话数据
|
|
2390
|
-
*/
|
|
2391
|
-
sessionData?: string;
|
|
2392
2398
|
/**
|
|
2393
2399
|
* 重定向策略
|
|
2394
2400
|
*/
|
|
@@ -3209,12 +3215,13 @@ export declare interface ExpressAppConfig extends BaseElementAppConfig {
|
|
|
3209
3215
|
/**
|
|
3210
3216
|
* Amount & Currency
|
|
3211
3217
|
*
|
|
3212
|
-
*
|
|
3213
|
-
*
|
|
3214
|
-
*
|
|
3218
|
+
* For Apple Pay and Google Pay, `value` is a positive ASCII digit string in
|
|
3219
|
+
* the payment session currency's minor unit; `currency` may be omitted.
|
|
3220
|
+
* For example, USD 10.99 is passed as `{ value: '1099' }`.
|
|
3221
|
+
* PayPal keeps its existing major-unit amount semantics and requires `currency`.
|
|
3215
3222
|
*/
|
|
3216
3223
|
amount?: {
|
|
3217
|
-
currency
|
|
3224
|
+
currency?: string;
|
|
3218
3225
|
value: string;
|
|
3219
3226
|
};
|
|
3220
3227
|
/** PayPal 配置 */
|
|
@@ -3345,7 +3352,17 @@ export declare class ExpressElement extends BaseMainElement<ExpressElementConfig
|
|
|
3345
3352
|
private _localHandlers;
|
|
3346
3353
|
/** 支付流程进行中标志(click → confirm/error/cancel 之间) */
|
|
3347
3354
|
private _paymentInProgress;
|
|
3355
|
+
/**
|
|
3356
|
+
* 是否已收到 iframe 业务层 ready 事件(app.tsx sendReady)。
|
|
3357
|
+
* 注意:与 host `status='ready'`(由 HANDSHAKE_ACK 触发,bridge.js:450 同步回发,与 amount 解析无关)不同。
|
|
3358
|
+
* 首屏 amount setupError 时 iframe 不发业务 ready → _readyReceived 保持 false,
|
|
3359
|
+
* 据此判别"首屏失败"以阻断后续 updateConfig。
|
|
3360
|
+
*/
|
|
3361
|
+
private _readyReceived;
|
|
3362
|
+
/** 首屏 setupError 致命标志:置位后 updateConfig 被 CHECKOUT_NOT_READY 阻断,只能 destroy 重开。 */
|
|
3363
|
+
private _setupFailed;
|
|
3348
3364
|
private _paypalOverlay;
|
|
3365
|
+
private _updateQueue;
|
|
3349
3366
|
constructor(name: string, config: ExpressElementConfig);
|
|
3350
3367
|
/**
|
|
3351
3368
|
* 重写 on:对 confirm 事件拦截,在商户回调执行前注入 paymentFailed()
|
|
@@ -3357,6 +3374,16 @@ export declare class ExpressElement extends BaseMainElement<ExpressElementConfig
|
|
|
3357
3374
|
*/
|
|
3358
3375
|
private _emit;
|
|
3359
3376
|
updateConfig(newConfig: ExpressAppConfig): Promise<ExpressElementEvents['OPENSDK@UPDATE_CONFIG_REPLY']>;
|
|
3377
|
+
private updateConfigTransaction;
|
|
3378
|
+
private updateAmountConfigWithSanitizedDebug;
|
|
3379
|
+
private getAmountValidationReason;
|
|
3380
|
+
/** iframe 业务 ready 事件到达:置 _readyReceived,后续运行时 error 不再视为首屏失败。
|
|
3381
|
+
* ready 是"本次首屏成功"的确实信号(首屏 setupError 时 iframe 不发 ready),
|
|
3382
|
+
* 故同时清掉 _setupFailed——unmount+remount 同实例二次首屏成功后可恢复 updateConfig。
|
|
3383
|
+
*/
|
|
3384
|
+
private _handleReady;
|
|
3385
|
+
/** iframe error 事件:若 business ready 未到达,视为首屏 setupError → 置 _setupFailed 阻断后续 updateConfig。 */
|
|
3386
|
+
private _handleError;
|
|
3360
3387
|
/**
|
|
3361
3388
|
* 商户在 confirm 回调内调用,触发实际支付提交。
|
|
3362
3389
|
* iframe 收到 OPENSDK@COMPLETE_PAYMENT 后执行 submitPay / polling 等,
|
|
@@ -3446,6 +3473,11 @@ export declare interface ExpressElementEvents extends AntomBridgeWithNativeEvent
|
|
|
3446
3473
|
'OPENSDK@GET_APPLE_PAY_TOKEN': {
|
|
3447
3474
|
requestId: string;
|
|
3448
3475
|
expressPaymentType: string;
|
|
3476
|
+
/** iframe 已转好的 major unit 金额(来自 resolvedAmount);host 委托 Apple Pay 消费,不再做 minor→major 转换。 */
|
|
3477
|
+
walletAmount?: {
|
|
3478
|
+
value: string;
|
|
3479
|
+
currency: string;
|
|
3480
|
+
};
|
|
3449
3481
|
};
|
|
3450
3482
|
/** host 完成 Apple Pay token 获取后回包给 iframe,submit/3DS/polling 均由 webapp 完成 */
|
|
3451
3483
|
'OPENSDK@GET_APPLE_PAY_TOKEN_REPLY': {
|
|
@@ -3556,6 +3588,57 @@ declare interface FrontSupportIppBank {
|
|
|
3556
3588
|
logo?: Logo;
|
|
3557
3589
|
}
|
|
3558
3590
|
|
|
3591
|
+
/** host 回传 webapp 的 OPENSDK@GET_APPLE_PAY_TOKEN_REPLY 形态(result 对齐老链路 {token,billingContact,shippingContact})。 */
|
|
3592
|
+
declare interface GetApplePayTokenReply {
|
|
3593
|
+
success: boolean;
|
|
3594
|
+
result?: {
|
|
3595
|
+
token?: unknown;
|
|
3596
|
+
billingContact?: unknown;
|
|
3597
|
+
shippingContact?: unknown;
|
|
3598
|
+
} | {
|
|
3599
|
+
errorCode: string;
|
|
3600
|
+
};
|
|
3601
|
+
}
|
|
3602
|
+
|
|
3603
|
+
/** webapp 传来的 OPENSDK@GET_APPLE_PAY_TOKEN payload 形态。 */
|
|
3604
|
+
declare interface GetApplePayTokenRequest {
|
|
3605
|
+
paymentMethod?: {
|
|
3606
|
+
paymentMethodDetail?: {
|
|
3607
|
+
applePayProps?: {
|
|
3608
|
+
paymentRequest?: unknown;
|
|
3609
|
+
};
|
|
3610
|
+
};
|
|
3611
|
+
};
|
|
3612
|
+
shipping?: unknown;
|
|
3613
|
+
}
|
|
3614
|
+
|
|
3615
|
+
/** host 回传 webapp 的 OPENSDK@GET_GOOGLE_PAY_TOKEN_REPLY 形态。 */
|
|
3616
|
+
declare interface GetGooglePayTokenReply {
|
|
3617
|
+
success: boolean;
|
|
3618
|
+
result?: unknown;
|
|
3619
|
+
err?: {
|
|
3620
|
+
statusCode?: string;
|
|
3621
|
+
[key: string]: unknown;
|
|
3622
|
+
};
|
|
3623
|
+
}
|
|
3624
|
+
|
|
3625
|
+
/** webapp 传来的 OPENSDK@GET_GOOGLE_PAY_TOKEN payload 形态。 */
|
|
3626
|
+
declare interface GetGooglePayTokenRequest {
|
|
3627
|
+
actionName?: string;
|
|
3628
|
+
data?: {
|
|
3629
|
+
environment?: string;
|
|
3630
|
+
paymentRequest?: unknown;
|
|
3631
|
+
paymentMethod?: unknown;
|
|
3632
|
+
paymentMethodDetail?: {
|
|
3633
|
+
googlePayProps?: {
|
|
3634
|
+
environment?: string;
|
|
3635
|
+
paymentRequest?: unknown;
|
|
3636
|
+
};
|
|
3637
|
+
};
|
|
3638
|
+
[key: string]: unknown;
|
|
3639
|
+
};
|
|
3640
|
+
}
|
|
3641
|
+
|
|
3559
3642
|
declare type GetI18nQueryParam = string | {
|
|
3560
3643
|
/**
|
|
3561
3644
|
* 多语言文案的 key
|
|
@@ -7095,6 +7178,7 @@ export declare type PaymentAppearanceProps = {
|
|
|
7095
7178
|
export declare class PaymentElement extends BaseMainElement<PaymentElementConfig, PaymentElementEvents> {
|
|
7096
7179
|
static elementType: string;
|
|
7097
7180
|
private _paymentInProgress;
|
|
7181
|
+
private readonly walletLogger;
|
|
7098
7182
|
constructor(name: string, config: PaymentElementConfig);
|
|
7099
7183
|
/* Excluded from this release type: setup */
|
|
7100
7184
|
/**
|
|
@@ -7117,6 +7201,20 @@ declare interface PaymentElementConfig extends BaseElementConfig<PaymentAppConfi
|
|
|
7117
7201
|
* @description Payment element events
|
|
7118
7202
|
*/
|
|
7119
7203
|
export declare interface PaymentElementEvents extends AntomBridgeWithNativeEventMap<PaymentAppConfig, PaymentSubmitParams, PaymentSubmitResult> {
|
|
7204
|
+
/**
|
|
7205
|
+
* webapp 委托 host(父 frame)拉起 Apple Pay 拿 token。
|
|
7206
|
+
* payload 结构对齐 ModernElementController.GetApplePayTokenRequest(放 paymentMethod/shipping)。
|
|
7207
|
+
*/
|
|
7208
|
+
'OPENSDK@GET_APPLE_PAY_TOKEN': GetApplePayTokenRequest;
|
|
7209
|
+
/** host 完成 Apple Pay token 获取后回包给 webapp */
|
|
7210
|
+
'OPENSDK@GET_APPLE_PAY_TOKEN_REPLY': GetApplePayTokenReply;
|
|
7211
|
+
/**
|
|
7212
|
+
* webapp 委托 host(父 frame)拉起 Google Pay 拿 token。
|
|
7213
|
+
* payload 结构对齐 ModernElementController.GetGooglePayTokenRequest(放 data.environment/paymentRequest)。
|
|
7214
|
+
*/
|
|
7215
|
+
'OPENSDK@GET_GOOGLE_PAY_TOKEN': GetGooglePayTokenRequest;
|
|
7216
|
+
/** host 完成 Google Pay token 获取后回包给 webapp */
|
|
7217
|
+
'OPENSDK@GET_GOOGLE_PAY_TOKEN_REPLY': GetGooglePayTokenReply;
|
|
7120
7218
|
}
|
|
7121
7219
|
|
|
7122
7220
|
declare interface PaymentElementView {
|
package/types.untrimmed.d.ts
CHANGED
|
@@ -313,7 +313,7 @@ export declare class AntomSDK extends BaseElementsFactory {
|
|
|
313
313
|
elements(): Elements;
|
|
314
314
|
createElement(elementType: 'payment', options?: PaymentAppConfig): PaymentElement;
|
|
315
315
|
createElement(elementType: 'vaulting', options?: VaultingAppConfig): VaultingElement;
|
|
316
|
-
createElement(elementType: 'CVV', options
|
|
316
|
+
createElement(elementType: 'CVV', options: CVVAppConfig): CVVElement;
|
|
317
317
|
createElement(elementType: 'express', options?: ExpressAppConfig): ExpressElement;
|
|
318
318
|
getElement(elementType: 'payment', options?: PaymentAppConfig): PaymentElement;
|
|
319
319
|
getElement(elementType: 'vaulting', options?: VaultingAppConfig): VaultingElement;
|
|
@@ -385,9 +385,29 @@ export declare const AntomSDKErrorCodes: {
|
|
|
385
385
|
*/
|
|
386
386
|
readonly AMOUNT_VALUE_EMPTY: "AMOUNT_VALUE_EMPTY";
|
|
387
387
|
/**
|
|
388
|
-
* @description
|
|
388
|
+
* @description 金额格式非法(仅允许 ASCII 数字字符串)
|
|
389
389
|
*/
|
|
390
390
|
readonly AMOUNT_VALUE_INVALID: "AMOUNT_VALUE_INVALID";
|
|
391
|
+
/**
|
|
392
|
+
* @description Amount currency does not match the payment session currency
|
|
393
|
+
*/
|
|
394
|
+
readonly AMOUNT_CURRENCY_MISMATCH: "AMOUNT_CURRENCY_MISMATCH";
|
|
395
|
+
/**
|
|
396
|
+
* @description Amount currency is not supported
|
|
397
|
+
*/
|
|
398
|
+
readonly AMOUNT_CURRENCY_UNSUPPORTED: "AMOUNT_CURRENCY_UNSUPPORTED";
|
|
399
|
+
/**
|
|
400
|
+
* @description Amount currency precision is not supported
|
|
401
|
+
*/
|
|
402
|
+
readonly AMOUNT_PRECISION_UNSUPPORTED: "AMOUNT_PRECISION_UNSUPPORTED";
|
|
403
|
+
/**
|
|
404
|
+
* @description Amount conversion timed out
|
|
405
|
+
*/
|
|
406
|
+
readonly AMOUNT_RESOLVE_TIMEOUT: "AMOUNT_RESOLVE_TIMEOUT";
|
|
407
|
+
/**
|
|
408
|
+
* @description Amount conversion failed
|
|
409
|
+
*/
|
|
410
|
+
readonly AMOUNT_RESOLVE_FAILED: "AMOUNT_RESOLVE_FAILED";
|
|
391
411
|
readonly GENERATE_ELEMENT_KEY_FAILED: "GENERATE_ELEMENT_KEY_FAILED";
|
|
392
412
|
readonly ELEMENT_INIT_FAILED: "ELEMENT_INIT_FAILED";
|
|
393
413
|
readonly MOUNT_TIMEOUT: "MOUNT_TIMEOUT";
|
|
@@ -400,8 +420,8 @@ export declare const AntomSDKErrorCodes: {
|
|
|
400
420
|
readonly ELEMENT_DEFINE_ERROR: "ELEMENT_DEFINE_ERROR";
|
|
401
421
|
readonly ELEMENT_ALREADY_REGISTERED: "ELEMENT_ALREADY_REGISTERED";
|
|
402
422
|
readonly CANNOT_CREATE_SAME_ELEMENT_TWICE: "CANNOT_CREATE_SAME_ELEMENT_TWICE";
|
|
403
|
-
readonly GROUPS_ONLY_ONE_MAIN_ELEMENT: "GROUPS_ONLY_ONE_MAIN_ELEMENT";
|
|
404
|
-
readonly GROUPS_NOT_FOUND_MAIN_ELEMENT: "GROUPS_NOT_FOUND_MAIN_ELEMENT";
|
|
423
|
+
readonly GROUPS_ONLY_ONE_MAIN_ELEMENT: "GROUPS_ONLY_ONE_MAIN_ELEMENT"; /** @deprecated 传入 elements 时无需重复传递,且不会覆盖 Element 的会话。 */
|
|
424
|
+
readonly GROUPS_NOT_FOUND_MAIN_ELEMENT: "GROUPS_NOT_FOUND_MAIN_ELEMENT"; /** 无 UI 模式必填,仅用于创建内部 CVVElement。 */
|
|
405
425
|
readonly NOT_SUPPORT_ELEMENT: "NOT_SUPPORT_ELEMENT";
|
|
406
426
|
readonly NOT_SUPPORT_SUBMIT: "NOT_SUPPORT_SUBMIT";
|
|
407
427
|
readonly UPDATE_CONFIG_TIMEOUT: "UPDATE_CONFIG_TIMEOUT";
|
|
@@ -2524,18 +2544,22 @@ export declare interface ConfirmCardSetupOptions {
|
|
|
2524
2544
|
redirect?: 'always' | 'if_required';
|
|
2525
2545
|
}
|
|
2526
2546
|
|
|
2527
|
-
export declare
|
|
2528
|
-
sessionData: string;
|
|
2529
|
-
/**
|
|
2530
|
-
* @description 传入已挂载的 CVVElement / PaymentElement / Elements 实例,不传则使用无 UI 自动提交模式
|
|
2531
|
-
*/
|
|
2532
|
-
elements?: BaseMainElement | BaseElements;
|
|
2547
|
+
export declare type ConfirmPaymentOptions = PaymentSubmitParams & {
|
|
2533
2548
|
appearance?: CVVAppearance;
|
|
2534
2549
|
/**
|
|
2535
2550
|
* @description 集成用户自定义信息(如 cardHolderName)
|
|
2536
2551
|
*/
|
|
2537
2552
|
params?: Record<string, unknown>;
|
|
2538
|
-
}
|
|
2553
|
+
} & ({
|
|
2554
|
+
/** 已挂载的 Element;确认时使用其创建时绑定的会话。 */
|
|
2555
|
+
elements: BaseMainElement | BaseElements;
|
|
2556
|
+
/** @deprecated 传入 elements 时无需重复传递,且不会覆盖 Element 的会话。 */
|
|
2557
|
+
sessionData?: string;
|
|
2558
|
+
} | {
|
|
2559
|
+
elements?: undefined;
|
|
2560
|
+
/** 无 UI 模式必填,仅用于创建内部 CVVElement。 */
|
|
2561
|
+
sessionData: string;
|
|
2562
|
+
});
|
|
2539
2563
|
|
|
2540
2564
|
/**
|
|
2541
2565
|
* @description Connect流程参数
|
|
@@ -2676,9 +2700,9 @@ export declare interface CVVAppConfig extends BaseElementAppConfig {
|
|
|
2676
2700
|
/** CVV appearance configuration including optional alias-only Rules. */
|
|
2677
2701
|
appearance?: CVVAppearance;
|
|
2678
2702
|
/**
|
|
2679
|
-
* @description
|
|
2703
|
+
* @description 创建时必填的支付会话;不可通过 updateConfig 或 submit 替换
|
|
2680
2704
|
*/
|
|
2681
|
-
sessionData
|
|
2705
|
+
sessionData: string;
|
|
2682
2706
|
/**
|
|
2683
2707
|
* @internal sessionConfig 渲染数据,内部使用,无需用户传递
|
|
2684
2708
|
*/
|
|
@@ -2722,17 +2746,19 @@ export declare type CVVAppearanceProps = {
|
|
|
2722
2746
|
*/
|
|
2723
2747
|
export declare class CVVElement extends BaseMainElement<CVVElementConfig, CVVElementEvents> {
|
|
2724
2748
|
static elementType: string;
|
|
2749
|
+
private readonly sessionData;
|
|
2725
2750
|
constructor(name: string, config: CVVElementConfig);
|
|
2726
2751
|
/**
|
|
2727
2752
|
* @internal
|
|
2728
2753
|
*/
|
|
2729
2754
|
setup(): Promise<Partial<CVVAppConfig> | undefined>;
|
|
2730
2755
|
/**
|
|
2731
|
-
*
|
|
2732
|
-
*
|
|
2756
|
+
* @internal Not supported by the public CVV integration API.
|
|
2757
|
+
* Updates appearance only, preserving the Rules clear semantics.
|
|
2758
|
+
* @param newConfig Appearance configuration patch.
|
|
2733
2759
|
* @returns The WebApp update acknowledgement.
|
|
2734
2760
|
*/
|
|
2735
|
-
updateConfig(newConfig:
|
|
2761
|
+
updateConfig(newConfig: Pick<CVVAppConfig, 'appearance'>): Promise<CVVElementEvents['OPENSDK@UPDATE_CONFIG_REPLY']>;
|
|
2736
2762
|
/**
|
|
2737
2763
|
* @internal
|
|
2738
2764
|
*/
|
|
@@ -2747,20 +2773,10 @@ export declare class CVVElement extends BaseMainElement<CVVElementConfig, CVVEle
|
|
|
2747
2773
|
* @description CVV element config type
|
|
2748
2774
|
*/
|
|
2749
2775
|
export declare interface CVVElementConfig extends BaseElementConfig<CVVAppConfig> {
|
|
2776
|
+
appConfig: CVVAppConfig;
|
|
2750
2777
|
}
|
|
2751
2778
|
|
|
2752
|
-
export declare interface CVVElementEvents extends AntomBridgeEventMap<CVVAppConfig, CVVSubmitParams
|
|
2753
|
-
/**
|
|
2754
|
-
* @description Emitted event about form
|
|
2755
|
-
*/
|
|
2756
|
-
form: {
|
|
2757
|
-
errors?: Array<{
|
|
2758
|
-
field: string | number;
|
|
2759
|
-
message: string;
|
|
2760
|
-
currentValue: any;
|
|
2761
|
-
}>;
|
|
2762
|
-
message: string;
|
|
2763
|
-
};
|
|
2779
|
+
export declare interface CVVElementEvents extends AntomBridgeEventMap<CVVAppConfig, CVVSubmitParams & Pick<CVVAppConfig, 'sessionData'>> {
|
|
2764
2780
|
/**
|
|
2765
2781
|
* @description Emitted when the element is destroy
|
|
2766
2782
|
*/
|
|
@@ -2804,10 +2820,6 @@ export declare type CVVSubmitErrorCodes = 'NOT_FIND_MAINELEMENT' | 'SESSION_DATA
|
|
|
2804
2820
|
* @description CVV 支付提交参数
|
|
2805
2821
|
*/
|
|
2806
2822
|
export declare interface CVVSubmitParams {
|
|
2807
|
-
/**
|
|
2808
|
-
* 支付会话数据
|
|
2809
|
-
*/
|
|
2810
|
-
sessionData?: string;
|
|
2811
2823
|
/**
|
|
2812
2824
|
* 重定向策略
|
|
2813
2825
|
*/
|
|
@@ -3628,12 +3640,13 @@ export declare interface ExpressAppConfig extends BaseElementAppConfig {
|
|
|
3628
3640
|
/**
|
|
3629
3641
|
* Amount & Currency
|
|
3630
3642
|
*
|
|
3631
|
-
*
|
|
3632
|
-
*
|
|
3633
|
-
*
|
|
3643
|
+
* For Apple Pay and Google Pay, `value` is a positive ASCII digit string in
|
|
3644
|
+
* the payment session currency's minor unit; `currency` may be omitted.
|
|
3645
|
+
* For example, USD 10.99 is passed as `{ value: '1099' }`.
|
|
3646
|
+
* PayPal keeps its existing major-unit amount semantics and requires `currency`.
|
|
3634
3647
|
*/
|
|
3635
3648
|
amount?: {
|
|
3636
|
-
currency
|
|
3649
|
+
currency?: string;
|
|
3637
3650
|
value: string;
|
|
3638
3651
|
};
|
|
3639
3652
|
/** PayPal 配置 */
|
|
@@ -3773,7 +3786,17 @@ export declare class ExpressElement extends BaseMainElement<ExpressElementConfig
|
|
|
3773
3786
|
private _localHandlers;
|
|
3774
3787
|
/** 支付流程进行中标志(click → confirm/error/cancel 之间) */
|
|
3775
3788
|
private _paymentInProgress;
|
|
3789
|
+
/**
|
|
3790
|
+
* 是否已收到 iframe 业务层 ready 事件(app.tsx sendReady)。
|
|
3791
|
+
* 注意:与 host `status='ready'`(由 HANDSHAKE_ACK 触发,bridge.js:450 同步回发,与 amount 解析无关)不同。
|
|
3792
|
+
* 首屏 amount setupError 时 iframe 不发业务 ready → _readyReceived 保持 false,
|
|
3793
|
+
* 据此判别"首屏失败"以阻断后续 updateConfig。
|
|
3794
|
+
*/
|
|
3795
|
+
private _readyReceived;
|
|
3796
|
+
/** 首屏 setupError 致命标志:置位后 updateConfig 被 CHECKOUT_NOT_READY 阻断,只能 destroy 重开。 */
|
|
3797
|
+
private _setupFailed;
|
|
3776
3798
|
private _paypalOverlay;
|
|
3799
|
+
private _updateQueue;
|
|
3777
3800
|
constructor(name: string, config: ExpressElementConfig);
|
|
3778
3801
|
/**
|
|
3779
3802
|
* 重写 on:对 confirm 事件拦截,在商户回调执行前注入 paymentFailed()
|
|
@@ -3785,6 +3808,16 @@ export declare class ExpressElement extends BaseMainElement<ExpressElementConfig
|
|
|
3785
3808
|
*/
|
|
3786
3809
|
private _emit;
|
|
3787
3810
|
updateConfig(newConfig: ExpressAppConfig): Promise<ExpressElementEvents['OPENSDK@UPDATE_CONFIG_REPLY']>;
|
|
3811
|
+
private updateConfigTransaction;
|
|
3812
|
+
private updateAmountConfigWithSanitizedDebug;
|
|
3813
|
+
private getAmountValidationReason;
|
|
3814
|
+
/** iframe 业务 ready 事件到达:置 _readyReceived,后续运行时 error 不再视为首屏失败。
|
|
3815
|
+
* ready 是"本次首屏成功"的确实信号(首屏 setupError 时 iframe 不发 ready),
|
|
3816
|
+
* 故同时清掉 _setupFailed——unmount+remount 同实例二次首屏成功后可恢复 updateConfig。
|
|
3817
|
+
*/
|
|
3818
|
+
private _handleReady;
|
|
3819
|
+
/** iframe error 事件:若 business ready 未到达,视为首屏 setupError → 置 _setupFailed 阻断后续 updateConfig。 */
|
|
3820
|
+
private _handleError;
|
|
3788
3821
|
/**
|
|
3789
3822
|
* 商户在 confirm 回调内调用,触发实际支付提交。
|
|
3790
3823
|
* iframe 收到 OPENSDK@COMPLETE_PAYMENT 后执行 submitPay / polling 等,
|
|
@@ -3874,6 +3907,11 @@ export declare interface ExpressElementEvents extends AntomBridgeWithNativeEvent
|
|
|
3874
3907
|
'OPENSDK@GET_APPLE_PAY_TOKEN': {
|
|
3875
3908
|
requestId: string;
|
|
3876
3909
|
expressPaymentType: string;
|
|
3910
|
+
/** iframe 已转好的 major unit 金额(来自 resolvedAmount);host 委托 Apple Pay 消费,不再做 minor→major 转换。 */
|
|
3911
|
+
walletAmount?: {
|
|
3912
|
+
value: string;
|
|
3913
|
+
currency: string;
|
|
3914
|
+
};
|
|
3877
3915
|
};
|
|
3878
3916
|
/** host 完成 Apple Pay token 获取后回包给 iframe,submit/3DS/polling 均由 webapp 完成 */
|
|
3879
3917
|
'OPENSDK@GET_APPLE_PAY_TOKEN_REPLY': {
|
|
@@ -3984,6 +4022,57 @@ declare interface FrontSupportIppBank {
|
|
|
3984
4022
|
logo?: Logo;
|
|
3985
4023
|
}
|
|
3986
4024
|
|
|
4025
|
+
/** host 回传 webapp 的 OPENSDK@GET_APPLE_PAY_TOKEN_REPLY 形态(result 对齐老链路 {token,billingContact,shippingContact})。 */
|
|
4026
|
+
declare interface GetApplePayTokenReply {
|
|
4027
|
+
success: boolean;
|
|
4028
|
+
result?: {
|
|
4029
|
+
token?: unknown;
|
|
4030
|
+
billingContact?: unknown;
|
|
4031
|
+
shippingContact?: unknown;
|
|
4032
|
+
} | {
|
|
4033
|
+
errorCode: string;
|
|
4034
|
+
};
|
|
4035
|
+
}
|
|
4036
|
+
|
|
4037
|
+
/** webapp 传来的 OPENSDK@GET_APPLE_PAY_TOKEN payload 形态。 */
|
|
4038
|
+
declare interface GetApplePayTokenRequest {
|
|
4039
|
+
paymentMethod?: {
|
|
4040
|
+
paymentMethodDetail?: {
|
|
4041
|
+
applePayProps?: {
|
|
4042
|
+
paymentRequest?: unknown;
|
|
4043
|
+
};
|
|
4044
|
+
};
|
|
4045
|
+
};
|
|
4046
|
+
shipping?: unknown;
|
|
4047
|
+
}
|
|
4048
|
+
|
|
4049
|
+
/** host 回传 webapp 的 OPENSDK@GET_GOOGLE_PAY_TOKEN_REPLY 形态。 */
|
|
4050
|
+
declare interface GetGooglePayTokenReply {
|
|
4051
|
+
success: boolean;
|
|
4052
|
+
result?: unknown;
|
|
4053
|
+
err?: {
|
|
4054
|
+
statusCode?: string;
|
|
4055
|
+
[key: string]: unknown;
|
|
4056
|
+
};
|
|
4057
|
+
}
|
|
4058
|
+
|
|
4059
|
+
/** webapp 传来的 OPENSDK@GET_GOOGLE_PAY_TOKEN payload 形态。 */
|
|
4060
|
+
declare interface GetGooglePayTokenRequest {
|
|
4061
|
+
actionName?: string;
|
|
4062
|
+
data?: {
|
|
4063
|
+
environment?: string;
|
|
4064
|
+
paymentRequest?: unknown;
|
|
4065
|
+
paymentMethod?: unknown;
|
|
4066
|
+
paymentMethodDetail?: {
|
|
4067
|
+
googlePayProps?: {
|
|
4068
|
+
environment?: string;
|
|
4069
|
+
paymentRequest?: unknown;
|
|
4070
|
+
};
|
|
4071
|
+
};
|
|
4072
|
+
[key: string]: unknown;
|
|
4073
|
+
};
|
|
4074
|
+
}
|
|
4075
|
+
|
|
3987
4076
|
declare type GetI18nQueryParam = string | {
|
|
3988
4077
|
/**
|
|
3989
4078
|
* 多语言文案的 key
|
|
@@ -7559,6 +7648,7 @@ export declare type PaymentAppearanceProps = {
|
|
|
7559
7648
|
export declare class PaymentElement extends BaseMainElement<PaymentElementConfig, PaymentElementEvents> {
|
|
7560
7649
|
static elementType: string;
|
|
7561
7650
|
private _paymentInProgress;
|
|
7651
|
+
private readonly walletLogger;
|
|
7562
7652
|
constructor(name: string, config: PaymentElementConfig);
|
|
7563
7653
|
/**
|
|
7564
7654
|
* @internal
|
|
@@ -7587,6 +7677,20 @@ declare interface PaymentElementConfig extends BaseElementConfig<PaymentAppConfi
|
|
|
7587
7677
|
* @description Payment element events
|
|
7588
7678
|
*/
|
|
7589
7679
|
export declare interface PaymentElementEvents extends AntomBridgeWithNativeEventMap<PaymentAppConfig, PaymentSubmitParams, PaymentSubmitResult> {
|
|
7680
|
+
/**
|
|
7681
|
+
* webapp 委托 host(父 frame)拉起 Apple Pay 拿 token。
|
|
7682
|
+
* payload 结构对齐 ModernElementController.GetApplePayTokenRequest(放 paymentMethod/shipping)。
|
|
7683
|
+
*/
|
|
7684
|
+
'OPENSDK@GET_APPLE_PAY_TOKEN': GetApplePayTokenRequest;
|
|
7685
|
+
/** host 完成 Apple Pay token 获取后回包给 webapp */
|
|
7686
|
+
'OPENSDK@GET_APPLE_PAY_TOKEN_REPLY': GetApplePayTokenReply;
|
|
7687
|
+
/**
|
|
7688
|
+
* webapp 委托 host(父 frame)拉起 Google Pay 拿 token。
|
|
7689
|
+
* payload 结构对齐 ModernElementController.GetGooglePayTokenRequest(放 data.environment/paymentRequest)。
|
|
7690
|
+
*/
|
|
7691
|
+
'OPENSDK@GET_GOOGLE_PAY_TOKEN': GetGooglePayTokenRequest;
|
|
7692
|
+
/** host 完成 Google Pay token 获取后回包给 webapp */
|
|
7693
|
+
'OPENSDK@GET_GOOGLE_PAY_TOKEN_REPLY': GetGooglePayTokenReply;
|
|
7590
7694
|
}
|
|
7591
7695
|
|
|
7592
7696
|
declare interface PaymentElementView {
|