ggez-banking-sdk 0.0.2 → 0.0.4
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/package.json +10 -2
- package/README.md +0 -0
- package/dist/bank-system/constants/enum.d.ts +0 -1057
- package/dist/bank-system/constants/enum.js +0 -1110
- package/dist/bank-system/constants/index.d.ts +0 -1
- package/dist/bank-system/constants/index.js +0 -17
- package/dist/bank-system/content/accountCurrencies.d.ts +0 -12
- package/dist/bank-system/content/accountCurrencies.js +0 -37
- package/dist/bank-system/content/countries.d.ts +0 -24
- package/dist/bank-system/content/countries.js +0 -6472
- package/dist/bank-system/content/currencies.d.ts +0 -32
- package/dist/bank-system/content/currencies.js +0 -5836
- package/dist/bank-system/content/index.d.ts +0 -4
- package/dist/bank-system/content/index.js +0 -12
- package/dist/bank-system/content/state.d.ts +0 -6
- package/dist/bank-system/content/state.js +0 -350
- package/dist/bank-system/helper/data.d.ts +0 -46
- package/dist/bank-system/helper/data.js +0 -57
- package/dist/bank-system/helper/dataStructure.d.ts +0 -3220
- package/dist/bank-system/helper/dataStructure.js +0 -1051
- package/dist/bank-system/helper/index.d.ts +0 -28
- package/dist/bank-system/helper/index.js +0 -394
- package/dist/bank-system/interfaces/accountInterface.d.ts +0 -26
- package/dist/bank-system/interfaces/accountInterface.js +0 -2
- package/dist/bank-system/interfaces/bankingSystemInterface.d.ts +0 -306
- package/dist/bank-system/interfaces/bankingSystemInterface.js +0 -2
- package/dist/bank-system/interfaces/deviceInterface.d.ts +0 -34
- package/dist/bank-system/interfaces/deviceInterface.js +0 -2
- package/dist/bank-system/interfaces/index.d.ts +0 -4
- package/dist/bank-system/interfaces/index.js +0 -20
- package/dist/bank-system/interfaces/interface.d.ts +0 -460
- package/dist/bank-system/interfaces/interface.js +0 -2
- package/dist/bank-system/interfaces/organizationInterface.d.ts +0 -118
- package/dist/bank-system/interfaces/organizationInterface.js +0 -2
- package/dist/bank-system/interfaces/signInterface.d.ts +0 -89
- package/dist/bank-system/interfaces/signInterface.js +0 -2
- package/dist/bank-system/interfaces/transactionInterface.d.ts +0 -17
- package/dist/bank-system/interfaces/transactionInterface.js +0 -2
- package/dist/bank-system/restApi/index.d.ts +0 -8
- package/dist/bank-system/restApi/index.js +0 -41
- package/dist/bank-system/services/account.d.ts +0 -33
- package/dist/bank-system/services/account.js +0 -129
- package/dist/bank-system/services/addresses.d.ts +0 -48
- package/dist/bank-system/services/addresses.js +0 -130
- package/dist/bank-system/services/auth.d.ts +0 -71
- package/dist/bank-system/services/auth.js +0 -250
- package/dist/bank-system/services/bankAccount.d.ts +0 -48
- package/dist/bank-system/services/bankAccount.js +0 -131
- package/dist/bank-system/services/device.d.ts +0 -46
- package/dist/bank-system/services/device.js +0 -212
- package/dist/bank-system/services/document.d.ts +0 -15
- package/dist/bank-system/services/document.js +0 -58
- package/dist/bank-system/services/email.d.ts +0 -70
- package/dist/bank-system/services/email.js +0 -175
- package/dist/bank-system/services/history.d.ts +0 -14
- package/dist/bank-system/services/history.js +0 -55
- package/dist/bank-system/services/identification.d.ts +0 -37
- package/dist/bank-system/services/identification.js +0 -107
- package/dist/bank-system/services/index.d.ts +0 -17
- package/dist/bank-system/services/index.js +0 -35
- package/dist/bank-system/services/organization.d.ts +0 -28
- package/dist/bank-system/services/organization.js +0 -129
- package/dist/bank-system/services/personalInfo.d.ts +0 -26
- package/dist/bank-system/services/personalInfo.js +0 -91
- package/dist/bank-system/services/phone.d.ts +0 -70
- package/dist/bank-system/services/phone.js +0 -175
- package/dist/bank-system/services/security.d.ts +0 -114
- package/dist/bank-system/services/security.js +0 -267
- package/dist/bank-system/services/token.d.ts +0 -11
- package/dist/bank-system/services/token.js +0 -83
- package/dist/bank-system/services/transaction.d.ts +0 -9
- package/dist/bank-system/services/transaction.js +0 -62
- package/dist/bank-system/services/verifyAndConfirm.d.ts +0 -116
- package/dist/bank-system/services/verifyAndConfirm.js +0 -308
- package/dist/bank-system/utils/chainAddressMasking.d.ts +0 -2
- package/dist/bank-system/utils/chainAddressMasking.js +0 -12
- package/dist/bank-system/utils/copyText.d.ts +0 -5
- package/dist/bank-system/utils/copyText.js +0 -22
- package/dist/bank-system/utils/countryAndCurrencyData.d.ts +0 -11
- package/dist/bank-system/utils/countryAndCurrencyData.js +0 -22
- package/dist/bank-system/utils/enumToOption.d.ts +0 -4
- package/dist/bank-system/utils/enumToOption.js +0 -18
- package/dist/bank-system/utils/fillDeviceDetails.d.ts +0 -23
- package/dist/bank-system/utils/fillDeviceDetails.js +0 -44
- package/dist/bank-system/utils/generateOneLiner.d.ts +0 -1
- package/dist/bank-system/utils/generateOneLiner.js +0 -17
- package/dist/bank-system/utils/generateSourceId.d.ts +0 -1
- package/dist/bank-system/utils/generateSourceId.js +0 -13
- package/dist/bank-system/utils/getCountryName.d.ts +0 -1
- package/dist/bank-system/utils/getCountryName.js +0 -16
- package/dist/bank-system/utils/getEnumName.d.ts +0 -1
- package/dist/bank-system/utils/getEnumName.js +0 -10
- package/dist/bank-system/utils/getStateByCountryCode.d.ts +0 -1
- package/dist/bank-system/utils/getStateByCountryCode.js +0 -15
- package/dist/bank-system/utils/handleEncryption/decryptData.d.ts +0 -15
- package/dist/bank-system/utils/handleEncryption/decryptData.js +0 -78
- package/dist/bank-system/utils/handleEncryption/encryptData.d.ts +0 -2
- package/dist/bank-system/utils/handleEncryption/encryptData.js +0 -37
- package/dist/bank-system/utils/handleEncryption/index.d.ts +0 -4
- package/dist/bank-system/utils/handleEncryption/index.js +0 -12
- package/dist/bank-system/utils/handleEncryption/key.d.ts +0 -13
- package/dist/bank-system/utils/handleEncryption/key.js +0 -40
- package/dist/bank-system/utils/index.d.ts +0 -15
- package/dist/bank-system/utils/index.js +0 -42
- package/dist/bank-system/utils/info.d.ts +0 -8
- package/dist/bank-system/utils/info.js +0 -79
- package/dist/bank-system/utils/maskingFunction.d.ts +0 -1
- package/dist/bank-system/utils/maskingFunction.js +0 -28
- package/dist/bank-system/utils/regex.d.ts +0 -106
- package/dist/bank-system/utils/regex.js +0 -110
- package/dist/bank-system/utils/sortUserInfo.d.ts +0 -1
- package/dist/bank-system/utils/sortUserInfo.js +0 -43
- package/dist/index.d.ts +0 -8
- package/dist/index.js +0 -54
- package/dist/keplr-config/chainInfo.d.ts +0 -8
- package/dist/keplr-config/chainInfo.js +0 -111
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
-
};
|
|
14
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
const axios_1 = __importDefault(require("axios"));
|
|
16
|
-
class ApiService {
|
|
17
|
-
constructor() {
|
|
18
|
-
this.bearer = (token) => {
|
|
19
|
-
return `bearer ${token}`;
|
|
20
|
-
};
|
|
21
|
-
this.restApi = (baseURL, method, endpoint, headers, data, params) => __awaiter(this, void 0, void 0, function* () {
|
|
22
|
-
const config = {
|
|
23
|
-
method: method,
|
|
24
|
-
url: `${baseURL}/${endpoint}`,
|
|
25
|
-
params: params,
|
|
26
|
-
headers: headers,
|
|
27
|
-
data: data,
|
|
28
|
-
};
|
|
29
|
-
try {
|
|
30
|
-
let response = yield (0, axios_1.default)(config);
|
|
31
|
-
return response;
|
|
32
|
-
}
|
|
33
|
-
catch (error) {
|
|
34
|
-
console.error("Error making GET request:", error);
|
|
35
|
-
throw error;
|
|
36
|
-
}
|
|
37
|
-
});
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
const RestApiService = new ApiService();
|
|
41
|
-
exports.default = RestApiService;
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { doTransactionInterface, GetTransactionInterface, GetAccountLimit } from "../interfaces/accountInterface";
|
|
2
|
-
import { IGeoCoordinates, UserInfo } from "../interfaces/interface";
|
|
3
|
-
export declare const useAccount: (token: string, userInfo: UserInfo, userId: string, baseUrl: string, geoCoordinates: IGeoCoordinates, lang?: string) => {
|
|
4
|
-
GetTransactionByUserId: (values: GetTransactionInterface) => Promise<{
|
|
5
|
-
response: import("axios").AxiosResponse<any, any>;
|
|
6
|
-
newUser: any;
|
|
7
|
-
message: any;
|
|
8
|
-
status: string;
|
|
9
|
-
} | {
|
|
10
|
-
response: any;
|
|
11
|
-
newUser: any;
|
|
12
|
-
message: any;
|
|
13
|
-
status: string;
|
|
14
|
-
}>;
|
|
15
|
-
GetAccount: () => Promise<{
|
|
16
|
-
response: any;
|
|
17
|
-
newUser: any;
|
|
18
|
-
message: any;
|
|
19
|
-
status: string;
|
|
20
|
-
}>;
|
|
21
|
-
DoTransaction: (values: doTransactionInterface) => Promise<{
|
|
22
|
-
response: any;
|
|
23
|
-
newUser: any;
|
|
24
|
-
message: any;
|
|
25
|
-
status: string;
|
|
26
|
-
}>;
|
|
27
|
-
GetAccountLimit: (values: GetAccountLimit) => Promise<{
|
|
28
|
-
response: any;
|
|
29
|
-
newUser: any;
|
|
30
|
-
message: any;
|
|
31
|
-
status: string;
|
|
32
|
-
}>;
|
|
33
|
-
};
|
|
@@ -1,129 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
-
};
|
|
14
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
exports.useAccount = void 0;
|
|
16
|
-
const restApi_1 = __importDefault(require("../restApi"));
|
|
17
|
-
const helper_1 = __importDefault(require("../helper"));
|
|
18
|
-
const dataStructure_1 = __importDefault(require("../helper/dataStructure"));
|
|
19
|
-
const useAccount = (token, userInfo, userId, baseUrl, geoCoordinates, lang) => {
|
|
20
|
-
const { checkResponse, headerConfig } = (0, helper_1.default)(userInfo);
|
|
21
|
-
const { checkGlobalResponse } = checkResponse();
|
|
22
|
-
const { dataAccount } = (0, dataStructure_1.default)();
|
|
23
|
-
const { dataDoTransaction, paramGetTransaction } = dataAccount();
|
|
24
|
-
let endPointTransaction = `v1/transaction`;
|
|
25
|
-
let endPointAccount = `v1/user/account/${userId}`;
|
|
26
|
-
const headerConfigAccount = () => {
|
|
27
|
-
let headersData = {
|
|
28
|
-
header: true,
|
|
29
|
-
isUrlEncoded: false,
|
|
30
|
-
token: token,
|
|
31
|
-
lang: lang,
|
|
32
|
-
};
|
|
33
|
-
let headers = headerConfig(headersData);
|
|
34
|
-
return headers;
|
|
35
|
-
};
|
|
36
|
-
const GetTransactionByUserId = (values) => __awaiter(void 0, void 0, void 0, function* () {
|
|
37
|
-
var _a, _b, _c;
|
|
38
|
-
let params = paramGetTransaction(Object.assign(Object.assign({}, values), { geoCoordinates: geoCoordinates }), userId);
|
|
39
|
-
try {
|
|
40
|
-
const response = yield restApi_1.default.restApi(baseUrl, "GET", `${endPointTransaction}/inquiry`, headerConfigAccount(), null, params);
|
|
41
|
-
let { newUserInfo } = checkGlobalResponse("account", response, "getTransaction", "get");
|
|
42
|
-
return {
|
|
43
|
-
response: response,
|
|
44
|
-
newUser: newUserInfo,
|
|
45
|
-
message: (_c = (_b = (_a = response === null || response === void 0 ? void 0 : response.data) === null || _a === void 0 ? void 0 : _a.result) === null || _b === void 0 ? void 0 : _b.friendly_message) !== null && _c !== void 0 ? _c : "Get Transaction Successfully",
|
|
46
|
-
status: "success",
|
|
47
|
-
};
|
|
48
|
-
}
|
|
49
|
-
catch (error) {
|
|
50
|
-
return {
|
|
51
|
-
response: error.response,
|
|
52
|
-
newUser: null,
|
|
53
|
-
message: error.message,
|
|
54
|
-
status: "failed",
|
|
55
|
-
};
|
|
56
|
-
}
|
|
57
|
-
});
|
|
58
|
-
const GetAccount = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
59
|
-
var _d, _e, _f, _g;
|
|
60
|
-
try {
|
|
61
|
-
const response = yield restApi_1.default.restApi(baseUrl, "GET", endPointAccount, headerConfigAccount());
|
|
62
|
-
let { newUserInfo } = checkGlobalResponse("account", response, "getAccount", "getAccount");
|
|
63
|
-
return {
|
|
64
|
-
response: (_d = response === null || response === void 0 ? void 0 : response.data) === null || _d === void 0 ? void 0 : _d.account,
|
|
65
|
-
newUser: newUserInfo,
|
|
66
|
-
message: (_g = (_f = (_e = response === null || response === void 0 ? void 0 : response.data) === null || _e === void 0 ? void 0 : _e.result) === null || _f === void 0 ? void 0 : _f.friendly_message) !== null && _g !== void 0 ? _g : "Get Account Successfully",
|
|
67
|
-
status: "success",
|
|
68
|
-
};
|
|
69
|
-
}
|
|
70
|
-
catch (error) {
|
|
71
|
-
return {
|
|
72
|
-
response: error.response,
|
|
73
|
-
newUser: null,
|
|
74
|
-
message: error.message,
|
|
75
|
-
status: "failed",
|
|
76
|
-
};
|
|
77
|
-
}
|
|
78
|
-
});
|
|
79
|
-
const DoTransaction = (values) => __awaiter(void 0, void 0, void 0, function* () {
|
|
80
|
-
var _h, _j, _k;
|
|
81
|
-
let data = dataDoTransaction(Object.assign(Object.assign({}, values), { geoCoordinates: geoCoordinates }));
|
|
82
|
-
try {
|
|
83
|
-
const response = yield restApi_1.default.restApi(baseUrl, "POST", `${endPointTransaction}`, headerConfigAccount(), data);
|
|
84
|
-
let { newUserInfo } = checkGlobalResponse("account", response, "doTransaction", "doTransaction");
|
|
85
|
-
return {
|
|
86
|
-
response: response === null || response === void 0 ? void 0 : response.data,
|
|
87
|
-
newUser: newUserInfo,
|
|
88
|
-
message: (_k = (_j = (_h = response === null || response === void 0 ? void 0 : response.data) === null || _h === void 0 ? void 0 : _h.result) === null || _j === void 0 ? void 0 : _j.friendly_message) !== null && _k !== void 0 ? _k : "Transaction Successfully",
|
|
89
|
-
status: "success",
|
|
90
|
-
};
|
|
91
|
-
}
|
|
92
|
-
catch (error) {
|
|
93
|
-
return {
|
|
94
|
-
response: error.response,
|
|
95
|
-
newUser: null,
|
|
96
|
-
message: error.message,
|
|
97
|
-
status: "failed",
|
|
98
|
-
};
|
|
99
|
-
}
|
|
100
|
-
});
|
|
101
|
-
const GetAccountLimit = (values) => __awaiter(void 0, void 0, void 0, function* () {
|
|
102
|
-
var _l, _m, _o;
|
|
103
|
-
try {
|
|
104
|
-
const response = yield restApi_1.default.restApi(baseUrl, "GET", `v1/account/${values.account_id}`, headerConfigAccount());
|
|
105
|
-
let { newUserInfo } = checkGlobalResponse("account", response, "getAccountLimit", "getAccountLimit");
|
|
106
|
-
return {
|
|
107
|
-
response: response === null || response === void 0 ? void 0 : response.data,
|
|
108
|
-
newUser: newUserInfo,
|
|
109
|
-
message: (_o = (_m = (_l = response === null || response === void 0 ? void 0 : response.data) === null || _l === void 0 ? void 0 : _l.result) === null || _m === void 0 ? void 0 : _m.friendly_message) !== null && _o !== void 0 ? _o : "Get Account Limit Successfully",
|
|
110
|
-
status: "success",
|
|
111
|
-
};
|
|
112
|
-
}
|
|
113
|
-
catch (error) {
|
|
114
|
-
return {
|
|
115
|
-
response: error.response,
|
|
116
|
-
newUser: null,
|
|
117
|
-
message: error.message,
|
|
118
|
-
status: "failed",
|
|
119
|
-
};
|
|
120
|
-
}
|
|
121
|
-
});
|
|
122
|
-
return {
|
|
123
|
-
GetTransactionByUserId,
|
|
124
|
-
GetAccount,
|
|
125
|
-
DoTransaction,
|
|
126
|
-
GetAccountLimit,
|
|
127
|
-
};
|
|
128
|
-
};
|
|
129
|
-
exports.useAccount = useAccount;
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import { CreateAddressInterface, DeleteUserAddressInterface, MakeAddressPrimaryInterface, UpdateAddressInterface } from "../interfaces/bankingSystemInterface";
|
|
2
|
-
import { IGeoCoordinates, UserInfo } from "../interfaces/interface";
|
|
3
|
-
export declare const useAddresses: (token: string, userInfo: UserInfo, userId: string, baseUrl: string, geoCoordinates: IGeoCoordinates, lang?: string) => {
|
|
4
|
-
CreateAddress: (values: CreateAddressInterface) => Promise<{
|
|
5
|
-
response: import("axios").AxiosResponse<any, any>;
|
|
6
|
-
newUser: any;
|
|
7
|
-
message: any;
|
|
8
|
-
status: string;
|
|
9
|
-
} | {
|
|
10
|
-
response: any;
|
|
11
|
-
newUser: any;
|
|
12
|
-
message: any;
|
|
13
|
-
status: string;
|
|
14
|
-
}>;
|
|
15
|
-
UpdateUserAddress: (values: UpdateAddressInterface) => Promise<{
|
|
16
|
-
response: import("axios").AxiosResponse<any, any>;
|
|
17
|
-
newUser: any;
|
|
18
|
-
message: any;
|
|
19
|
-
status: string;
|
|
20
|
-
} | {
|
|
21
|
-
response: any;
|
|
22
|
-
newUser: any;
|
|
23
|
-
message: any;
|
|
24
|
-
status: string;
|
|
25
|
-
}>;
|
|
26
|
-
MakeUserAddressPrimary: (values: MakeAddressPrimaryInterface) => Promise<{
|
|
27
|
-
response: import("axios").AxiosResponse<any, any>;
|
|
28
|
-
newUser: any;
|
|
29
|
-
message: any;
|
|
30
|
-
status: string;
|
|
31
|
-
} | {
|
|
32
|
-
response: any;
|
|
33
|
-
newUser: any;
|
|
34
|
-
message: any;
|
|
35
|
-
status: string;
|
|
36
|
-
}>;
|
|
37
|
-
DeleteUserAddress: (values: DeleteUserAddressInterface) => Promise<{
|
|
38
|
-
response: import("axios").AxiosResponse<any, any>;
|
|
39
|
-
newUser: any;
|
|
40
|
-
message: any;
|
|
41
|
-
status: string;
|
|
42
|
-
} | {
|
|
43
|
-
response: any;
|
|
44
|
-
newUser: any;
|
|
45
|
-
message: any;
|
|
46
|
-
status: string;
|
|
47
|
-
}>;
|
|
48
|
-
};
|
|
@@ -1,130 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
-
};
|
|
14
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
exports.useAddresses = void 0;
|
|
16
|
-
const restApi_1 = __importDefault(require("../restApi"));
|
|
17
|
-
const helper_1 = __importDefault(require("../helper"));
|
|
18
|
-
const dataStructure_1 = __importDefault(require("../helper/dataStructure"));
|
|
19
|
-
const useAddresses = (token, userInfo, userId, baseUrl, geoCoordinates, lang) => {
|
|
20
|
-
const { dataAddress } = (0, dataStructure_1.default)();
|
|
21
|
-
const { createDataAddress, deleteDataAddress, primaryDataAddress, updateDataAddress, } = dataAddress();
|
|
22
|
-
const { checkResponse, headerConfig } = (0, helper_1.default)(userInfo);
|
|
23
|
-
const { checkGlobalResponse } = checkResponse();
|
|
24
|
-
let endPointAddress = `v1/user/address/${userId}`;
|
|
25
|
-
const headerConfigAddresses = () => {
|
|
26
|
-
let headersData = {
|
|
27
|
-
header: true,
|
|
28
|
-
isUrlEncoded: false,
|
|
29
|
-
token: token,
|
|
30
|
-
lang: lang,
|
|
31
|
-
};
|
|
32
|
-
let headers = headerConfig(headersData);
|
|
33
|
-
return headers;
|
|
34
|
-
};
|
|
35
|
-
const CreateAddress = (values) => __awaiter(void 0, void 0, void 0, function* () {
|
|
36
|
-
var _a, _b, _c;
|
|
37
|
-
let data = createDataAddress(Object.assign(Object.assign({}, values), { geoCoordinates: geoCoordinates }));
|
|
38
|
-
try {
|
|
39
|
-
const response = yield restApi_1.default.restApi(baseUrl, "POST", endPointAddress, headerConfigAddresses(), data);
|
|
40
|
-
let { newUserInfo } = checkGlobalResponse("addresses", response, "CreateAddress", "create");
|
|
41
|
-
return {
|
|
42
|
-
response: response,
|
|
43
|
-
newUser: newUserInfo,
|
|
44
|
-
message: (_c = (_b = (_a = response === null || response === void 0 ? void 0 : response.data) === null || _a === void 0 ? void 0 : _a.result) === null || _b === void 0 ? void 0 : _b.friendly_message) !== null && _c !== void 0 ? _c : "Address Created Successfully",
|
|
45
|
-
status: "success",
|
|
46
|
-
};
|
|
47
|
-
}
|
|
48
|
-
catch (error) {
|
|
49
|
-
return {
|
|
50
|
-
response: error.response,
|
|
51
|
-
newUser: null,
|
|
52
|
-
message: error.message,
|
|
53
|
-
status: "failed",
|
|
54
|
-
};
|
|
55
|
-
}
|
|
56
|
-
});
|
|
57
|
-
const UpdateUserAddress = (values) => __awaiter(void 0, void 0, void 0, function* () {
|
|
58
|
-
var _d, _e, _f;
|
|
59
|
-
let data = updateDataAddress(Object.assign(Object.assign({}, values), { geoCoordinates: geoCoordinates }));
|
|
60
|
-
try {
|
|
61
|
-
const response = yield restApi_1.default.restApi(baseUrl, "PUT", endPointAddress, headerConfigAddresses(), data);
|
|
62
|
-
let { newUserInfo } = checkGlobalResponse("addresses", response, "UpdateUserAddress", "update");
|
|
63
|
-
return {
|
|
64
|
-
response: response,
|
|
65
|
-
newUser: newUserInfo,
|
|
66
|
-
message: (_f = (_e = (_d = response === null || response === void 0 ? void 0 : response.data) === null || _d === void 0 ? void 0 : _d.result) === null || _e === void 0 ? void 0 : _e.friendly_message) !== null && _f !== void 0 ? _f : "Address Updated Successfully",
|
|
67
|
-
status: "success",
|
|
68
|
-
};
|
|
69
|
-
}
|
|
70
|
-
catch (error) {
|
|
71
|
-
return {
|
|
72
|
-
response: error.response,
|
|
73
|
-
newUser: null,
|
|
74
|
-
message: error.message,
|
|
75
|
-
status: "failed",
|
|
76
|
-
};
|
|
77
|
-
}
|
|
78
|
-
});
|
|
79
|
-
const DeleteUserAddress = (values) => __awaiter(void 0, void 0, void 0, function* () {
|
|
80
|
-
var _g, _h, _j;
|
|
81
|
-
let data = deleteDataAddress(Object.assign(Object.assign({}, values), { geoCoordinates: geoCoordinates }));
|
|
82
|
-
try {
|
|
83
|
-
const response = yield restApi_1.default.restApi(baseUrl, "DELETE", endPointAddress, headerConfigAddresses(), data);
|
|
84
|
-
let { newUserInfo } = checkGlobalResponse("addresses", response, "DeleteUserAddress", "delete");
|
|
85
|
-
return {
|
|
86
|
-
response: response,
|
|
87
|
-
newUser: newUserInfo,
|
|
88
|
-
message: (_j = (_h = (_g = response === null || response === void 0 ? void 0 : response.data) === null || _g === void 0 ? void 0 : _g.result) === null || _h === void 0 ? void 0 : _h.friendly_message) !== null && _j !== void 0 ? _j : "Address Deleted Successfully",
|
|
89
|
-
status: "success",
|
|
90
|
-
};
|
|
91
|
-
}
|
|
92
|
-
catch (error) {
|
|
93
|
-
return {
|
|
94
|
-
response: error.response,
|
|
95
|
-
newUser: null,
|
|
96
|
-
message: error.message,
|
|
97
|
-
status: "failed",
|
|
98
|
-
};
|
|
99
|
-
}
|
|
100
|
-
});
|
|
101
|
-
const MakeUserAddressPrimary = (values) => __awaiter(void 0, void 0, void 0, function* () {
|
|
102
|
-
var _k, _l, _m;
|
|
103
|
-
let data = primaryDataAddress(Object.assign(Object.assign({}, values), { geoCoordinates: geoCoordinates }));
|
|
104
|
-
try {
|
|
105
|
-
const response = yield restApi_1.default.restApi(baseUrl, "PUT", endPointAddress, headerConfigAddresses(), data);
|
|
106
|
-
let { newUserInfo } = checkGlobalResponse("addresses", response, "MakeUserAddressPrimary", "updatePrimary");
|
|
107
|
-
return {
|
|
108
|
-
response: response,
|
|
109
|
-
newUser: newUserInfo,
|
|
110
|
-
message: (_m = (_l = (_k = response === null || response === void 0 ? void 0 : response.data) === null || _k === void 0 ? void 0 : _k.result) === null || _l === void 0 ? void 0 : _l.friendly_message) !== null && _m !== void 0 ? _m : "Primary Address Updated Successfully",
|
|
111
|
-
status: "success",
|
|
112
|
-
};
|
|
113
|
-
}
|
|
114
|
-
catch (error) {
|
|
115
|
-
return {
|
|
116
|
-
response: error.response,
|
|
117
|
-
newUser: null,
|
|
118
|
-
message: error.message,
|
|
119
|
-
status: "failed",
|
|
120
|
-
};
|
|
121
|
-
}
|
|
122
|
-
});
|
|
123
|
-
return {
|
|
124
|
-
CreateAddress,
|
|
125
|
-
UpdateUserAddress,
|
|
126
|
-
MakeUserAddressPrimary,
|
|
127
|
-
DeleteUserAddress,
|
|
128
|
-
};
|
|
129
|
-
};
|
|
130
|
-
exports.useAddresses = useAddresses;
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
import { LoginWithGoogleInterface, SignUpInterface, SignUpWithGoogleInterface, LoginRequestInterface, LoginDeviceCredentialInterface } from "../interfaces/signInterface";
|
|
2
|
-
import { IGeoCoordinates, UserInfo } from "../interfaces/interface";
|
|
3
|
-
import { LimitedTokenInterface } from "../interfaces/signInterface";
|
|
4
|
-
export declare const useAuth: (baseUrl: string, nodeUrl: string, userInfo: UserInfo, tokenData: LimitedTokenInterface, programId: string, geoCoordinates?: IGeoCoordinates, lang?: string) => {
|
|
5
|
-
GetUser: (installationId: string, token?: string, userId?: string) => Promise<{
|
|
6
|
-
response: import("axios").AxiosResponse<any, any>;
|
|
7
|
-
newUser: {};
|
|
8
|
-
message: any;
|
|
9
|
-
status: string;
|
|
10
|
-
} | {
|
|
11
|
-
response: any;
|
|
12
|
-
newUser: any;
|
|
13
|
-
message: any;
|
|
14
|
-
status: string;
|
|
15
|
-
}>;
|
|
16
|
-
SignUpApi: (values: SignUpInterface) => Promise<{
|
|
17
|
-
response: import("axios").AxiosResponse<any, any>;
|
|
18
|
-
newUser: {};
|
|
19
|
-
message: any;
|
|
20
|
-
status: string;
|
|
21
|
-
} | {
|
|
22
|
-
response: any;
|
|
23
|
-
newUser: any;
|
|
24
|
-
message: any;
|
|
25
|
-
status: string;
|
|
26
|
-
}>;
|
|
27
|
-
LoginRequest: (values: LoginRequestInterface) => Promise<{
|
|
28
|
-
response: import("axios").AxiosResponse<any, any>;
|
|
29
|
-
newUser: {};
|
|
30
|
-
message: any;
|
|
31
|
-
status: string;
|
|
32
|
-
} | {
|
|
33
|
-
response: any;
|
|
34
|
-
newUser: any;
|
|
35
|
-
message: any;
|
|
36
|
-
status: string;
|
|
37
|
-
}>;
|
|
38
|
-
LoginDeviceCredential: (values: LoginDeviceCredentialInterface) => Promise<{
|
|
39
|
-
response: import("axios").AxiosResponse<any, any>;
|
|
40
|
-
newUser: {};
|
|
41
|
-
message: any;
|
|
42
|
-
status: string;
|
|
43
|
-
} | {
|
|
44
|
-
response: any;
|
|
45
|
-
newUser: any;
|
|
46
|
-
message: any;
|
|
47
|
-
status: string;
|
|
48
|
-
}>;
|
|
49
|
-
SignUpWithGoogle: (values: SignUpWithGoogleInterface) => Promise<{
|
|
50
|
-
response: import("axios").AxiosResponse<any, any>;
|
|
51
|
-
newUser: {};
|
|
52
|
-
message: any;
|
|
53
|
-
status: string;
|
|
54
|
-
} | {
|
|
55
|
-
response: any;
|
|
56
|
-
newUser: any;
|
|
57
|
-
message: any;
|
|
58
|
-
status: string;
|
|
59
|
-
}>;
|
|
60
|
-
LoginWithGoogle: (values: LoginWithGoogleInterface) => Promise<{
|
|
61
|
-
response: import("axios").AxiosResponse<any, any>;
|
|
62
|
-
newUser: {};
|
|
63
|
-
message: any;
|
|
64
|
-
status: string;
|
|
65
|
-
} | {
|
|
66
|
-
response: any;
|
|
67
|
-
newUser: any;
|
|
68
|
-
message: any;
|
|
69
|
-
status: string;
|
|
70
|
-
}>;
|
|
71
|
-
};
|