ggez-banking-sdk 0.1.62 → 0.1.63

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.
@@ -12,7 +12,13 @@ export declare const useAccount: (token: string, userInfo: UserInfo, userId: str
12
12
  message: any;
13
13
  status: string;
14
14
  }>;
15
- GetAccount: (installationId?: string) => Promise<{
15
+ GetUserAccounts: (installationId?: string) => Promise<{
16
+ response: any;
17
+ newUser: any;
18
+ message: any;
19
+ status: string;
20
+ }>;
21
+ GetAccountData: (accountId: number) => Promise<{
16
22
  response: any;
17
23
  newUser: any;
18
24
  message: any;
@@ -12,8 +12,9 @@ const useAccount = (token, userInfo, userId, baseUrl, geoCoordinates, lang) => {
12
12
  const { checkGlobalResponse } = checkResponse();
13
13
  const { dataAccount } = (0, dataStructure_1.default)();
14
14
  const { dataDoTransaction, paramGetTransaction } = dataAccount();
15
- let endPointTransaction = `v1/transaction`;
16
- let endPointAccount = `v1/user/account/${userId}`;
15
+ const endPointTransaction = `v1/transaction`;
16
+ const endPointUserAccounts = `v1/user/account/${userId}`;
17
+ const endPointAccount = "v1/account";
17
18
  const headerConfigAccount = (installationId) => {
18
19
  let headersData = {
19
20
  header: true,
@@ -47,9 +48,30 @@ const useAccount = (token, userInfo, userId, baseUrl, geoCoordinates, lang) => {
47
48
  };
48
49
  }
49
50
  };
50
- const GetAccount = async (installationId) => {
51
+ const GetUserAccounts = async (installationId) => {
51
52
  try {
52
- const response = await restApi_1.default.restApi(baseUrl, "GET", endPointAccount, headerConfigAccount(installationId));
53
+ const response = await restApi_1.default.restApi(baseUrl, "GET", endPointUserAccounts, headerConfigAccount(installationId));
54
+ let { newUserInfo } = checkGlobalResponse("account", response, "getAccount", "getAccount");
55
+ return {
56
+ response: response?.data?.account,
57
+ newUser: newUserInfo,
58
+ message: response?.data?.result?.friendly_message ??
59
+ "Get Account Successfully",
60
+ status: "success",
61
+ };
62
+ }
63
+ catch (error) {
64
+ return {
65
+ response: error.response,
66
+ newUser: null,
67
+ message: error.message,
68
+ status: "failed",
69
+ };
70
+ }
71
+ };
72
+ const GetAccountData = async (accountId) => {
73
+ try {
74
+ const response = await restApi_1.default.restApi(baseUrl, "GET", `${endPointAccount}/${accountId}`, headerConfigAccount());
53
75
  let { newUserInfo } = checkGlobalResponse("account", response, "getAccount", "getAccount");
54
76
  return {
55
77
  response: response?.data?.account,
@@ -113,7 +135,8 @@ const useAccount = (token, userInfo, userId, baseUrl, geoCoordinates, lang) => {
113
135
  };
114
136
  return {
115
137
  GetTransactionByUserId,
116
- GetAccount,
138
+ GetUserAccounts,
139
+ GetAccountData,
117
140
  DoTransaction,
118
141
  GetAccountLimit,
119
142
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ggez-banking-sdk",
3
- "version": "0.1.62",
3
+ "version": "0.1.63",
4
4
  "description": "A Node.js package to handle GGEZ Banking API endpoints, Simplify the process of managing CRUD operations with this efficient and easy-to-use package.",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",