ggez-banking-sdk 0.1.34 → 0.1.36
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/bank-system/constants/structure.d.ts +10 -0
- package/dist/bank-system/constants/structure.js +11 -1
- package/dist/bank-system/helper/index.js +3 -1
- package/dist/bank-system/services/blockchain.js +2 -1
- package/dist/bank-system/utils/blockchainHelper.d.ts +1 -0
- package/dist/bank-system/utils/blockchainHelper.js +23 -1
- package/package.json +1 -1
@@ -60,3 +60,13 @@ export declare const StructTicketMessageDescriptionCodes: {
|
|
60
60
|
Identification_Verification_Canceled: string;
|
61
61
|
Phone_Verification: string;
|
62
62
|
};
|
63
|
+
export declare const SystemResponses: {
|
64
|
+
Approved: string;
|
65
|
+
Create_User_Completed_Partially: string;
|
66
|
+
};
|
67
|
+
export declare const BlockchainActions: {
|
68
|
+
Send: string;
|
69
|
+
MultiSend: string;
|
70
|
+
Delegate: string;
|
71
|
+
Undelegate: string;
|
72
|
+
};
|
@@ -1,6 +1,6 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.StructTicketMessageDescriptionCodes = void 0;
|
3
|
+
exports.BlockchainActions = exports.SystemResponses = exports.StructTicketMessageDescriptionCodes = void 0;
|
4
4
|
exports.StructTicketMessageDescriptionCodes = {
|
5
5
|
Custom: "M000",
|
6
6
|
Identification_Is_Being_Verified: "M100",
|
@@ -63,3 +63,13 @@ exports.StructTicketMessageDescriptionCodes = {
|
|
63
63
|
Identification_Verification_Canceled: "M157",
|
64
64
|
Phone_Verification: "M158",
|
65
65
|
};
|
66
|
+
exports.SystemResponses = {
|
67
|
+
Approved: "0000",
|
68
|
+
Create_User_Completed_Partially: "0100",
|
69
|
+
};
|
70
|
+
exports.BlockchainActions = {
|
71
|
+
Send: "send",
|
72
|
+
MultiSend: "multisend",
|
73
|
+
Delegate: "delegate",
|
74
|
+
Undelegate: "undelegate",
|
75
|
+
};
|
@@ -11,6 +11,7 @@ const qs_1 = __importDefault(require("qs"));
|
|
11
11
|
const enum_1 = require("../constants/enum");
|
12
12
|
const fillDeviceDetails_1 = require("../utils/fillDeviceDetails");
|
13
13
|
const info_1 = require("../utils/info");
|
14
|
+
const constants_1 = require("../constants");
|
14
15
|
const Helper = (userInfo) => {
|
15
16
|
// error Handler
|
16
17
|
const errorHandler = (error, funcName, response) => {
|
@@ -364,7 +365,8 @@ const Helper = (userInfo) => {
|
|
364
365
|
};
|
365
366
|
const checkUserResponseAuth = (response, showMessageSuccess, funcName) => {
|
366
367
|
let check = response?.data?.result?.code;
|
367
|
-
if (check !=
|
368
|
+
if (check != constants_1.SystemResponses.Approved ||
|
369
|
+
check != constants_1.SystemResponses.Create_User_Completed_Partially) {
|
368
370
|
errorHandler(response?.data?.result?.friendly_message, funcName, response);
|
369
371
|
}
|
370
372
|
else if (!showMessageSuccess) {
|
@@ -23,7 +23,8 @@ const useBlockchain = (token, userInfo, userId, baseUrl, lang) => {
|
|
23
23
|
};
|
24
24
|
const RequestHandler = async (data, requestType) => {
|
25
25
|
try {
|
26
|
-
const
|
26
|
+
const endpoint = (0, blockchainHelper_1.GetEndpointByRequestType)(requestType);
|
27
|
+
const response = await restApi_1.default.restApi(baseUrl, constants_1.HTTPMethod.POST, endpoint, GetHeadersConfig(), data);
|
27
28
|
const { key, functionName } = (0, blockchainHelper_1.GetKeyAndFunctionNameByRequestType)(requestType);
|
28
29
|
const { newUserInfo } = checkGlobalResponse(key, response, functionName, key);
|
29
30
|
return {
|
@@ -1,6 +1,6 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.GetKeyAndFunctionNameByRequestType = void 0;
|
3
|
+
exports.GetEndpointByRequestType = exports.GetKeyAndFunctionNameByRequestType = void 0;
|
4
4
|
const constants_1 = require("../constants");
|
5
5
|
const GetKeyAndFunctionNameByRequestType = (requestType) => {
|
6
6
|
switch (requestType) {
|
@@ -17,3 +17,25 @@ const GetKeyAndFunctionNameByRequestType = (requestType) => {
|
|
17
17
|
}
|
18
18
|
};
|
19
19
|
exports.GetKeyAndFunctionNameByRequestType = GetKeyAndFunctionNameByRequestType;
|
20
|
+
const GetEndpointByRequestType = (requestType) => {
|
21
|
+
let action;
|
22
|
+
switch (requestType) {
|
23
|
+
case constants_1.BlockchainRequestType.Send:
|
24
|
+
action = constants_1.BlockchainActions.Send;
|
25
|
+
break;
|
26
|
+
case constants_1.BlockchainRequestType.Multi_Send:
|
27
|
+
action = constants_1.BlockchainActions.MultiSend;
|
28
|
+
break;
|
29
|
+
case constants_1.BlockchainRequestType.Delegate:
|
30
|
+
action = constants_1.BlockchainActions.Delegate;
|
31
|
+
break;
|
32
|
+
case constants_1.BlockchainRequestType.UnDelegate:
|
33
|
+
action = constants_1.BlockchainActions.Undelegate;
|
34
|
+
break;
|
35
|
+
default:
|
36
|
+
action = "";
|
37
|
+
break;
|
38
|
+
}
|
39
|
+
return `${constants_1.Endpoints.Blockchain}/${action}`;
|
40
|
+
};
|
41
|
+
exports.GetEndpointByRequestType = GetEndpointByRequestType;
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "ggez-banking-sdk",
|
3
|
-
"version": "0.1.
|
3
|
+
"version": "0.1.36",
|
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",
|