@softtynet/zca-js 2.1.20 → 2.2.1
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/apis/addReaction.js +3 -0
- package/dist/apis/createBankAccount.d.ts +8 -0
- package/dist/apis/createBankAccount.js +32 -0
- package/dist/apis/deleteBankAccount.d.ts +11 -0
- package/dist/apis/deleteBankAccount.js +32 -0
- package/dist/apis/getGroupLinkInfo.d.ts +2 -2
- package/dist/apis/getListBank.d.ts +5 -0
- package/dist/apis/getListBank.js +20 -0
- package/dist/apis/getListBankAccount.d.ts +7 -0
- package/dist/apis/getListBankAccount.js +27 -0
- package/dist/apis/getListDevice.d.ts +10 -0
- package/dist/apis/getListDevice.js +22 -0
- package/dist/apis/getUserInfo.d.ts +2 -2
- package/dist/apis/listen.js +1 -1
- package/dist/apis/lostFocus.d.ts +4 -0
- package/dist/apis/lostFocus.js +23 -0
- package/dist/apis/registerCatalog.d.ts +2 -0
- package/dist/apis/registerCatalog.js +27 -0
- package/dist/apis/scanURL.d.ts +4 -0
- package/dist/apis/scanURL.js +28 -0
- package/dist/apis/sendBankCard.js +1 -1
- package/dist/apis/updateBankAccount.d.ts +9 -0
- package/dist/apis/updateBankAccount.js +31 -0
- package/dist/apis.d.ts +18 -0
- package/dist/apis.js +18 -0
- package/dist/cjs/apis/addReaction.cjs +4 -0
- package/dist/cjs/apis/addUnreadMark.cjs +1 -0
- package/dist/cjs/apis/createBankAccount.cjs +37 -0
- package/dist/cjs/apis/createReminder.cjs +1 -0
- package/dist/cjs/apis/deleteBankAccount.cjs +37 -0
- package/dist/cjs/apis/deleteChat.cjs +1 -0
- package/dist/cjs/apis/deleteMessage.cjs +1 -0
- package/dist/cjs/apis/editReminder.cjs +1 -0
- package/dist/cjs/apis/findUser.cjs +1 -0
- package/dist/cjs/apis/findUserByUsername.cjs +1 -0
- package/dist/cjs/apis/forwardMessage.cjs +1 -0
- package/dist/cjs/apis/getAllFriends.cjs +1 -0
- package/dist/cjs/apis/getAvatarUrlProfile.cjs +1 -0
- package/dist/cjs/apis/getGroupChatHistory.cjs +1 -0
- package/dist/cjs/apis/getListBank.cjs +25 -0
- package/dist/cjs/apis/getListBankAccount.cjs +32 -0
- package/dist/cjs/apis/getListBoard.cjs +1 -0
- package/dist/cjs/apis/getListDevice.cjs +27 -0
- package/dist/cjs/apis/getListReminder.cjs +1 -0
- package/dist/cjs/apis/getMultiUsersByPhones.cjs +1 -0
- package/dist/cjs/apis/getUserInfo.cjs +1 -0
- package/dist/cjs/apis/listen.cjs +2 -1
- package/dist/cjs/apis/lostFocus.cjs +28 -0
- package/dist/cjs/apis/registerCatalog.cjs +32 -0
- package/dist/cjs/apis/removeReminder.cjs +1 -0
- package/dist/cjs/apis/removeUnreadMark.cjs +1 -0
- package/dist/cjs/apis/scanURL.cjs +33 -0
- package/dist/cjs/apis/sendBankCard.cjs +2 -1
- package/dist/cjs/apis/sendCard.cjs +1 -0
- package/dist/cjs/apis/sendDeliveredEvent.cjs +1 -0
- package/dist/cjs/apis/sendLink.cjs +1 -0
- package/dist/cjs/apis/sendMessage.cjs +1 -0
- package/dist/cjs/apis/sendReport.cjs +1 -0
- package/dist/cjs/apis/sendSeenEvent.cjs +1 -0
- package/dist/cjs/apis/sendSticker.cjs +1 -0
- package/dist/cjs/apis/sendTypingEvent.cjs +1 -0
- package/dist/cjs/apis/sendVideo.cjs +1 -0
- package/dist/cjs/apis/sendVoice.cjs +1 -0
- package/dist/cjs/apis/setHiddenConversations.cjs +1 -0
- package/dist/cjs/apis/setMute.cjs +1 -0
- package/dist/cjs/apis/setPinnedConversations.cjs +1 -0
- package/dist/cjs/apis/undo.cjs +1 -0
- package/dist/cjs/apis/updateAutoDeleteChat.cjs +1 -0
- package/dist/cjs/apis/updateBankAccount.cjs +36 -0
- package/dist/cjs/apis/uploadAttachment.cjs +1 -0
- package/dist/cjs/apis.cjs +18 -0
- package/dist/cjs/index.cjs +5 -4
- package/dist/cjs/models/Bank.cjs +263 -0
- package/dist/cjs/models/Enum.cjs +4 -235
- package/dist/cjs/update.cjs +1 -1
- package/dist/cjs/utils.cjs +13 -0
- package/dist/index.d.ts +9 -0
- package/dist/models/Bank.d.ts +291 -0
- package/dist/models/Bank.js +262 -0
- package/dist/models/Enum.d.ts +5 -235
- package/dist/models/Enum.js +4 -235
- package/dist/models/User.d.ts +8 -0
- package/dist/models/index.d.ts +1 -0
- package/dist/models/index.js +1 -0
- package/dist/update.js +1 -1
- package/dist/utils.d.ts +1 -0
- package/dist/utils.js +12 -0
- package/package.json +1 -1
package/dist/apis/addReaction.js
CHANGED
|
@@ -15,6 +15,9 @@ export const addReactionFactory = apiFactory()((api, ctx, utils) => {
|
|
|
15
15
|
* @throws {ZaloApiError}
|
|
16
16
|
*/
|
|
17
17
|
return async function addReaction(icon, dest) {
|
|
18
|
+
if (dest.type !== ThreadType.User && dest.type !== ThreadType.Group) {
|
|
19
|
+
throw new ZaloApiError("Thread type is invalid");
|
|
20
|
+
}
|
|
18
21
|
const serviceURL = serviceURLs[dest.type];
|
|
19
22
|
let rType, source;
|
|
20
23
|
if (typeof icon == "object") {
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { BankAccount, BinBankCard } from "../models/index.js";
|
|
2
|
+
export type CreateBankAccountPayload = {
|
|
3
|
+
binBank: BinBankCard;
|
|
4
|
+
numAccBank: string;
|
|
5
|
+
nameAccBank: string;
|
|
6
|
+
};
|
|
7
|
+
export type CreateBankAccountResponse = BankAccount;
|
|
8
|
+
export declare const createBankAccountFactory: (ctx: import("../context.js").ContextBase, api: import("../apis.js").API) => (payload: CreateBankAccountPayload) => Promise<BankAccount>;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { ZaloApiError } from "../Errors/ZaloApiError.js";
|
|
2
|
+
import { apiFactory, normalizeHolderName } from "../utils.js";
|
|
3
|
+
export const createBankAccountFactory = apiFactory()((api, ctx, utils) => {
|
|
4
|
+
const serviceURL = utils.makeURL(`${api.zpwServiceMap.zimsg[0]}/api/transfer/create`);
|
|
5
|
+
/**
|
|
6
|
+
* Create bank account
|
|
7
|
+
*
|
|
8
|
+
* @param payload The payload containing the bank account information
|
|
9
|
+
*
|
|
10
|
+
* @throws {ZaloApiError} When something went wrong, with `error.code`
|
|
11
|
+
* - `-263` - Bank account already exists
|
|
12
|
+
* - `810` - Internal Zalo error, might be invalid input
|
|
13
|
+
*/
|
|
14
|
+
return async function createBankAccount(payload) {
|
|
15
|
+
const params = {
|
|
16
|
+
bin: payload.binBank,
|
|
17
|
+
bank_number: payload.numAccBank,
|
|
18
|
+
holder_name: normalizeHolderName(payload.nameAccBank),
|
|
19
|
+
language: ctx.language,
|
|
20
|
+
};
|
|
21
|
+
const encryptedParams = utils.encodeAES(JSON.stringify(params));
|
|
22
|
+
if (!encryptedParams)
|
|
23
|
+
throw new ZaloApiError("Failed to encrypt params");
|
|
24
|
+
const response = await utils.request(serviceURL, {
|
|
25
|
+
method: "POST",
|
|
26
|
+
body: new URLSearchParams({
|
|
27
|
+
params: encryptedParams,
|
|
28
|
+
}),
|
|
29
|
+
});
|
|
30
|
+
return utils.resolve(response);
|
|
31
|
+
};
|
|
32
|
+
});
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { BankAccount } from "../models/index.js";
|
|
2
|
+
export type DeleteBankAccountPayload = {
|
|
3
|
+
accountId: number;
|
|
4
|
+
isDefault: boolean;
|
|
5
|
+
};
|
|
6
|
+
export type DeleteBankAccountResponse = {
|
|
7
|
+
hasMore: boolean;
|
|
8
|
+
total: number;
|
|
9
|
+
myBanks: BankAccount[];
|
|
10
|
+
};
|
|
11
|
+
export declare const deleteBankAccountFactory: (ctx: import("../context.js").ContextBase, api: import("../apis.js").API) => (payload: DeleteBankAccountPayload) => Promise<DeleteBankAccountResponse>;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { ZaloApiError } from "../Errors/ZaloApiError.js";
|
|
2
|
+
import { apiFactory } from "../utils.js";
|
|
3
|
+
export const deleteBankAccountFactory = apiFactory()((api, ctx, utils) => {
|
|
4
|
+
const serviceURL = utils.makeURL(`${api.zpwServiceMap.zimsg[0]}/api/transfer/delete`);
|
|
5
|
+
/**
|
|
6
|
+
* Delete bank account
|
|
7
|
+
*
|
|
8
|
+
* @param payload The payload containing the bank account information to delete
|
|
9
|
+
*
|
|
10
|
+
* @throws {ZaloApiError} When something went wrong, with `error.code`
|
|
11
|
+
* - `114` - Invalid params
|
|
12
|
+
* - `-265` - Bank account not exists
|
|
13
|
+
* - `810` Internal Zalo error, maybe you're trying to delete a default bank account
|
|
14
|
+
*/
|
|
15
|
+
return async function deleteBankAccount(payload) {
|
|
16
|
+
const params = {
|
|
17
|
+
account_id: payload.accountId,
|
|
18
|
+
is_default: payload.isDefault,
|
|
19
|
+
language: ctx.language,
|
|
20
|
+
};
|
|
21
|
+
const encryptedParams = utils.encodeAES(JSON.stringify(params));
|
|
22
|
+
if (!encryptedParams)
|
|
23
|
+
throw new ZaloApiError("Failed to encrypt params");
|
|
24
|
+
const response = await utils.request(serviceURL, {
|
|
25
|
+
method: "POST",
|
|
26
|
+
body: new URLSearchParams({
|
|
27
|
+
params: encryptedParams,
|
|
28
|
+
}),
|
|
29
|
+
});
|
|
30
|
+
return utils.resolve(response);
|
|
31
|
+
};
|
|
32
|
+
});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { GroupSetting } from "../models/index.js";
|
|
1
|
+
import type { GroupSetting, GroupType } from "../models/index.js";
|
|
2
2
|
export type GetGroupLinkInfoPayload = {
|
|
3
3
|
link: string;
|
|
4
4
|
/**
|
|
@@ -10,7 +10,7 @@ export type GetGroupLinkInfoResponse = {
|
|
|
10
10
|
groupId: string;
|
|
11
11
|
name: string;
|
|
12
12
|
desc: string;
|
|
13
|
-
type:
|
|
13
|
+
type: GroupType;
|
|
14
14
|
creatorId: string;
|
|
15
15
|
avt: string;
|
|
16
16
|
fullAvt: string;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { ZaloApiError } from "../Errors/ZaloApiError.js";
|
|
2
|
+
import { apiFactory } from "../utils.js";
|
|
3
|
+
export const getListBankFactory = apiFactory()((api, _ctx, utils) => {
|
|
4
|
+
const serviceURL = utils.makeURL(`${api.zpwServiceMap.zimsg[0]}/api/transfer/conf`);
|
|
5
|
+
/**
|
|
6
|
+
* Get list bank
|
|
7
|
+
*
|
|
8
|
+
* @throws {ZaloApiError}
|
|
9
|
+
*/
|
|
10
|
+
return async function getListBank() {
|
|
11
|
+
const params = {};
|
|
12
|
+
const encryptedParams = utils.encodeAES(JSON.stringify(params));
|
|
13
|
+
if (!encryptedParams)
|
|
14
|
+
throw new ZaloApiError("Failed to encrypt params");
|
|
15
|
+
const response = await utils.request(utils.makeURL(serviceURL, { params: encryptedParams }), {
|
|
16
|
+
method: "GET",
|
|
17
|
+
});
|
|
18
|
+
return utils.resolve(response);
|
|
19
|
+
};
|
|
20
|
+
});
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { BankAccount } from "../models/index.js";
|
|
2
|
+
export type GetListBankAccountResponse = {
|
|
3
|
+
hasMore: boolean;
|
|
4
|
+
total: number;
|
|
5
|
+
myBanks: BankAccount[];
|
|
6
|
+
};
|
|
7
|
+
export declare const getListBankAccountFactory: (ctx: import("../context.js").ContextBase, api: import("../apis.js").API) => (page?: number, limit?: number) => Promise<GetListBankAccountResponse>;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { ZaloApiError } from "../Errors/ZaloApiError.js";
|
|
2
|
+
import { apiFactory } from "../utils.js";
|
|
3
|
+
export const getListBankAccountFactory = apiFactory()((api, _ctx, utils) => {
|
|
4
|
+
const serviceURL = utils.makeURL(`${api.zpwServiceMap.zimsg[0]}/api/transfer/list`);
|
|
5
|
+
/**
|
|
6
|
+
* Get list bank accounts
|
|
7
|
+
*
|
|
8
|
+
* @param page Page number (default: 0)
|
|
9
|
+
* @param limit Number of items to retrieve (default: 20)
|
|
10
|
+
*
|
|
11
|
+
* @throws {ZaloApiError} When something went wrong, with `error.code`
|
|
12
|
+
* - `114` - Invalid params
|
|
13
|
+
*/
|
|
14
|
+
return async function getListBankAccount(page = 0, limit = 20) {
|
|
15
|
+
const params = {
|
|
16
|
+
page: page,
|
|
17
|
+
limit: limit,
|
|
18
|
+
};
|
|
19
|
+
const encryptedParams = utils.encodeAES(JSON.stringify(params));
|
|
20
|
+
if (!encryptedParams)
|
|
21
|
+
throw new ZaloApiError("Failed to encrypt params");
|
|
22
|
+
const response = await utils.request(utils.makeURL(serviceURL, { params: encryptedParams }), {
|
|
23
|
+
method: "GET",
|
|
24
|
+
});
|
|
25
|
+
return utils.resolve(response);
|
|
26
|
+
};
|
|
27
|
+
});
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export type GetListDeviceResponse = {
|
|
2
|
+
devices: {
|
|
3
|
+
masterId: string;
|
|
4
|
+
encIdentity: string;
|
|
5
|
+
lastUpdateTs: number;
|
|
6
|
+
encSignature: string;
|
|
7
|
+
companions: unknown[];
|
|
8
|
+
};
|
|
9
|
+
};
|
|
10
|
+
export declare const getListDeviceFactory: (ctx: import("../context.js").ContextBase, api: import("../apis.js").API) => () => Promise<GetListDeviceResponse>;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { ZaloApiError } from "../Errors/ZaloApiError.js";
|
|
2
|
+
import { apiFactory } from "../utils.js";
|
|
3
|
+
export const getListDeviceFactory = apiFactory()((api, ctx, utils) => {
|
|
4
|
+
const serviceURL = utils.makeURL(`${api.zpwServiceMap.aext[0]}/api/devices/linked`);
|
|
5
|
+
/**
|
|
6
|
+
* Get list device
|
|
7
|
+
*
|
|
8
|
+
* @throws {ZaloApiError}
|
|
9
|
+
*/
|
|
10
|
+
return async function getListDevice() {
|
|
11
|
+
const params = {
|
|
12
|
+
imei: ctx.imei,
|
|
13
|
+
};
|
|
14
|
+
const encryptedParams = utils.encodeAES(JSON.stringify(params));
|
|
15
|
+
if (!encryptedParams)
|
|
16
|
+
throw new ZaloApiError("Failed to encrypt params");
|
|
17
|
+
const response = await utils.request(utils.makeURL(serviceURL, { params: encryptedParams }), {
|
|
18
|
+
method: "GET",
|
|
19
|
+
});
|
|
20
|
+
return utils.resolve(response);
|
|
21
|
+
};
|
|
22
|
+
});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { AvatarSize, type User } from "../models/index.js";
|
|
1
|
+
import { AvatarSize, type UnchangedProfileInfo, type User } from "../models/index.js";
|
|
2
2
|
export type ProfileInfo = User;
|
|
3
3
|
export type UserInfoResponse = {
|
|
4
|
-
unchanged_profiles: Record<string,
|
|
4
|
+
unchanged_profiles: Record<string, Partial<UnchangedProfileInfo>>;
|
|
5
5
|
phonebook_version: number;
|
|
6
6
|
changed_profiles: Record<string, ProfileInfo>;
|
|
7
7
|
};
|
package/dist/apis/listen.js
CHANGED
|
@@ -254,7 +254,7 @@ export class Listener extends EventEmitter {
|
|
|
254
254
|
ping();
|
|
255
255
|
}, pingIntervalTime);
|
|
256
256
|
}
|
|
257
|
-
if (version == 1 && cmd
|
|
257
|
+
if (version == 1 && ([501, 551].includes(cmd)) && subCmd == 0) {
|
|
258
258
|
const parsedData = (await decodeEventData(parsed, this.cipherKey)).data;
|
|
259
259
|
const { msgs } = parsedData;
|
|
260
260
|
for (const msg of msgs) {
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { ZaloApiError } from "../Errors/ZaloApiError.js";
|
|
2
|
+
import { apiFactory } from "../utils.js";
|
|
3
|
+
export const lostFocusFactory = apiFactory()((api, _ctx, utils) => {
|
|
4
|
+
const serviceURL = utils.makeURL(`${api.zpwServiceMap.profile[0]}/api/social/profile/changefgtobg`);
|
|
5
|
+
/**
|
|
6
|
+
* Lost focus
|
|
7
|
+
*
|
|
8
|
+
* @throws {ZaloApiError}
|
|
9
|
+
*/
|
|
10
|
+
return async function lostFocus() {
|
|
11
|
+
const params = {};
|
|
12
|
+
const encryptedParams = utils.encodeAES(JSON.stringify(params));
|
|
13
|
+
if (!encryptedParams)
|
|
14
|
+
throw new ZaloApiError("Failed to encrypt params");
|
|
15
|
+
const response = await utils.request(serviceURL, {
|
|
16
|
+
method: "POST",
|
|
17
|
+
body: new URLSearchParams({
|
|
18
|
+
params: encryptedParams,
|
|
19
|
+
}),
|
|
20
|
+
});
|
|
21
|
+
return utils.resolve(response);
|
|
22
|
+
};
|
|
23
|
+
});
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { ZaloApiError } from "../Errors/ZaloApiError.js";
|
|
2
|
+
import { apiFactory } from "../utils.js";
|
|
3
|
+
export const registerCatalogFactory = apiFactory()((api, _ctx, utils) => {
|
|
4
|
+
const serviceURL = utils.makeURL(`${api.zpwServiceMap.catalog[0]}/api/prodcatalog/catalog/register`);
|
|
5
|
+
/**
|
|
6
|
+
* Register catalog?
|
|
7
|
+
*
|
|
8
|
+
* @param enable enable or disable catalog
|
|
9
|
+
*
|
|
10
|
+
* @throws {ZaloApiError}
|
|
11
|
+
*/
|
|
12
|
+
return async function registerCatalog(enable) {
|
|
13
|
+
const params = {
|
|
14
|
+
enable: enable ? 1 : 0,
|
|
15
|
+
};
|
|
16
|
+
const encryptedParams = utils.encodeAES(JSON.stringify(params));
|
|
17
|
+
if (!encryptedParams)
|
|
18
|
+
throw new ZaloApiError("Failed to encrypt params");
|
|
19
|
+
const response = await utils.request(serviceURL, {
|
|
20
|
+
method: "POST",
|
|
21
|
+
body: new URLSearchParams({
|
|
22
|
+
params: encryptedParams,
|
|
23
|
+
}),
|
|
24
|
+
});
|
|
25
|
+
return utils.resolve(response);
|
|
26
|
+
};
|
|
27
|
+
});
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { ZaloApiError } from "../Errors/ZaloApiError.js";
|
|
2
|
+
import { apiFactory } from "../utils.js";
|
|
3
|
+
export const scanURLFactory = apiFactory()((api, _ctx, utils) => {
|
|
4
|
+
const serviceURL = utils.makeURL(`${api.zpwServiceMap.file[0]}/api/message/scanurl`);
|
|
5
|
+
/**
|
|
6
|
+
* Scan URL to check if it is safe?
|
|
7
|
+
*
|
|
8
|
+
* @param url URL to scan
|
|
9
|
+
*
|
|
10
|
+
* @throws {ZaloApiError} When something went wrong, with `error.code`
|
|
11
|
+
* - `114` - Invalid params
|
|
12
|
+
*/
|
|
13
|
+
return async function scanURL(url) {
|
|
14
|
+
const params = {
|
|
15
|
+
url: url,
|
|
16
|
+
};
|
|
17
|
+
const encryptedParams = utils.encodeAES(JSON.stringify(params));
|
|
18
|
+
if (!encryptedParams)
|
|
19
|
+
throw new ZaloApiError("Failed to encrypt params");
|
|
20
|
+
const response = await utils.request(serviceURL, {
|
|
21
|
+
method: "POST",
|
|
22
|
+
body: new URLSearchParams({
|
|
23
|
+
params: encryptedParams,
|
|
24
|
+
}),
|
|
25
|
+
});
|
|
26
|
+
return utils.resolve(response);
|
|
27
|
+
};
|
|
28
|
+
});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ZaloApiError } from "../Errors/ZaloApiError.js";
|
|
2
2
|
import { ThreadType } from "../models/index.js";
|
|
3
3
|
import { apiFactory } from "../utils.js";
|
|
4
|
-
export const sendBankCardFactory = apiFactory()((api,
|
|
4
|
+
export const sendBankCardFactory = apiFactory()((api, _, utils) => {
|
|
5
5
|
const serviceURL = utils.makeURL(`${api.zpwServiceMap.zimsg[0]}/api/transfer/card`);
|
|
6
6
|
/**
|
|
7
7
|
* Send bank card
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { BankAccount, BinBankCard } from "../models/index.js";
|
|
2
|
+
export type UpdateBankAccountPayload = {
|
|
3
|
+
accountId: number;
|
|
4
|
+
binBank: BinBankCard;
|
|
5
|
+
numAccBank: string;
|
|
6
|
+
nameAccBank: string;
|
|
7
|
+
};
|
|
8
|
+
export type UpdateBankAccountResponse = BankAccount;
|
|
9
|
+
export declare const updateBankAccountFactory: (ctx: import("../context.js").ContextBase, api: import("../apis.js").API) => (payload: UpdateBankAccountPayload) => Promise<BankAccount>;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { ZaloApiError } from "../Errors/ZaloApiError.js";
|
|
2
|
+
import { apiFactory, normalizeHolderName } from "../utils.js";
|
|
3
|
+
export const updateBankAccountFactory = apiFactory()((api, ctx, utils) => {
|
|
4
|
+
const serviceURL = utils.makeURL(`${api.zpwServiceMap.zimsg[0]}/api/transfer/update`);
|
|
5
|
+
/**
|
|
6
|
+
* Update bank account
|
|
7
|
+
*
|
|
8
|
+
* @param payload The payload containing the bank account information to update
|
|
9
|
+
*
|
|
10
|
+
* @throws {ZaloApiError}
|
|
11
|
+
*/
|
|
12
|
+
return async function updateBankAccount(payload) {
|
|
13
|
+
const params = {
|
|
14
|
+
account_id: payload.accountId,
|
|
15
|
+
bin: payload.binBank,
|
|
16
|
+
bank_number: payload.numAccBank,
|
|
17
|
+
holder_name: normalizeHolderName(payload.nameAccBank),
|
|
18
|
+
language: ctx.language,
|
|
19
|
+
};
|
|
20
|
+
const encryptedParams = utils.encodeAES(JSON.stringify(params));
|
|
21
|
+
if (!encryptedParams)
|
|
22
|
+
throw new ZaloApiError("Failed to encrypt params");
|
|
23
|
+
const response = await utils.request(serviceURL, {
|
|
24
|
+
method: "POST",
|
|
25
|
+
body: new URLSearchParams({
|
|
26
|
+
params: encryptedParams,
|
|
27
|
+
}),
|
|
28
|
+
});
|
|
29
|
+
return utils.resolve(response);
|
|
30
|
+
};
|
|
31
|
+
});
|
package/dist/apis.d.ts
CHANGED
|
@@ -15,6 +15,7 @@ import { changeGroupAvatarFactory } from "./apis/changeGroupAvatar.js";
|
|
|
15
15
|
import { changeGroupNameFactory } from "./apis/changeGroupName.js";
|
|
16
16
|
import { changeGroupOwnerFactory } from "./apis/changeGroupOwner.js";
|
|
17
17
|
import { createAutoReplyFactory } from "./apis/createAutoReply.js";
|
|
18
|
+
import { createBankAccountFactory } from "./apis/createBankAccount.js";
|
|
18
19
|
import { createCatalogFactory } from "./apis/createCatalog.js";
|
|
19
20
|
import { createGroupFactory } from "./apis/createGroup.js";
|
|
20
21
|
import { createNoteFactory } from "./apis/createNote.js";
|
|
@@ -24,6 +25,7 @@ import { createReminderFactory } from "./apis/createReminder.js";
|
|
|
24
25
|
import { decryptGidsFactory } from "./apis/decryptGids.js";
|
|
25
26
|
import { deleteAutoReplyFactory } from "./apis/deleteAutoReply.js";
|
|
26
27
|
import { deleteAvatarFactory } from "./apis/deleteAvatar.js";
|
|
28
|
+
import { deleteBankAccountFactory } from "./apis/deleteBankAccount.js";
|
|
27
29
|
import { deleteCatalogFactory } from "./apis/deleteCatalog.js";
|
|
28
30
|
import { deleteChatFactory } from "./apis/deleteChat.js";
|
|
29
31
|
import { deleteGroupInviteBoxFactory } from "./apis/deleteGroupInviteBox.js";
|
|
@@ -67,7 +69,10 @@ import { getGroupLinkInfoFactory } from "./apis/getGroupLinkInfo.js";
|
|
|
67
69
|
import { getGroupMembersInfoFactory } from "./apis/getGroupMembersInfo.js";
|
|
68
70
|
import { getHiddenConversationsFactory } from "./apis/getHiddenConversations.js";
|
|
69
71
|
import { getLabelsFactory } from "./apis/getLabels.js";
|
|
72
|
+
import { getListBankFactory } from "./apis/getListBank.js";
|
|
73
|
+
import { getListBankAccountFactory } from "./apis/getListBankAccount.js";
|
|
70
74
|
import { getListBoardFactory } from "./apis/getListBoard.js";
|
|
75
|
+
import { getListDeviceFactory } from "./apis/getListDevice.js";
|
|
71
76
|
import { getListReminderFactory } from "./apis/getListReminder.js";
|
|
72
77
|
import { getMultiUsersByPhonesFactory } from "./apis/getMultiUsersByPhones.js";
|
|
73
78
|
import { getMuteFactory } from "./apis/getMute.js";
|
|
@@ -95,8 +100,10 @@ import { keepAliveFactory } from "./apis/keepAlive.js";
|
|
|
95
100
|
import { lastOnlineFactory } from "./apis/lastOnline.js";
|
|
96
101
|
import { leaveGroupFactory } from "./apis/leaveGroup.js";
|
|
97
102
|
import { lockPollFactory } from "./apis/lockPoll.js";
|
|
103
|
+
import { lostFocusFactory } from "./apis/lostFocus.js";
|
|
98
104
|
import { parseLinkFactory } from "./apis/parseLink.js";
|
|
99
105
|
import { preloadConversationsFactory } from "./apis/preloadConversations.js";
|
|
106
|
+
import { registerCatalogFactory } from "./apis/registerCatalog.js";
|
|
100
107
|
import { rejectFriendRequestFactory } from "./apis/rejectFriendRequest.js";
|
|
101
108
|
import { removeFriendFactory } from "./apis/removeFriend.js";
|
|
102
109
|
import { removeFriendAliasFactory } from "./apis/removeFriendAlias.js";
|
|
@@ -110,6 +117,7 @@ import { requestSyncFromPhoneFactory } from "./apis/requestSyncFromPhone.js";
|
|
|
110
117
|
import { resetHiddenConversPinFactory } from "./apis/resetHiddenConversPin.js";
|
|
111
118
|
import { reuseAvatarFactory } from "./apis/reuseAvatar.js";
|
|
112
119
|
import { reviewPendingMemberRequestFactory } from "./apis/reviewPendingMemberRequest.js";
|
|
120
|
+
import { scanURLFactory } from "./apis/scanURL.js";
|
|
113
121
|
import { searchStickerFactory } from "./apis/searchSticker.js";
|
|
114
122
|
import { sendBankCardFactory } from "./apis/sendBankCard.js";
|
|
115
123
|
import { sendCardFactory } from "./apis/sendCard.js";
|
|
@@ -134,6 +142,7 @@ import { updateActiveStatusFactory } from "./apis/updateActiveStatus.js";
|
|
|
134
142
|
import { updateArchivedChatListFactory } from "./apis/updateArchivedChatList.js";
|
|
135
143
|
import { updateAutoDeleteChatFactory } from "./apis/updateAutoDeleteChat.js";
|
|
136
144
|
import { updateAutoReplyFactory } from "./apis/updateAutoReply.js";
|
|
145
|
+
import { updateBankAccountFactory } from "./apis/updateBankAccount.js";
|
|
137
146
|
import { updateCatalogFactory } from "./apis/updateCatalog.js";
|
|
138
147
|
import { updateGroupSettingsFactory } from "./apis/updateGroupSettings.js";
|
|
139
148
|
import { updateHiddenConversPinFactory } from "./apis/updateHiddenConversPin.js";
|
|
@@ -169,6 +178,7 @@ export declare class API {
|
|
|
169
178
|
changeGroupName: ReturnType<typeof changeGroupNameFactory>;
|
|
170
179
|
changeGroupOwner: ReturnType<typeof changeGroupOwnerFactory>;
|
|
171
180
|
createAutoReply: ReturnType<typeof createAutoReplyFactory>;
|
|
181
|
+
createBankAccount: ReturnType<typeof createBankAccountFactory>;
|
|
172
182
|
createCatalog: ReturnType<typeof createCatalogFactory>;
|
|
173
183
|
createGroup: ReturnType<typeof createGroupFactory>;
|
|
174
184
|
createNote: ReturnType<typeof createNoteFactory>;
|
|
@@ -178,6 +188,7 @@ export declare class API {
|
|
|
178
188
|
decryptGids: ReturnType<typeof decryptGidsFactory>;
|
|
179
189
|
deleteAutoReply: ReturnType<typeof deleteAutoReplyFactory>;
|
|
180
190
|
deleteAvatar: ReturnType<typeof deleteAvatarFactory>;
|
|
191
|
+
deleteBankAccount: ReturnType<typeof deleteBankAccountFactory>;
|
|
181
192
|
deleteCatalog: ReturnType<typeof deleteCatalogFactory>;
|
|
182
193
|
deleteChat: ReturnType<typeof deleteChatFactory>;
|
|
183
194
|
deleteGroupInviteBox: ReturnType<typeof deleteGroupInviteBoxFactory>;
|
|
@@ -221,7 +232,10 @@ export declare class API {
|
|
|
221
232
|
getGroupMembersInfo: ReturnType<typeof getGroupMembersInfoFactory>;
|
|
222
233
|
getHiddenConversations: ReturnType<typeof getHiddenConversationsFactory>;
|
|
223
234
|
getLabels: ReturnType<typeof getLabelsFactory>;
|
|
235
|
+
getListBank: ReturnType<typeof getListBankFactory>;
|
|
236
|
+
getListBankAccount: ReturnType<typeof getListBankAccountFactory>;
|
|
224
237
|
getListBoard: ReturnType<typeof getListBoardFactory>;
|
|
238
|
+
getListDevice: ReturnType<typeof getListDeviceFactory>;
|
|
225
239
|
getListReminder: ReturnType<typeof getListReminderFactory>;
|
|
226
240
|
getMultiUsersByPhones: ReturnType<typeof getMultiUsersByPhonesFactory>;
|
|
227
241
|
getMute: ReturnType<typeof getMuteFactory>;
|
|
@@ -249,8 +263,10 @@ export declare class API {
|
|
|
249
263
|
lastOnline: ReturnType<typeof lastOnlineFactory>;
|
|
250
264
|
leaveGroup: ReturnType<typeof leaveGroupFactory>;
|
|
251
265
|
lockPoll: ReturnType<typeof lockPollFactory>;
|
|
266
|
+
lostFocus: ReturnType<typeof lostFocusFactory>;
|
|
252
267
|
parseLink: ReturnType<typeof parseLinkFactory>;
|
|
253
268
|
preloadConversations: ReturnType<typeof preloadConversationsFactory>;
|
|
269
|
+
registerCatalog: ReturnType<typeof registerCatalogFactory>;
|
|
254
270
|
rejectFriendRequest: ReturnType<typeof rejectFriendRequestFactory>;
|
|
255
271
|
removeFriend: ReturnType<typeof removeFriendFactory>;
|
|
256
272
|
removeFriendAlias: ReturnType<typeof removeFriendAliasFactory>;
|
|
@@ -264,6 +280,7 @@ export declare class API {
|
|
|
264
280
|
resetHiddenConversPin: ReturnType<typeof resetHiddenConversPinFactory>;
|
|
265
281
|
reuseAvatar: ReturnType<typeof reuseAvatarFactory>;
|
|
266
282
|
reviewPendingMemberRequest: ReturnType<typeof reviewPendingMemberRequestFactory>;
|
|
283
|
+
scanURL: ReturnType<typeof scanURLFactory>;
|
|
267
284
|
searchSticker: ReturnType<typeof searchStickerFactory>;
|
|
268
285
|
sendBankCard: ReturnType<typeof sendBankCardFactory>;
|
|
269
286
|
sendCard: ReturnType<typeof sendCardFactory>;
|
|
@@ -288,6 +305,7 @@ export declare class API {
|
|
|
288
305
|
updateArchivedChatList: ReturnType<typeof updateArchivedChatListFactory>;
|
|
289
306
|
updateAutoDeleteChat: ReturnType<typeof updateAutoDeleteChatFactory>;
|
|
290
307
|
updateAutoReply: ReturnType<typeof updateAutoReplyFactory>;
|
|
308
|
+
updateBankAccount: ReturnType<typeof updateBankAccountFactory>;
|
|
291
309
|
updateCatalog: ReturnType<typeof updateCatalogFactory>;
|
|
292
310
|
updateGroupSettings: ReturnType<typeof updateGroupSettingsFactory>;
|
|
293
311
|
updateHiddenConversPin: ReturnType<typeof updateHiddenConversPinFactory>;
|
package/dist/apis.js
CHANGED
|
@@ -15,6 +15,7 @@ import { changeGroupAvatarFactory } from "./apis/changeGroupAvatar.js";
|
|
|
15
15
|
import { changeGroupNameFactory } from "./apis/changeGroupName.js";
|
|
16
16
|
import { changeGroupOwnerFactory } from "./apis/changeGroupOwner.js";
|
|
17
17
|
import { createAutoReplyFactory } from "./apis/createAutoReply.js";
|
|
18
|
+
import { createBankAccountFactory } from "./apis/createBankAccount.js";
|
|
18
19
|
import { createCatalogFactory } from "./apis/createCatalog.js";
|
|
19
20
|
import { createGroupFactory } from "./apis/createGroup.js";
|
|
20
21
|
import { createNoteFactory } from "./apis/createNote.js";
|
|
@@ -24,6 +25,7 @@ import { createReminderFactory } from "./apis/createReminder.js";
|
|
|
24
25
|
import { decryptGidsFactory } from "./apis/decryptGids.js";
|
|
25
26
|
import { deleteAutoReplyFactory } from "./apis/deleteAutoReply.js";
|
|
26
27
|
import { deleteAvatarFactory } from "./apis/deleteAvatar.js";
|
|
28
|
+
import { deleteBankAccountFactory } from "./apis/deleteBankAccount.js";
|
|
27
29
|
import { deleteCatalogFactory } from "./apis/deleteCatalog.js";
|
|
28
30
|
import { deleteChatFactory } from "./apis/deleteChat.js";
|
|
29
31
|
import { deleteGroupInviteBoxFactory } from "./apis/deleteGroupInviteBox.js";
|
|
@@ -67,7 +69,10 @@ import { getGroupLinkInfoFactory } from "./apis/getGroupLinkInfo.js";
|
|
|
67
69
|
import { getGroupMembersInfoFactory } from "./apis/getGroupMembersInfo.js";
|
|
68
70
|
import { getHiddenConversationsFactory } from "./apis/getHiddenConversations.js";
|
|
69
71
|
import { getLabelsFactory } from "./apis/getLabels.js";
|
|
72
|
+
import { getListBankFactory } from "./apis/getListBank.js";
|
|
73
|
+
import { getListBankAccountFactory } from "./apis/getListBankAccount.js";
|
|
70
74
|
import { getListBoardFactory } from "./apis/getListBoard.js";
|
|
75
|
+
import { getListDeviceFactory } from "./apis/getListDevice.js";
|
|
71
76
|
import { getListReminderFactory } from "./apis/getListReminder.js";
|
|
72
77
|
import { getMultiUsersByPhonesFactory } from "./apis/getMultiUsersByPhones.js";
|
|
73
78
|
import { getMuteFactory } from "./apis/getMute.js";
|
|
@@ -95,8 +100,10 @@ import { keepAliveFactory } from "./apis/keepAlive.js";
|
|
|
95
100
|
import { lastOnlineFactory } from "./apis/lastOnline.js";
|
|
96
101
|
import { leaveGroupFactory } from "./apis/leaveGroup.js";
|
|
97
102
|
import { lockPollFactory } from "./apis/lockPoll.js";
|
|
103
|
+
import { lostFocusFactory } from "./apis/lostFocus.js";
|
|
98
104
|
import { parseLinkFactory } from "./apis/parseLink.js";
|
|
99
105
|
import { preloadConversationsFactory } from "./apis/preloadConversations.js";
|
|
106
|
+
import { registerCatalogFactory } from "./apis/registerCatalog.js";
|
|
100
107
|
import { rejectFriendRequestFactory } from "./apis/rejectFriendRequest.js";
|
|
101
108
|
import { removeFriendFactory } from "./apis/removeFriend.js";
|
|
102
109
|
import { removeFriendAliasFactory } from "./apis/removeFriendAlias.js";
|
|
@@ -110,6 +117,7 @@ import { requestSyncFromPhoneFactory } from "./apis/requestSyncFromPhone.js";
|
|
|
110
117
|
import { resetHiddenConversPinFactory } from "./apis/resetHiddenConversPin.js";
|
|
111
118
|
import { reuseAvatarFactory } from "./apis/reuseAvatar.js";
|
|
112
119
|
import { reviewPendingMemberRequestFactory } from "./apis/reviewPendingMemberRequest.js";
|
|
120
|
+
import { scanURLFactory } from "./apis/scanURL.js";
|
|
113
121
|
import { searchStickerFactory } from "./apis/searchSticker.js";
|
|
114
122
|
import { sendBankCardFactory } from "./apis/sendBankCard.js";
|
|
115
123
|
import { sendCardFactory } from "./apis/sendCard.js";
|
|
@@ -134,6 +142,7 @@ import { updateActiveStatusFactory } from "./apis/updateActiveStatus.js";
|
|
|
134
142
|
import { updateArchivedChatListFactory } from "./apis/updateArchivedChatList.js";
|
|
135
143
|
import { updateAutoDeleteChatFactory } from "./apis/updateAutoDeleteChat.js";
|
|
136
144
|
import { updateAutoReplyFactory } from "./apis/updateAutoReply.js";
|
|
145
|
+
import { updateBankAccountFactory } from "./apis/updateBankAccount.js";
|
|
137
146
|
import { updateCatalogFactory } from "./apis/updateCatalog.js";
|
|
138
147
|
import { updateGroupSettingsFactory } from "./apis/updateGroupSettings.js";
|
|
139
148
|
import { updateHiddenConversPinFactory } from "./apis/updateHiddenConversPin.js";
|
|
@@ -169,6 +178,7 @@ export class API {
|
|
|
169
178
|
this.changeGroupName = changeGroupNameFactory(ctx, this);
|
|
170
179
|
this.changeGroupOwner = changeGroupOwnerFactory(ctx, this);
|
|
171
180
|
this.createAutoReply = createAutoReplyFactory(ctx, this);
|
|
181
|
+
this.createBankAccount = createBankAccountFactory(ctx, this);
|
|
172
182
|
this.createCatalog = createCatalogFactory(ctx, this);
|
|
173
183
|
this.createGroup = createGroupFactory(ctx, this);
|
|
174
184
|
this.createNote = createNoteFactory(ctx, this);
|
|
@@ -178,6 +188,7 @@ export class API {
|
|
|
178
188
|
this.decryptGids = decryptGidsFactory(ctx, this);
|
|
179
189
|
this.deleteAutoReply = deleteAutoReplyFactory(ctx, this);
|
|
180
190
|
this.deleteAvatar = deleteAvatarFactory(ctx, this);
|
|
191
|
+
this.deleteBankAccount = deleteBankAccountFactory(ctx, this);
|
|
181
192
|
this.deleteCatalog = deleteCatalogFactory(ctx, this);
|
|
182
193
|
this.deleteChat = deleteChatFactory(ctx, this);
|
|
183
194
|
this.deleteGroupInviteBox = deleteGroupInviteBoxFactory(ctx, this);
|
|
@@ -221,7 +232,10 @@ export class API {
|
|
|
221
232
|
this.getGroupMembersInfo = getGroupMembersInfoFactory(ctx, this);
|
|
222
233
|
this.getHiddenConversations = getHiddenConversationsFactory(ctx, this);
|
|
223
234
|
this.getLabels = getLabelsFactory(ctx, this);
|
|
235
|
+
this.getListBank = getListBankFactory(ctx, this);
|
|
236
|
+
this.getListBankAccount = getListBankAccountFactory(ctx, this);
|
|
224
237
|
this.getListBoard = getListBoardFactory(ctx, this);
|
|
238
|
+
this.getListDevice = getListDeviceFactory(ctx, this);
|
|
225
239
|
this.getListReminder = getListReminderFactory(ctx, this);
|
|
226
240
|
this.getMultiUsersByPhones = getMultiUsersByPhonesFactory(ctx, this);
|
|
227
241
|
this.getMute = getMuteFactory(ctx, this);
|
|
@@ -249,8 +263,10 @@ export class API {
|
|
|
249
263
|
this.lastOnline = lastOnlineFactory(ctx, this);
|
|
250
264
|
this.leaveGroup = leaveGroupFactory(ctx, this);
|
|
251
265
|
this.lockPoll = lockPollFactory(ctx, this);
|
|
266
|
+
this.lostFocus = lostFocusFactory(ctx, this);
|
|
252
267
|
this.parseLink = parseLinkFactory(ctx, this);
|
|
253
268
|
this.preloadConversations = preloadConversationsFactory(ctx, this);
|
|
269
|
+
this.registerCatalog = registerCatalogFactory(ctx, this);
|
|
254
270
|
this.rejectFriendRequest = rejectFriendRequestFactory(ctx, this);
|
|
255
271
|
this.removeFriend = removeFriendFactory(ctx, this);
|
|
256
272
|
this.removeFriendAlias = removeFriendAliasFactory(ctx, this);
|
|
@@ -264,6 +280,7 @@ export class API {
|
|
|
264
280
|
this.resetHiddenConversPin = resetHiddenConversPinFactory(ctx, this);
|
|
265
281
|
this.reuseAvatar = reuseAvatarFactory(ctx, this);
|
|
266
282
|
this.reviewPendingMemberRequest = reviewPendingMemberRequestFactory(ctx, this);
|
|
283
|
+
this.scanURL = scanURLFactory(ctx, this);
|
|
267
284
|
this.searchSticker = searchStickerFactory(ctx, this);
|
|
268
285
|
this.sendBankCard = sendBankCardFactory(ctx, this);
|
|
269
286
|
this.sendCard = sendCardFactory(ctx, this);
|
|
@@ -288,6 +305,7 @@ export class API {
|
|
|
288
305
|
this.updateArchivedChatList = updateArchivedChatListFactory(ctx, this);
|
|
289
306
|
this.updateAutoDeleteChat = updateAutoDeleteChatFactory(ctx, this);
|
|
290
307
|
this.updateAutoReply = updateAutoReplyFactory(ctx, this);
|
|
308
|
+
this.updateBankAccount = updateBankAccountFactory(ctx, this);
|
|
291
309
|
this.updateCatalog = updateCatalogFactory(ctx, this);
|
|
292
310
|
this.updateGroupSettings = updateGroupSettingsFactory(ctx, this);
|
|
293
311
|
this.updateHiddenConversPin = updateHiddenConversPinFactory(ctx, this);
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
var ZaloApiError = require('../Errors/ZaloApiError.cjs');
|
|
4
4
|
require('../models/AutoReply.cjs');
|
|
5
|
+
require('../models/Bank.cjs');
|
|
5
6
|
require('../models/Board.cjs');
|
|
6
7
|
var Enum = require('../models/Enum.cjs');
|
|
7
8
|
require('../models/FriendEvent.cjs');
|
|
@@ -26,6 +27,9 @@ const addReactionFactory = utils.apiFactory()((api, ctx, utils) => {
|
|
|
26
27
|
* @throws {ZaloApiError}
|
|
27
28
|
*/
|
|
28
29
|
return async function addReaction(icon, dest) {
|
|
30
|
+
if (dest.type !== Enum.ThreadType.User && dest.type !== Enum.ThreadType.Group) {
|
|
31
|
+
throw new ZaloApiError.ZaloApiError("Thread type is invalid");
|
|
32
|
+
}
|
|
29
33
|
const serviceURL = serviceURLs[dest.type];
|
|
30
34
|
let rType, source;
|
|
31
35
|
if (typeof icon == "object") {
|