zmp-sdk 2.18.0 → 2.19.0-rc.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/browser.min.js +208 -4
- package/dist/index.es.js +209 -5
- package/dist/index.js +1 -1
- package/dist/index.umd.js +1 -1
- package/dist/types/src/apis/index.d.ts +2 -0
- package/dist/types/src/apis/payment.d.ts +30 -0
- package/dist/types/src/constants.d.ts +5 -0
- package/dist/types/src/index.d.ts +3 -0
- package/dist/types/src/services/mock-mp-service.d.ts +2 -0
- package/dist/types/src/services/payment.d.ts +27 -0
- package/dist/types/src/types/callbackData.d.ts +21 -0
- package/dist/types/src/types/inputData.d.ts +17 -0
- package/dist/types/src/types/interface.d.ts +5 -0
- package/package.json +1 -1
|
@@ -2,9 +2,11 @@ import { SDKServiceInterface } from '../types/interface';
|
|
|
2
2
|
import { ZMPEEmitter } from '../event-emitter';
|
|
3
3
|
import * as InputDataType from '../types/inputData';
|
|
4
4
|
import * as CallbackDataType from '../types/callbackData';
|
|
5
|
+
import { ZaloMiniAppPaymentCreator } from './payment';
|
|
5
6
|
export declare abstract class SDKCreator {
|
|
6
7
|
#private;
|
|
7
8
|
events: ZMPEEmitter;
|
|
9
|
+
payment: ZaloMiniAppPaymentCreator;
|
|
8
10
|
constructor();
|
|
9
11
|
protected abstract getServiceInstance(): SDKServiceInterface;
|
|
10
12
|
/**
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import * as InputDataType from '../types/inputData';
|
|
2
|
+
import * as CallbackDataType from '../types/callbackData';
|
|
3
|
+
import { PaymentServiceInterface } from '../types/interface';
|
|
4
|
+
import { SDKCreator } from '.';
|
|
5
|
+
export declare abstract class PaymentCreator {
|
|
6
|
+
#private;
|
|
7
|
+
constructor(sdk: SDKCreator);
|
|
8
|
+
protected abstract getInstance(): PaymentServiceInterface;
|
|
9
|
+
/**
|
|
10
|
+
* Tạo đơn hàng
|
|
11
|
+
*
|
|
12
|
+
* @async
|
|
13
|
+
* @function createOrder
|
|
14
|
+
* @category Payment
|
|
15
|
+
* @returns {Promise<CallbackDataType.CreateOrderCallBack>}
|
|
16
|
+
*/
|
|
17
|
+
createOrder(object: InputDataType.CreateOrder): Promise<CallbackDataType.CreateOrderCallBack>;
|
|
18
|
+
/**
|
|
19
|
+
* Lấy thông tin transaction
|
|
20
|
+
*
|
|
21
|
+
* @async
|
|
22
|
+
* @function checkTransaction
|
|
23
|
+
* @category Payment
|
|
24
|
+
* @returns {Promise<CallbackDataType.CheckTransactionSuccessCallBack>}
|
|
25
|
+
*/
|
|
26
|
+
checkTransaction(object: InputDataType.CheckTransaction): Promise<CallbackDataType.CheckTransactionSuccessCallBack>;
|
|
27
|
+
}
|
|
28
|
+
export declare class ZaloMiniAppPaymentCreator extends PaymentCreator {
|
|
29
|
+
protected getInstance(): PaymentServiceInterface;
|
|
30
|
+
}
|
|
@@ -14,6 +14,7 @@ export declare const APIS: {
|
|
|
14
14
|
GET_ACCESS_TOKEN: string;
|
|
15
15
|
GET_ACCESS_TOKEN_V3: string;
|
|
16
16
|
GET_LIST_USER_INFO: string;
|
|
17
|
+
CREATE_ORDER: string;
|
|
17
18
|
};
|
|
18
19
|
export declare const STORAGE_DATA_LIMIT: number;
|
|
19
20
|
export declare const STORAGE_LIMIT: number;
|
|
@@ -77,3 +78,7 @@ export declare const ACTION_LEFT_BUTTON_TYPE: {
|
|
|
77
78
|
};
|
|
78
79
|
export declare const SHOW_ACTION_BAR = 5;
|
|
79
80
|
export declare const HIDE_ACTION_BAR = 6;
|
|
81
|
+
export declare const PAYMENT_APIS: {
|
|
82
|
+
CREATE_ORDER: string;
|
|
83
|
+
GET_TRANSACTION: string;
|
|
84
|
+
};
|
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
import { SDKCreator } from './apis';
|
|
2
|
+
import { ZaloMiniAppPaymentCreator } from './apis/payment';
|
|
2
3
|
declare let app: SDKCreator;
|
|
4
|
+
declare const payment: ZaloMiniAppPaymentCreator;
|
|
3
5
|
export * from './types/inputData';
|
|
4
6
|
export * from './types/callbackData';
|
|
5
7
|
export * from './types/entity';
|
|
6
8
|
export * from './types/enum';
|
|
7
9
|
export { SDKCreator };
|
|
8
10
|
export { app as default };
|
|
11
|
+
export { payment as Payment };
|
|
@@ -83,4 +83,6 @@ export default class MockSDKService implements SDKServiceInterface {
|
|
|
83
83
|
}, silentRequest?: 0 | 1, maxSelectItem?: number): Promise<CallbackDataType.OpenMediaPickerSuccessCallBack>;
|
|
84
84
|
openOutApp: (url: string) => Promise<void>;
|
|
85
85
|
closeLoading: (when: string) => Promise<void>;
|
|
86
|
+
createOrder(object: InputDataType.CreateOrder): Promise<CallbackDataType.CreateOrderCallBack>;
|
|
87
|
+
checkTransaction(object: InputDataType.CheckTransaction): Promise<CallbackDataType.CheckTransactionSuccessCallBack>;
|
|
86
88
|
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import * as InputDataType from '../types/inputData';
|
|
2
|
+
import * as CallbackDataType from '../types/callbackData';
|
|
3
|
+
import { PaymentServiceInterface } from '../types/interface';
|
|
4
|
+
import { SDKCreator } from '..';
|
|
5
|
+
export declare class PaymentService implements PaymentServiceInterface {
|
|
6
|
+
#private;
|
|
7
|
+
private static instance;
|
|
8
|
+
static getInstance(): PaymentService;
|
|
9
|
+
/**
|
|
10
|
+
* Tạo đơn hàng
|
|
11
|
+
*
|
|
12
|
+
* @async
|
|
13
|
+
* @function createOrder
|
|
14
|
+
* @category PaymentService
|
|
15
|
+
* @returns {Promise<CallbackDataType.CreateOrderCallBack>}
|
|
16
|
+
*/
|
|
17
|
+
createOrder(this: PaymentService, sdk: SDKCreator, object: InputDataType.CreateOrder): Promise<CallbackDataType.CreateOrderCallBack>;
|
|
18
|
+
/**
|
|
19
|
+
* Lấy thông tin transaction
|
|
20
|
+
*
|
|
21
|
+
* @async
|
|
22
|
+
* @function checkTransaction
|
|
23
|
+
* @category PaymentService
|
|
24
|
+
* @returns {Promise<CallbackDataType.CheckTransactionSuccessCallBack>}
|
|
25
|
+
*/
|
|
26
|
+
checkTransaction(this: PaymentService, object: InputDataType.CheckTransaction): Promise<CallbackDataType.CheckTransactionSuccessCallBack>;
|
|
27
|
+
}
|
|
@@ -115,6 +115,7 @@ export declare type AppInfoSuccessCallBack = {
|
|
|
115
115
|
name: string;
|
|
116
116
|
appUrl: string;
|
|
117
117
|
qrCodeUrl: string;
|
|
118
|
+
logoUrl?: string;
|
|
118
119
|
};
|
|
119
120
|
/**
|
|
120
121
|
* get phone number success callback
|
|
@@ -152,3 +153,23 @@ export declare type GetActionsSupportedSuccessCallBack = {
|
|
|
152
153
|
export declare type OpenMediaPickerSuccessCallBack = {
|
|
153
154
|
urls: Array<string>;
|
|
154
155
|
};
|
|
156
|
+
/**
|
|
157
|
+
* open create order success callback
|
|
158
|
+
* @typedef CreateOrderCallBack
|
|
159
|
+
*/
|
|
160
|
+
export declare type CreateOrderCallBack = {
|
|
161
|
+
orderId: string;
|
|
162
|
+
};
|
|
163
|
+
/**
|
|
164
|
+
* get transaction success callback
|
|
165
|
+
* @typedef CheckTransactionSuccessCallBack
|
|
166
|
+
*/
|
|
167
|
+
export declare type CheckTransactionSuccessCallBack = {
|
|
168
|
+
msg: string;
|
|
169
|
+
appId: string;
|
|
170
|
+
merchantAppId?: string;
|
|
171
|
+
id: string;
|
|
172
|
+
resultCode: number;
|
|
173
|
+
transTime: number;
|
|
174
|
+
createdAt: string;
|
|
175
|
+
};
|
|
@@ -444,4 +444,21 @@ export declare type GetShareableLink<T> = CallbackType<T> & {
|
|
|
444
444
|
thumbnail: string;
|
|
445
445
|
path: string;
|
|
446
446
|
};
|
|
447
|
+
/**
|
|
448
|
+
* CreateOrder type
|
|
449
|
+
*/
|
|
450
|
+
export declare type CreateOrder = CallbackType & {
|
|
451
|
+
amount: string | number;
|
|
452
|
+
item: Array<{
|
|
453
|
+
[key: string]: string;
|
|
454
|
+
}>;
|
|
455
|
+
desc: string;
|
|
456
|
+
extradata?: any;
|
|
457
|
+
method?: 'ZALOPAY' | 'MOMO' | 'ZALOPAY_SANDBOX' | 'MOMO_SANDBOX' | 'GATEWAY';
|
|
458
|
+
};
|
|
459
|
+
export declare type CheckTransaction = CallbackType & {
|
|
460
|
+
data: string | {
|
|
461
|
+
[key: string]: string;
|
|
462
|
+
};
|
|
463
|
+
};
|
|
447
464
|
export {};
|
|
@@ -2,6 +2,7 @@ import * as InputDataType from './inputData';
|
|
|
2
2
|
import * as CallbackDataType from './callbackData';
|
|
3
3
|
import { systemInfo } from './entity';
|
|
4
4
|
import { MediaPickerType } from './enum';
|
|
5
|
+
import { SDKCreator } from '..';
|
|
5
6
|
export interface SDKServiceInterface {
|
|
6
7
|
getAppId: () => string;
|
|
7
8
|
login: (object?: InputDataType.CallbackType) => Promise<string>;
|
|
@@ -80,3 +81,7 @@ export interface SDKServiceInterface {
|
|
|
80
81
|
openOutApp: (url: string) => Promise<void>;
|
|
81
82
|
closeLoading: (when: string) => Promise<void>;
|
|
82
83
|
}
|
|
84
|
+
export interface PaymentServiceInterface {
|
|
85
|
+
createOrder: (sdk: SDKCreator, object: InputDataType.CreateOrder) => Promise<CallbackDataType.CreateOrderCallBack>;
|
|
86
|
+
checkTransaction: (object: InputDataType.CheckTransaction) => Promise<CallbackDataType.CheckTransactionSuccessCallBack>;
|
|
87
|
+
}
|