@teamdigipay/dgepay-customer-transaction-package 0.0.9 → 0.0.11
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/network/APIService.d.ts +1 -0
- package/dist/network/APIService.js +18 -104
- package/package.json +1 -1
- package/src/network/APIService.ts +27 -107
|
@@ -37,6 +37,7 @@ exports.default = (apiConfig, apiPayload, onSuccess, onFailure) => __awaiter(voi
|
|
|
37
37
|
const Language = (_c = apiConfig === null || apiConfig === void 0 ? void 0 : apiConfig.token) === null || _c === void 0 ? void 0 : _c.language;
|
|
38
38
|
const requestId = (0, utils_1.getCurrentTimeStamp)();
|
|
39
39
|
const data = apiPayload.data;
|
|
40
|
+
const langugaeCode = apiConfig.languageCode;
|
|
40
41
|
let params = apiPayload.params || {};
|
|
41
42
|
let newParam = data ? data : params;
|
|
42
43
|
let newPayload = Object.assign({ company_id: companyId, request_id: requestId }, newParam);
|
|
@@ -49,7 +50,7 @@ exports.default = (apiConfig, apiPayload, onSuccess, onFailure) => __awaiter(voi
|
|
|
49
50
|
CompanyID: companyId,
|
|
50
51
|
RequestID: requestId,
|
|
51
52
|
signature: digitalSignature,
|
|
52
|
-
Language:
|
|
53
|
+
Language: langugaeCode
|
|
53
54
|
};
|
|
54
55
|
if (token) {
|
|
55
56
|
headers['Authorization'] = `Token ${token}`;
|
|
@@ -77,13 +78,6 @@ exports.default = (apiConfig, apiPayload, onSuccess, onFailure) => __awaiter(voi
|
|
|
77
78
|
switch (method) {
|
|
78
79
|
case "post":
|
|
79
80
|
request = axios_1.default.post(endPoint, data, config);
|
|
80
|
-
// if (apiConfig.endPoint == API_ENDPOINTS.AUTH_DOCKER.LOGIN_WITH_PIN) {
|
|
81
|
-
// consoleHelper("REQUEST CONFIG ==> ", config);
|
|
82
|
-
// consoleHelper("REQUEST PAYLOAD ==> ", data);
|
|
83
|
-
// request.then(data => {
|
|
84
|
-
// consoleHelper("REQUEST ==> ", data);
|
|
85
|
-
// });
|
|
86
|
-
// }
|
|
87
81
|
break;
|
|
88
82
|
case "get":
|
|
89
83
|
config = Object.assign(Object.assign({}, config), { params });
|
|
@@ -143,48 +137,12 @@ exports.default = (apiConfig, apiPayload, onSuccess, onFailure) => __awaiter(voi
|
|
|
143
137
|
errorCode: response.data.error_code,
|
|
144
138
|
success: false
|
|
145
139
|
});
|
|
146
|
-
// onFailure({
|
|
147
|
-
// errorMessage:
|
|
148
|
-
// error && typeof error === "string"
|
|
149
|
-
// ? getBackendResponseMessage(error)
|
|
150
|
-
// : "CUSTOMER_APP_SOMETHING_WENT_WRONG",
|
|
151
|
-
// errorCode: response.data.error_code || -1,
|
|
152
|
-
// });
|
|
153
140
|
}
|
|
154
141
|
break;
|
|
155
142
|
case (401 || 500 || 503 || 404 || 403 || 401):
|
|
156
|
-
react_native_1.Alert.alert("
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
// DatadogTxn.error("CUSTOMER TXN API CALL FAIL", {
|
|
160
|
-
// config: {
|
|
161
|
-
// headers: response.config.headers,
|
|
162
|
-
// baseURL: response.config.baseURL,
|
|
163
|
-
// params: response.config.params
|
|
164
|
-
// },
|
|
165
|
-
// response: response?.data
|
|
166
|
-
// });
|
|
167
|
-
// onFailure({
|
|
168
|
-
// errorMessage: "SOMETHING_WENT_WRONG",
|
|
169
|
-
// errorCode: 503,
|
|
170
|
-
// });
|
|
171
|
-
// break;
|
|
172
|
-
case (401):
|
|
173
|
-
// AlertDialog.show({
|
|
174
|
-
// title: strings.CUSTOMER_APP_SESSION,
|
|
175
|
-
// message: strings.CUSTOMER_APP_SESSION_EXPIRE_RELOGIN,
|
|
176
|
-
// positiveButton: {
|
|
177
|
-
// title: strings.Relogin,
|
|
178
|
-
// onPress: async () => {
|
|
179
|
-
// AlertDialog.hide();
|
|
180
|
-
// await setIsLoggedIn(false);
|
|
181
|
-
// store.dispatch({
|
|
182
|
-
// type: HOME_LOGOUT,
|
|
183
|
-
// });
|
|
184
|
-
// resetNavigation("splash");
|
|
185
|
-
// },
|
|
186
|
-
// },
|
|
187
|
-
// });
|
|
143
|
+
react_native_1.Alert.alert(langugaeCode && langugaeCode == "bn" ? "রক্ষণাবেক্ষণ অধীনে সিস্টেম" : "System Under Maintenance", '', [
|
|
144
|
+
{ text: langugaeCode && langugaeCode == "en" ? 'OK' : "ঠিক আছে", },
|
|
145
|
+
]);
|
|
188
146
|
break;
|
|
189
147
|
default:
|
|
190
148
|
DatadogTxn_1.default.error("CUSTOMER TXN API CALL FAIL", {
|
|
@@ -195,11 +153,9 @@ exports.default = (apiConfig, apiPayload, onSuccess, onFailure) => __awaiter(voi
|
|
|
195
153
|
},
|
|
196
154
|
response: response === null || response === void 0 ? void 0 : response.data
|
|
197
155
|
});
|
|
198
|
-
react_native_1.Alert.alert("
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
// errorCode: 0,
|
|
202
|
-
// });
|
|
156
|
+
react_native_1.Alert.alert(langugaeCode && langugaeCode == "bn" ? "রক্ষণাবেক্ষণ অধীনে সিস্টেম" : "System Under Maintenance", '', [
|
|
157
|
+
{ text: langugaeCode && langugaeCode == "en" ? 'OK' : "ঠিক আছে", },
|
|
158
|
+
]);
|
|
203
159
|
}
|
|
204
160
|
}
|
|
205
161
|
else {
|
|
@@ -211,11 +167,9 @@ exports.default = (apiConfig, apiPayload, onSuccess, onFailure) => __awaiter(voi
|
|
|
211
167
|
},
|
|
212
168
|
response: response === null || response === void 0 ? void 0 : response.data
|
|
213
169
|
});
|
|
214
|
-
react_native_1.Alert.alert("
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
// errorCode: 0,
|
|
218
|
-
// });
|
|
170
|
+
react_native_1.Alert.alert(langugaeCode && langugaeCode == "bn" ? "রক্ষণাবেক্ষণ অধীনে সিস্টেম" : "System Under Maintenance", '', [
|
|
171
|
+
{ text: langugaeCode && langugaeCode == "en" ? 'OK' : "ঠিক আছে", },
|
|
172
|
+
]);
|
|
219
173
|
}
|
|
220
174
|
}))
|
|
221
175
|
.catch((error) => {
|
|
@@ -226,59 +180,19 @@ exports.default = (apiConfig, apiPayload, onSuccess, onFailure) => __awaiter(voi
|
|
|
226
180
|
if (error === null || error === void 0 ? void 0 : error.response) {
|
|
227
181
|
(0, utils_1.consoleHelper)('\n___________error__________________', (_a = error === null || error === void 0 ? void 0 : error.response) === null || _a === void 0 ? void 0 : _a.status);
|
|
228
182
|
switch (error.response.status) {
|
|
229
|
-
case 500:
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
});
|
|
234
|
-
break;
|
|
235
|
-
case (401 || 500 || 503 || 404 || 403 || 401):
|
|
236
|
-
react_native_1.Alert.alert("PACKAGE_UNDER_MAINTENANCE");
|
|
237
|
-
break;
|
|
238
|
-
case 502:
|
|
239
|
-
onFailure({
|
|
240
|
-
errorMessage: "Something Went Wrong",
|
|
241
|
-
errorCode: 502,
|
|
242
|
-
});
|
|
243
|
-
break;
|
|
244
|
-
case (503):
|
|
245
|
-
onFailure({
|
|
246
|
-
errorMessage: "SOMETHING_WENT_WRONG",
|
|
247
|
-
errorCode: 503,
|
|
248
|
-
});
|
|
249
|
-
break;
|
|
250
|
-
case 504:
|
|
251
|
-
onFailure({
|
|
252
|
-
errorMessage: "Something Went Wrong",
|
|
253
|
-
errorCode: 504,
|
|
254
|
-
});
|
|
255
|
-
break;
|
|
256
|
-
case 401:
|
|
257
|
-
// AlertDialog.show({
|
|
258
|
-
// title: strings.CUSTOMER_APP_SESSION,
|
|
259
|
-
// message: strings.CUSTOMER_APP_SESSION_EXPIRE_RELOGIN,
|
|
260
|
-
// positiveButton: {
|
|
261
|
-
// title: strings.Relogin,
|
|
262
|
-
// onPress: async () => {
|
|
263
|
-
// AlertDialog.hide();
|
|
264
|
-
// await setIsLoggedIn(false);
|
|
265
|
-
// store.dispatch({
|
|
266
|
-
// type: HOME_LOGOUT,
|
|
267
|
-
// });
|
|
268
|
-
// resetNavigation("splash");
|
|
269
|
-
// },
|
|
270
|
-
// },
|
|
271
|
-
// });
|
|
183
|
+
case (502 || 500 || 503 || 404 || 403):
|
|
184
|
+
react_native_1.Alert.alert(langugaeCode && langugaeCode == "bn" ? "রক্ষণাবেক্ষণ অধীনে সিস্টেম" : "System Under Maintenance", '', [
|
|
185
|
+
{ text: langugaeCode && langugaeCode == "en" ? 'OK' : "ঠিক আছে", },
|
|
186
|
+
]);
|
|
272
187
|
break;
|
|
273
188
|
default:
|
|
274
189
|
DatadogTxn_1.default.error("CUSTOMER TXN API CALL FAIL(Error)", {
|
|
275
190
|
error: error,
|
|
276
191
|
config: config
|
|
277
192
|
});
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
});
|
|
193
|
+
react_native_1.Alert.alert(langugaeCode && langugaeCode == "bn" ? "রক্ষণাবেক্ষণ অধীনে সিস্টেম" : "System Under Maintenance", '', [
|
|
194
|
+
{ text: langugaeCode && langugaeCode == "en" ? 'OK' : "ঠিক আছে", },
|
|
195
|
+
]);
|
|
282
196
|
break;
|
|
283
197
|
}
|
|
284
198
|
}
|
package/package.json
CHANGED
|
@@ -18,6 +18,7 @@ export interface API_CONFIG {
|
|
|
18
18
|
forceLive?: boolean;
|
|
19
19
|
timeout?: number;
|
|
20
20
|
headersFlutterWave?: any
|
|
21
|
+
languageCode?:string
|
|
21
22
|
}
|
|
22
23
|
|
|
23
24
|
export interface TOKEN_OBJ_TYPE {
|
|
@@ -67,6 +68,7 @@ const isConnected: NetInfoState = await NetInfo.fetch()
|
|
|
67
68
|
const Language = apiConfig?.token?.language;
|
|
68
69
|
const requestId = getCurrentTimeStamp();
|
|
69
70
|
const data: any = apiPayload.data;
|
|
71
|
+
const langugaeCode = apiConfig.languageCode
|
|
70
72
|
|
|
71
73
|
let params: any = apiPayload.params || {};
|
|
72
74
|
let newParam:any =data? data:params;
|
|
@@ -87,7 +89,7 @@ const isConnected: NetInfoState = await NetInfo.fetch()
|
|
|
87
89
|
CompanyID: companyId,
|
|
88
90
|
RequestID: requestId,
|
|
89
91
|
signature:digitalSignature,
|
|
90
|
-
Language:
|
|
92
|
+
Language:langugaeCode
|
|
91
93
|
};
|
|
92
94
|
|
|
93
95
|
if (token) {
|
|
@@ -129,13 +131,7 @@ const isConnected: NetInfoState = await NetInfo.fetch()
|
|
|
129
131
|
switch (method) {
|
|
130
132
|
case "post":
|
|
131
133
|
request = axios.post(endPoint, data, config);
|
|
132
|
-
|
|
133
|
-
// consoleHelper("REQUEST CONFIG ==> ", config);
|
|
134
|
-
// consoleHelper("REQUEST PAYLOAD ==> ", data);
|
|
135
|
-
// request.then(data => {
|
|
136
|
-
// consoleHelper("REQUEST ==> ", data);
|
|
137
|
-
// });
|
|
138
|
-
// }
|
|
134
|
+
|
|
139
135
|
break;
|
|
140
136
|
case "get":
|
|
141
137
|
config = { ...config, params };
|
|
@@ -205,51 +201,19 @@ const isConnected: NetInfoState = await NetInfo.fetch()
|
|
|
205
201
|
errorCode: response.data.error_code,
|
|
206
202
|
success: false
|
|
207
203
|
});
|
|
208
|
-
|
|
209
|
-
// errorMessage:
|
|
210
|
-
// error && typeof error === "string"
|
|
211
|
-
// ? getBackendResponseMessage(error)
|
|
212
|
-
// : "CUSTOMER_APP_SOMETHING_WENT_WRONG",
|
|
213
|
-
// errorCode: response.data.error_code || -1,
|
|
214
|
-
// });
|
|
204
|
+
|
|
215
205
|
}
|
|
216
206
|
break;
|
|
217
207
|
case (401 || 500 || 503 || 404 || 403 || 401):
|
|
218
|
-
Alert.alert("
|
|
208
|
+
Alert.alert(langugaeCode && langugaeCode == "bn" ? "রক্ষণাবেক্ষণ অধীনে সিস্টেম": "System Under Maintenance" , '', [
|
|
209
|
+
{text: langugaeCode && langugaeCode == "en" ? 'OK' : "ঠিক আছে", },
|
|
210
|
+
]);
|
|
219
211
|
break;
|
|
220
212
|
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
// baseURL: response.config.baseURL,
|
|
226
|
-
// params: response.config.params
|
|
227
|
-
// },
|
|
228
|
-
// response: response?.data
|
|
229
|
-
// });
|
|
230
|
-
// onFailure({
|
|
231
|
-
// errorMessage: "SOMETHING_WENT_WRONG",
|
|
232
|
-
// errorCode: 503,
|
|
233
|
-
// });
|
|
234
|
-
// break;
|
|
235
|
-
|
|
236
|
-
case (401):
|
|
237
|
-
// AlertDialog.show({
|
|
238
|
-
// title: strings.CUSTOMER_APP_SESSION,
|
|
239
|
-
// message: strings.CUSTOMER_APP_SESSION_EXPIRE_RELOGIN,
|
|
240
|
-
// positiveButton: {
|
|
241
|
-
// title: strings.Relogin,
|
|
242
|
-
// onPress: async () => {
|
|
243
|
-
// AlertDialog.hide();
|
|
244
|
-
// await setIsLoggedIn(false);
|
|
245
|
-
// store.dispatch({
|
|
246
|
-
// type: HOME_LOGOUT,
|
|
247
|
-
// });
|
|
248
|
-
// resetNavigation("splash");
|
|
249
|
-
// },
|
|
250
|
-
// },
|
|
251
|
-
// });
|
|
252
|
-
break;
|
|
213
|
+
|
|
214
|
+
|
|
215
|
+
|
|
216
|
+
|
|
253
217
|
|
|
254
218
|
default:
|
|
255
219
|
|
|
@@ -261,12 +225,11 @@ const isConnected: NetInfoState = await NetInfo.fetch()
|
|
|
261
225
|
},
|
|
262
226
|
response: response?.data
|
|
263
227
|
});
|
|
264
|
-
Alert.alert("
|
|
228
|
+
Alert.alert(langugaeCode && langugaeCode == "bn" ? "রক্ষণাবেক্ষণ অধীনে সিস্টেম": "System Under Maintenance" , '', [
|
|
229
|
+
{text: langugaeCode && langugaeCode == "en" ? 'OK' : "ঠিক আছে", },
|
|
230
|
+
]);
|
|
231
|
+
|
|
265
232
|
|
|
266
|
-
// onFailure({
|
|
267
|
-
// errorMessage: "CUSTOMER_APP_SOMETHING_WENT_WRONG",
|
|
268
|
-
// errorCode: 0,
|
|
269
|
-
// });
|
|
270
233
|
}
|
|
271
234
|
} else {
|
|
272
235
|
|
|
@@ -278,11 +241,10 @@ const isConnected: NetInfoState = await NetInfo.fetch()
|
|
|
278
241
|
},
|
|
279
242
|
response: response?.data
|
|
280
243
|
});
|
|
281
|
-
Alert.alert("
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
// });
|
|
244
|
+
Alert.alert(langugaeCode && langugaeCode == "bn" ? "রক্ষণাবেক্ষণ অধীনে সিস্টেম": "System Under Maintenance" , '', [
|
|
245
|
+
{text: langugaeCode && langugaeCode == "en" ? 'OK' : "ঠিক আছে", },
|
|
246
|
+
]);
|
|
247
|
+
|
|
286
248
|
}
|
|
287
249
|
})
|
|
288
250
|
.catch((error) => {
|
|
@@ -292,67 +254,25 @@ const isConnected: NetInfoState = await NetInfo.fetch()
|
|
|
292
254
|
if (error?.response) {
|
|
293
255
|
consoleHelper('\n___________error__________________', error?.response?.status)
|
|
294
256
|
switch (error.response.status) {
|
|
295
|
-
case 500:
|
|
296
|
-
onFailure({
|
|
297
|
-
errorMessage: "Something Went Wrong",
|
|
298
|
-
errorCode: 500,
|
|
299
|
-
});
|
|
300
|
-
break;
|
|
301
|
-
|
|
302
|
-
case (401 || 500 || 503 || 404 || 403 || 401):
|
|
303
|
-
Alert.alert("PACKAGE_UNDER_MAINTENANCE")
|
|
304
|
-
break;
|
|
305
257
|
|
|
306
|
-
case 502:
|
|
307
|
-
onFailure({
|
|
308
|
-
errorMessage: "Something Went Wrong",
|
|
309
|
-
errorCode: 502,
|
|
310
|
-
});
|
|
311
|
-
break;
|
|
312
258
|
|
|
313
|
-
case (503):
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
});
|
|
259
|
+
case (502 || 500 || 503 || 404 || 403):
|
|
260
|
+
Alert.alert(langugaeCode && langugaeCode == "bn" ? "রক্ষণাবেক্ষণ অধীনে সিস্টেম": "System Under Maintenance" , '', [
|
|
261
|
+
{text: langugaeCode && langugaeCode == "en" ? 'OK' : "ঠিক আছে", },
|
|
262
|
+
]);
|
|
318
263
|
break;
|
|
319
264
|
|
|
320
|
-
case 504:
|
|
321
|
-
onFailure({
|
|
322
|
-
errorMessage: "Something Went Wrong",
|
|
323
|
-
errorCode: 504,
|
|
324
|
-
});
|
|
325
|
-
break;
|
|
326
|
-
|
|
327
|
-
case 401:
|
|
328
|
-
// AlertDialog.show({
|
|
329
|
-
// title: strings.CUSTOMER_APP_SESSION,
|
|
330
|
-
// message: strings.CUSTOMER_APP_SESSION_EXPIRE_RELOGIN,
|
|
331
|
-
// positiveButton: {
|
|
332
|
-
// title: strings.Relogin,
|
|
333
|
-
// onPress: async () => {
|
|
334
|
-
// AlertDialog.hide();
|
|
335
|
-
// await setIsLoggedIn(false);
|
|
336
|
-
// store.dispatch({
|
|
337
|
-
// type: HOME_LOGOUT,
|
|
338
|
-
// });
|
|
339
|
-
// resetNavigation("splash");
|
|
340
|
-
// },
|
|
341
|
-
// },
|
|
342
|
-
// });
|
|
343
265
|
|
|
344
|
-
break;
|
|
345
266
|
default:
|
|
346
267
|
|
|
347
268
|
DatadogTxn.error("CUSTOMER TXN API CALL FAIL(Error)", {
|
|
348
269
|
error: error,
|
|
349
270
|
config: config
|
|
350
271
|
});
|
|
272
|
+
Alert.alert(langugaeCode && langugaeCode == "bn" ? "রক্ষণাবেক্ষণ অধীনে সিস্টেম": "System Under Maintenance" , '', [
|
|
273
|
+
{text: langugaeCode && langugaeCode == "en" ? 'OK' : "ঠিক আছে", },
|
|
274
|
+
]);
|
|
351
275
|
|
|
352
|
-
onFailure({
|
|
353
|
-
errorMessage: "CUSTOMER_APP_SOMETHING_WENT_WRONG",
|
|
354
|
-
errorCode: 0,
|
|
355
|
-
});
|
|
356
276
|
break;
|
|
357
277
|
}
|
|
358
278
|
} else if (error.message) {
|