zmp-sdk 2.44.4-2 → 2.45.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/apis/apis/payment/checkTransaction.js +1 -1
- package/apis/apis/payment/createOrder.js +1 -1
- package/apis/apis/payment/index.js +1 -1
- package/apis/apis/showOAWidget.js +1 -1
- package/apis/common/apis/general/payment/checkTransaction.js +1 -1
- package/apis/common/apis/general/payment/createOrder.js +1 -1
- package/apis/common/apis/general/payment/utils.js +1 -0
- package/apis/common/eventEmitter.js +1 -1
- package/apis/constants.js +1 -1
- package/apis/index.d.ts +71 -10
- package/apis/package.json.js +1 -1
- package/apis/types/enum.js +1 -1
- package/browser.min.js +2 -2
- package/index.d.ts +75 -10
- package/index.es.js +2 -2
- package/index.js +2 -2
- package/index.umd.js +3 -3
- package/package.json +1 -1
package/index.d.ts
CHANGED
|
@@ -978,6 +978,13 @@ declare enum Events {
|
|
|
978
978
|
AppClose = "h5.event.action.close",
|
|
979
979
|
PaymentCallback = "payment.callback",
|
|
980
980
|
PaymentResult = "action.payment.result",
|
|
981
|
+
/** Người dùng đã hoàn thành quy trình thanh toán ở CheckoutSDK
|
|
982
|
+
* * Lưu ý: Event sẽ được gửi khi người dùng hoàn tất hoặc hủy quy trình thanh toán.
|
|
983
|
+
* * Đối tác cần sử dụng API checkTransaction để kiểm tra trạng thái thanh toán mới nhất.
|
|
984
|
+
*
|
|
985
|
+
* @link https://mini.zalo.me/documents/checkout-sdk/integration-process/overview/receive-transaction-ma/
|
|
986
|
+
* */
|
|
987
|
+
PaymentDone = "action.payment.done",
|
|
981
988
|
PaymentClose = "action.payment.close",
|
|
982
989
|
DownloadProgress = "h5.event.webview.download.progress"
|
|
983
990
|
}
|
|
@@ -1323,7 +1330,24 @@ declare const ACTION: {
|
|
|
1323
1330
|
HIDE_KEYBOARD: {};
|
|
1324
1331
|
OPEN_PHONE: {};
|
|
1325
1332
|
OPEN_QR: {};
|
|
1326
|
-
OPEN_SMS: {
|
|
1333
|
+
OPEN_SMS: {
|
|
1334
|
+
errorList: {
|
|
1335
|
+
iOS: {
|
|
1336
|
+
"-9": {
|
|
1337
|
+
mapTo: {
|
|
1338
|
+
code: number;
|
|
1339
|
+
message: string;
|
|
1340
|
+
};
|
|
1341
|
+
};
|
|
1342
|
+
"-10": {
|
|
1343
|
+
mapTo: {
|
|
1344
|
+
code: number;
|
|
1345
|
+
message: string;
|
|
1346
|
+
};
|
|
1347
|
+
};
|
|
1348
|
+
};
|
|
1349
|
+
};
|
|
1350
|
+
};
|
|
1327
1351
|
VIEW_MYQR: {
|
|
1328
1352
|
haveCallback: boolean;
|
|
1329
1353
|
timeout: boolean;
|
|
@@ -3250,6 +3274,7 @@ declare const createOrderArgs: ZodObject<{
|
|
|
3250
3274
|
amount: ZodUnion<[ZodString, ZodNumber]>;
|
|
3251
3275
|
item: ZodArray<ZodRecord<ZodString, ZodAny>, "many">;
|
|
3252
3276
|
desc: ZodString;
|
|
3277
|
+
mac: ZodString;
|
|
3253
3278
|
extradata: ZodOptional<ZodAny>;
|
|
3254
3279
|
payload: ZodOptional<ZodAny>;
|
|
3255
3280
|
method: ZodOptional<ZodUnion<[ZodString, ZodObject<{
|
|
@@ -3262,7 +3287,6 @@ declare const createOrderArgs: ZodObject<{
|
|
|
3262
3287
|
id: string;
|
|
3263
3288
|
isCustom: boolean;
|
|
3264
3289
|
}>]>>;
|
|
3265
|
-
mac: ZodOptional<ZodString>;
|
|
3266
3290
|
}, "strip", ZodTypeAny, {
|
|
3267
3291
|
method?: string | {
|
|
3268
3292
|
id: string;
|
|
@@ -3270,10 +3294,10 @@ declare const createOrderArgs: ZodObject<{
|
|
|
3270
3294
|
} | undefined;
|
|
3271
3295
|
extradata?: any;
|
|
3272
3296
|
payload?: any;
|
|
3273
|
-
mac?: string | undefined;
|
|
3274
3297
|
desc: string;
|
|
3275
3298
|
amount: string | number;
|
|
3276
3299
|
item: Record<string, any>[];
|
|
3300
|
+
mac: string;
|
|
3277
3301
|
}, {
|
|
3278
3302
|
method?: string | {
|
|
3279
3303
|
id: string;
|
|
@@ -3281,11 +3305,16 @@ declare const createOrderArgs: ZodObject<{
|
|
|
3281
3305
|
} | undefined;
|
|
3282
3306
|
extradata?: any;
|
|
3283
3307
|
payload?: any;
|
|
3284
|
-
mac?: string | undefined;
|
|
3285
3308
|
desc: string;
|
|
3286
3309
|
amount: string | number;
|
|
3287
3310
|
item: Record<string, any>[];
|
|
3311
|
+
mac: string;
|
|
3288
3312
|
}>[];
|
|
3313
|
+
/**
|
|
3314
|
+
* Tạo yêu cầu thanh toán, mở giao diện chọn phương thức thanh toán
|
|
3315
|
+
* @link https://mini.zalo.me/documents/checkout-sdk/createOrder/
|
|
3316
|
+
* @param args
|
|
3317
|
+
*/
|
|
3289
3318
|
declare function createOrder(args: AsyncCallback<CreateOrderReturns> & TypeOf<(typeof createOrderArgs)[0]>): Promise<CreateOrderReturns>;
|
|
3290
3319
|
|
|
3291
3320
|
declare const purchaseArgs: ZodObject<{
|
|
@@ -3307,6 +3336,11 @@ declare const purchaseArgs: ZodObject<{
|
|
|
3307
3336
|
desc: string;
|
|
3308
3337
|
amount: string | number;
|
|
3309
3338
|
}>[];
|
|
3339
|
+
/**
|
|
3340
|
+
* Gửi thông tin thanh toán đến CheckoutSDK
|
|
3341
|
+
* @link https://mini.zalo.me/documents/checkout-sdk/purchase/
|
|
3342
|
+
* @param args
|
|
3343
|
+
*/
|
|
3310
3344
|
declare function purchase(args: AsyncCallback<CreateOrderReturns> & TypeOf<(typeof purchaseArgs)[0]>): Promise<CreateOrderReturns>;
|
|
3311
3345
|
|
|
3312
3346
|
declare const selectPaymentMethodArgs: ZodOptional<ZodObject<{
|
|
@@ -3357,12 +3391,30 @@ declare const selectPaymentMethodArgs: ZodOptional<ZodObject<{
|
|
|
3357
3391
|
declare function selectPaymentMethod(args: AsyncCallback<SelectPaymentMethodReturns> & TypeOf<(typeof selectPaymentMethodArgs)[0]>): Promise<SelectPaymentMethodReturns>;
|
|
3358
3392
|
|
|
3359
3393
|
declare const checkTransactionArgs: ZodObject<{
|
|
3360
|
-
data: ZodUnion<[ZodString, ZodRecord<ZodString, ZodString
|
|
3394
|
+
data: ZodUnion<[ZodString, ZodRecord<ZodString, ZodOptional<ZodNullable<ZodString>>>]>;
|
|
3361
3395
|
}, "strip", ZodTypeAny, {
|
|
3362
|
-
data: string | Record<string, string>;
|
|
3396
|
+
data: string | Record<string, string | null | undefined>;
|
|
3363
3397
|
}, {
|
|
3364
|
-
data: string | Record<string, string>;
|
|
3398
|
+
data: string | Record<string, string | null | undefined>;
|
|
3365
3399
|
}>[];
|
|
3400
|
+
/**
|
|
3401
|
+
* Kiểm tra trạng thái giao dịch
|
|
3402
|
+
* @link https://mini.zalo.me/documents/checkout-sdk/checkTransaction/
|
|
3403
|
+
* @param args
|
|
3404
|
+
* @example
|
|
3405
|
+
* ```ts
|
|
3406
|
+
* import { CheckoutSDK } from "zmp-sdk/apis";
|
|
3407
|
+
* // Kiểm tra bằng `orderId` tạo bởi Checkout SDK
|
|
3408
|
+
* const result = await CheckoutSDK.checkTransaction({
|
|
3409
|
+
* data: { orderId: "123456"}
|
|
3410
|
+
* });
|
|
3411
|
+
*
|
|
3412
|
+
* // Kiểm tra bằng `transId` tạo bởi đối tác thanh toán
|
|
3413
|
+
* const result = await CheckoutSDK.checkTransaction({
|
|
3414
|
+
* data: { transId: "123456"}
|
|
3415
|
+
* });
|
|
3416
|
+
*
|
|
3417
|
+
*/
|
|
3366
3418
|
declare function checkTransaction(args: AsyncCallback<CheckTransactionReturns> & TypeOf<(typeof checkTransactionArgs)[0]>): Promise<CheckTransactionReturns>;
|
|
3367
3419
|
|
|
3368
3420
|
declare const createOrderIAPArgs: ZodObject<{
|
|
@@ -3707,15 +3759,20 @@ declare const showOAWidgetArgs: ZodObject<{
|
|
|
3707
3759
|
guidingText: ZodOptional<ZodString>;
|
|
3708
3760
|
color: ZodOptional<ZodString>;
|
|
3709
3761
|
onStatusChange: ZodOptional<ZodFunction<ZodTuple<[], ZodUnknown>, ZodUnknown>>;
|
|
3710
|
-
|
|
3762
|
+
onError: ZodOptional<ZodFunction<ZodTuple<[], ZodUnknown>, ZodUnknown>>;
|
|
3763
|
+
}, "strip", ZodAny, {
|
|
3764
|
+
[x: string]: any;
|
|
3711
3765
|
color?: string | undefined;
|
|
3712
3766
|
guidingText?: string | undefined;
|
|
3713
3767
|
onStatusChange?: ((...args: unknown[]) => unknown) | undefined;
|
|
3768
|
+
onError?: ((...args: unknown[]) => unknown) | undefined;
|
|
3714
3769
|
id: string;
|
|
3715
3770
|
}, {
|
|
3771
|
+
[x: string]: any;
|
|
3716
3772
|
color?: string | undefined;
|
|
3717
3773
|
guidingText?: string | undefined;
|
|
3718
3774
|
onStatusChange?: ((...args: unknown[]) => unknown) | undefined;
|
|
3775
|
+
onError?: ((...args: unknown[]) => unknown) | undefined;
|
|
3719
3776
|
id: string;
|
|
3720
3777
|
}>[];
|
|
3721
3778
|
declare function showOAWidget(args: AsyncVoidCallback & TypeOf<(typeof showOAWidgetArgs)[0]>): Promise<void>;
|
|
@@ -3731,18 +3788,18 @@ declare const showFunctionButtonWidgetArgs: ZodObject<{
|
|
|
3731
3788
|
}, "strip", ZodAny, {
|
|
3732
3789
|
[x: string]: any;
|
|
3733
3790
|
color?: string | undefined;
|
|
3791
|
+
onError?: ((...args: unknown[]) => unknown) | undefined;
|
|
3734
3792
|
disabled?: boolean | undefined;
|
|
3735
3793
|
onDataReceived?: ((...args: unknown[]) => unknown) | undefined;
|
|
3736
|
-
onError?: ((...args: unknown[]) => unknown) | undefined;
|
|
3737
3794
|
text: string;
|
|
3738
3795
|
type: string;
|
|
3739
3796
|
id: string;
|
|
3740
3797
|
}, {
|
|
3741
3798
|
[x: string]: any;
|
|
3742
3799
|
color?: string | undefined;
|
|
3800
|
+
onError?: ((...args: unknown[]) => unknown) | undefined;
|
|
3743
3801
|
disabled?: boolean | undefined;
|
|
3744
3802
|
onDataReceived?: ((...args: unknown[]) => unknown) | undefined;
|
|
3745
|
-
onError?: ((...args: unknown[]) => unknown) | undefined;
|
|
3746
3803
|
text: string;
|
|
3747
3804
|
type: string;
|
|
3748
3805
|
id: string;
|
|
@@ -3782,6 +3839,7 @@ declare const nativeStorage: {
|
|
|
3782
3839
|
};
|
|
3783
3840
|
|
|
3784
3841
|
declare const Payment: {
|
|
3842
|
+
purchase: typeof purchase;
|
|
3785
3843
|
createOrder: typeof createOrder;
|
|
3786
3844
|
checkTransaction: typeof checkTransaction;
|
|
3787
3845
|
createOrderIAP: typeof createOrderIAP;
|
|
@@ -3789,6 +3847,9 @@ declare const Payment: {
|
|
|
3789
3847
|
};
|
|
3790
3848
|
declare const CheckoutSDK: {
|
|
3791
3849
|
purchase: typeof purchase;
|
|
3850
|
+
createOrder: typeof createOrder;
|
|
3851
|
+
checkTransaction: typeof checkTransaction;
|
|
3852
|
+
createOrderIAP: typeof createOrderIAP;
|
|
3792
3853
|
selectPaymentMethod: typeof selectPaymentMethod;
|
|
3793
3854
|
};
|
|
3794
3855
|
|
|
@@ -3911,6 +3972,7 @@ declare const otherApis: {
|
|
|
3911
3972
|
getStorageInfo: typeof getStorageInfoSync;
|
|
3912
3973
|
};
|
|
3913
3974
|
Payment: {
|
|
3975
|
+
purchase: typeof purchase;
|
|
3914
3976
|
createOrder: typeof createOrder;
|
|
3915
3977
|
checkTransaction: typeof checkTransaction;
|
|
3916
3978
|
createOrderIAP: typeof createOrderIAP;
|
|
@@ -3918,6 +3980,9 @@ declare const otherApis: {
|
|
|
3918
3980
|
};
|
|
3919
3981
|
CheckoutSDK: {
|
|
3920
3982
|
purchase: typeof purchase;
|
|
3983
|
+
createOrder: typeof createOrder;
|
|
3984
|
+
checkTransaction: typeof checkTransaction;
|
|
3985
|
+
createOrderIAP: typeof createOrderIAP;
|
|
3921
3986
|
selectPaymentMethod: typeof selectPaymentMethod;
|
|
3922
3987
|
};
|
|
3923
3988
|
downloadFile: typeof downloadFile;
|