@teamdigipay/dgepay-customer-transaction-package 0.0.16 → 0.0.18
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.js +108 -45
- package/package.json +1 -1
- package/src/network/APIService.ts +108 -52
|
@@ -106,6 +106,7 @@ exports.default = (apiConfig, apiPayload, onSuccess, onFailure) => __awaiter(voi
|
|
|
106
106
|
switch (status) {
|
|
107
107
|
case (200):
|
|
108
108
|
const responseData = response.data;
|
|
109
|
+
// setItem(SESSION_EXPIRE_VALUE,JSON.stringify(false))
|
|
109
110
|
if (response.data.success) {
|
|
110
111
|
let successMessage = undefined;
|
|
111
112
|
if (response && responseData.data.message) {
|
|
@@ -117,7 +118,14 @@ exports.default = (apiConfig, apiPayload, onSuccess, onFailure) => __awaiter(voi
|
|
|
117
118
|
baseURL: response.config.baseURL,
|
|
118
119
|
params: response.config.params
|
|
119
120
|
},
|
|
120
|
-
response: response === null || response === void 0 ? void 0 : response.data
|
|
121
|
+
response: response === null || response === void 0 ? void 0 : response.data,
|
|
122
|
+
// user_id:getItem(USER_ID),
|
|
123
|
+
apiEndPoint: apiConfig.endPoint,
|
|
124
|
+
method: method,
|
|
125
|
+
RequestID: requestId,
|
|
126
|
+
status: status,
|
|
127
|
+
params: params,
|
|
128
|
+
api_status: status
|
|
121
129
|
});
|
|
122
130
|
onSuccess({ data: responseData.data, message: successMessage, success: true });
|
|
123
131
|
}
|
|
@@ -137,6 +145,7 @@ exports.default = (apiConfig, apiPayload, onSuccess, onFailure) => __awaiter(voi
|
|
|
137
145
|
RequestID: requestId,
|
|
138
146
|
status: status,
|
|
139
147
|
params: params,
|
|
148
|
+
api_status: status
|
|
140
149
|
});
|
|
141
150
|
onFailure({
|
|
142
151
|
errorMessage: (0, APIResponses_1.getBackendResponseMessage)(error),
|
|
@@ -181,6 +190,7 @@ exports.default = (apiConfig, apiPayload, onSuccess, onFailure) => __awaiter(voi
|
|
|
181
190
|
RequestID: requestId,
|
|
182
191
|
status: status,
|
|
183
192
|
params: params,
|
|
193
|
+
api_status: status
|
|
184
194
|
});
|
|
185
195
|
onFailure({
|
|
186
196
|
errorMessage: "",
|
|
@@ -206,6 +216,7 @@ exports.default = (apiConfig, apiPayload, onSuccess, onFailure) => __awaiter(voi
|
|
|
206
216
|
RequestID: requestId,
|
|
207
217
|
status: status,
|
|
208
218
|
params: params,
|
|
219
|
+
api_status: response === null || response === void 0 ? void 0 : response.status
|
|
209
220
|
});
|
|
210
221
|
onFailure({
|
|
211
222
|
errorMessage: "",
|
|
@@ -219,55 +230,107 @@ exports.default = (apiConfig, apiPayload, onSuccess, onFailure) => __awaiter(voi
|
|
|
219
230
|
}))
|
|
220
231
|
.catch((error) => __awaiter(void 0, void 0, void 0, function* () {
|
|
221
232
|
var _e;
|
|
233
|
+
DatadogTxn_1.default.error(`${error}`, {
|
|
234
|
+
// user_id:getItem(USER_ID),
|
|
235
|
+
apiEndPoint: apiConfig.endPoint,
|
|
236
|
+
method: method,
|
|
237
|
+
config: { config },
|
|
238
|
+
params: params,
|
|
239
|
+
RequestID: requestId,
|
|
240
|
+
api_status: `${error}`
|
|
241
|
+
});
|
|
222
242
|
(0, utils_1.consoleHelper)('\n___________error__________________', error);
|
|
223
243
|
if (error) {
|
|
224
244
|
(0, utils_1.consoleHelper)('\n___________error__________________', error === null || error === void 0 ? void 0 : error.response);
|
|
225
245
|
if (error === null || error === void 0 ? void 0 : error.response) {
|
|
226
246
|
(0, utils_1.consoleHelper)('\n___________error__________________', (_e = error === null || error === void 0 ? void 0 : error.response) === null || _e === void 0 ? void 0 : _e.status);
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
247
|
+
// if(getItem(SESSION_EXPIRE_VALUE) === JSON.stringify(false)) {
|
|
248
|
+
// switch (error.response.status) {
|
|
249
|
+
// case 401 :
|
|
250
|
+
// onFailure({
|
|
251
|
+
// errorMessage: "",
|
|
252
|
+
// errorCode: 401,
|
|
253
|
+
// success: false
|
|
254
|
+
// });
|
|
255
|
+
// await cleanSession();
|
|
256
|
+
// resetNavigation(navigationConstants.LOGIN);
|
|
257
|
+
// showDangerToast(strings.MERCHANT_APP_SESSION_EXPIRE_RELOGIN)
|
|
258
|
+
// break;
|
|
259
|
+
//
|
|
260
|
+
// case (502 || 500 || 503 || 404 || 403 || 504):
|
|
261
|
+
// onFailure({
|
|
262
|
+
// errorMessage: "",
|
|
263
|
+
// errorCode: "",
|
|
264
|
+
// success: false
|
|
265
|
+
// });
|
|
266
|
+
// Alert.alert(langugaeCode && langugaeCode == "bn" ? "রক্ষণাবেক্ষণ অধীনে সিস্টেম": "System Under Maintenance" , '', [
|
|
267
|
+
// {text: langugaeCode && langugaeCode == "bn" ? "ঠিক আছে" :'OK', },
|
|
268
|
+
// ]);
|
|
269
|
+
// break;
|
|
270
|
+
//
|
|
271
|
+
// default:
|
|
272
|
+
//
|
|
273
|
+
// DatadogTxn.error("MERCHANT TXN API CALL FAIL(Error)", {
|
|
274
|
+
// error: error,
|
|
275
|
+
// config: {config},
|
|
276
|
+
// user_id:getItem(USER_ID),
|
|
277
|
+
// apiEndPoint:apiConfig.endPoint,
|
|
278
|
+
// method:method,
|
|
279
|
+
// RequestID:requestId,
|
|
280
|
+
// status:status,
|
|
281
|
+
// params: params,
|
|
282
|
+
// });
|
|
283
|
+
// onFailure({
|
|
284
|
+
// errorMessage: "",
|
|
285
|
+
// errorCode: "",
|
|
286
|
+
// success: false
|
|
287
|
+
// });
|
|
288
|
+
// Alert.alert(langugaeCode && langugaeCode == "bn" ? "রক্ষণাবেক্ষণ অধীনে সিস্টেম": "System Under Maintenance" , '', [
|
|
289
|
+
// {text: langugaeCode && langugaeCode == "bn" ? "ঠিক আছে" :'OK', },
|
|
290
|
+
// ]);
|
|
291
|
+
//
|
|
292
|
+
//
|
|
293
|
+
// break;
|
|
294
|
+
// }
|
|
295
|
+
// }else {
|
|
296
|
+
// switch (error.response.status) {
|
|
297
|
+
//
|
|
298
|
+
// case (502 || 500 || 503 || 404 || 403 || 504):
|
|
299
|
+
// onFailure({
|
|
300
|
+
// errorMessage: "",
|
|
301
|
+
// errorCode: "",
|
|
302
|
+
// success: false
|
|
303
|
+
// });
|
|
304
|
+
// Alert.alert(langugaeCode && langugaeCode == "bn" ? "রক্ষণাবেক্ষণ অধীনে সিস্টেম": "System Under Maintenance" , '', [
|
|
305
|
+
// {text: langugaeCode && langugaeCode == "bn" ? "ঠিক আছে" :'OK', },
|
|
306
|
+
// ]);
|
|
307
|
+
// break;
|
|
308
|
+
//
|
|
309
|
+
// default:
|
|
310
|
+
//
|
|
311
|
+
// DatadogTxn.error("MERCHANT TXN API CALL FAIL(Error)", {
|
|
312
|
+
// error: error,
|
|
313
|
+
// config: {config},
|
|
314
|
+
// user_id:getItem(USER_ID),
|
|
315
|
+
// apiEndPoint:apiConfig.endPoint,
|
|
316
|
+
// method:method,
|
|
317
|
+
// RequestID:requestId,
|
|
318
|
+
// status:status,
|
|
319
|
+
// params: params,
|
|
320
|
+
// });
|
|
321
|
+
// onFailure({
|
|
322
|
+
// errorMessage: "",
|
|
323
|
+
// errorCode: "",
|
|
324
|
+
// success: false
|
|
325
|
+
// });
|
|
326
|
+
// Alert.alert(langugaeCode && langugaeCode == "bn" ? "রক্ষণাবেক্ষণ অধীনে সিস্টেম": "System Under Maintenance" , '', [
|
|
327
|
+
// {text: langugaeCode && langugaeCode == "bn" ? "ঠিক আছে" :'OK', },
|
|
328
|
+
// ]);
|
|
329
|
+
//
|
|
330
|
+
//
|
|
331
|
+
// break;
|
|
332
|
+
// }
|
|
333
|
+
// }
|
|
271
334
|
}
|
|
272
335
|
else if (error.message) {
|
|
273
336
|
if ((error === null || error === void 0 ? void 0 : error.message) === "Network Error") {
|
package/package.json
CHANGED
|
@@ -168,6 +168,7 @@ const isConnected: NetInfoState = await NetInfo.fetch()
|
|
|
168
168
|
switch (status) {
|
|
169
169
|
case (200):
|
|
170
170
|
const responseData: BasicResponseModel = response.data;
|
|
171
|
+
// setItem(SESSION_EXPIRE_VALUE,JSON.stringify(false))
|
|
171
172
|
|
|
172
173
|
if (response.data.success) {
|
|
173
174
|
let successMessage: string | undefined = undefined;
|
|
@@ -184,7 +185,14 @@ const isConnected: NetInfoState = await NetInfo.fetch()
|
|
|
184
185
|
baseURL: response.config.baseURL,
|
|
185
186
|
params: response.config.params
|
|
186
187
|
},
|
|
187
|
-
response: response?.data
|
|
188
|
+
response: response?.data,
|
|
189
|
+
// user_id:getItem(USER_ID),
|
|
190
|
+
apiEndPoint:apiConfig.endPoint,
|
|
191
|
+
method:method,
|
|
192
|
+
RequestID:requestId,
|
|
193
|
+
status:status,
|
|
194
|
+
params: params,
|
|
195
|
+
api_status:status
|
|
188
196
|
});
|
|
189
197
|
|
|
190
198
|
onSuccess({ data: responseData.data, message: successMessage, success: true });
|
|
@@ -206,6 +214,7 @@ const isConnected: NetInfoState = await NetInfo.fetch()
|
|
|
206
214
|
RequestID:requestId,
|
|
207
215
|
status:status,
|
|
208
216
|
params: params,
|
|
217
|
+
api_status:status
|
|
209
218
|
});
|
|
210
219
|
|
|
211
220
|
onFailure({
|
|
@@ -254,6 +263,7 @@ const isConnected: NetInfoState = await NetInfo.fetch()
|
|
|
254
263
|
RequestID:requestId,
|
|
255
264
|
status:status,
|
|
256
265
|
params: params,
|
|
266
|
+
api_status:status
|
|
257
267
|
});
|
|
258
268
|
onFailure({
|
|
259
269
|
errorMessage: "",
|
|
@@ -281,6 +291,7 @@ const isConnected: NetInfoState = await NetInfo.fetch()
|
|
|
281
291
|
RequestID:requestId,
|
|
282
292
|
status:status,
|
|
283
293
|
params: params,
|
|
294
|
+
api_status:response?.status
|
|
284
295
|
});
|
|
285
296
|
onFailure({
|
|
286
297
|
errorMessage: "",
|
|
@@ -294,62 +305,107 @@ const isConnected: NetInfoState = await NetInfo.fetch()
|
|
|
294
305
|
}
|
|
295
306
|
})
|
|
296
307
|
.catch(async (error) => {
|
|
308
|
+
DatadogTxn.error(`${error}`, {
|
|
309
|
+
// user_id:getItem(USER_ID),
|
|
310
|
+
apiEndPoint:apiConfig.endPoint,
|
|
311
|
+
method:method,
|
|
312
|
+
config: {config},
|
|
313
|
+
params: params,
|
|
314
|
+
RequestID:requestId,
|
|
315
|
+
api_status:`${error}`
|
|
316
|
+
})
|
|
297
317
|
consoleHelper('\n___________error__________________', error)
|
|
298
318
|
if (error) {
|
|
299
319
|
consoleHelper('\n___________error__________________', error?.response)
|
|
300
320
|
if (error?.response) {
|
|
301
321
|
consoleHelper('\n___________error__________________', error?.response?.status)
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
322
|
+
// if(getItem(SESSION_EXPIRE_VALUE) === JSON.stringify(false)) {
|
|
323
|
+
// switch (error.response.status) {
|
|
324
|
+
// case 401 :
|
|
325
|
+
// onFailure({
|
|
326
|
+
// errorMessage: "",
|
|
327
|
+
// errorCode: 401,
|
|
328
|
+
// success: false
|
|
329
|
+
// });
|
|
330
|
+
// await cleanSession();
|
|
331
|
+
// resetNavigation(navigationConstants.LOGIN);
|
|
332
|
+
// showDangerToast(strings.MERCHANT_APP_SESSION_EXPIRE_RELOGIN)
|
|
333
|
+
// break;
|
|
334
|
+
//
|
|
335
|
+
// case (502 || 500 || 503 || 404 || 403 || 504):
|
|
336
|
+
// onFailure({
|
|
337
|
+
// errorMessage: "",
|
|
338
|
+
// errorCode: "",
|
|
339
|
+
// success: false
|
|
340
|
+
// });
|
|
341
|
+
// Alert.alert(langugaeCode && langugaeCode == "bn" ? "রক্ষণাবেক্ষণ অধীনে সিস্টেম": "System Under Maintenance" , '', [
|
|
342
|
+
// {text: langugaeCode && langugaeCode == "bn" ? "ঠিক আছে" :'OK', },
|
|
343
|
+
// ]);
|
|
344
|
+
// break;
|
|
345
|
+
//
|
|
346
|
+
// default:
|
|
347
|
+
//
|
|
348
|
+
// DatadogTxn.error("MERCHANT TXN API CALL FAIL(Error)", {
|
|
349
|
+
// error: error,
|
|
350
|
+
// config: {config},
|
|
351
|
+
// user_id:getItem(USER_ID),
|
|
352
|
+
// apiEndPoint:apiConfig.endPoint,
|
|
353
|
+
// method:method,
|
|
354
|
+
// RequestID:requestId,
|
|
355
|
+
// status:status,
|
|
356
|
+
// params: params,
|
|
357
|
+
// });
|
|
358
|
+
// onFailure({
|
|
359
|
+
// errorMessage: "",
|
|
360
|
+
// errorCode: "",
|
|
361
|
+
// success: false
|
|
362
|
+
// });
|
|
363
|
+
// Alert.alert(langugaeCode && langugaeCode == "bn" ? "রক্ষণাবেক্ষণ অধীনে সিস্টেম": "System Under Maintenance" , '', [
|
|
364
|
+
// {text: langugaeCode && langugaeCode == "bn" ? "ঠিক আছে" :'OK', },
|
|
365
|
+
// ]);
|
|
366
|
+
//
|
|
367
|
+
//
|
|
368
|
+
// break;
|
|
369
|
+
// }
|
|
370
|
+
// }else {
|
|
371
|
+
// switch (error.response.status) {
|
|
372
|
+
//
|
|
373
|
+
// case (502 || 500 || 503 || 404 || 403 || 504):
|
|
374
|
+
// onFailure({
|
|
375
|
+
// errorMessage: "",
|
|
376
|
+
// errorCode: "",
|
|
377
|
+
// success: false
|
|
378
|
+
// });
|
|
379
|
+
// Alert.alert(langugaeCode && langugaeCode == "bn" ? "রক্ষণাবেক্ষণ অধীনে সিস্টেম": "System Under Maintenance" , '', [
|
|
380
|
+
// {text: langugaeCode && langugaeCode == "bn" ? "ঠিক আছে" :'OK', },
|
|
381
|
+
// ]);
|
|
382
|
+
// break;
|
|
383
|
+
//
|
|
384
|
+
// default:
|
|
385
|
+
//
|
|
386
|
+
// DatadogTxn.error("MERCHANT TXN API CALL FAIL(Error)", {
|
|
387
|
+
// error: error,
|
|
388
|
+
// config: {config},
|
|
389
|
+
// user_id:getItem(USER_ID),
|
|
390
|
+
// apiEndPoint:apiConfig.endPoint,
|
|
391
|
+
// method:method,
|
|
392
|
+
// RequestID:requestId,
|
|
393
|
+
// status:status,
|
|
394
|
+
// params: params,
|
|
395
|
+
// });
|
|
396
|
+
// onFailure({
|
|
397
|
+
// errorMessage: "",
|
|
398
|
+
// errorCode: "",
|
|
399
|
+
// success: false
|
|
400
|
+
// });
|
|
401
|
+
// Alert.alert(langugaeCode && langugaeCode == "bn" ? "রক্ষণাবেক্ষণ অধীনে সিস্টেম": "System Under Maintenance" , '', [
|
|
402
|
+
// {text: langugaeCode && langugaeCode == "bn" ? "ঠিক আছে" :'OK', },
|
|
403
|
+
// ]);
|
|
404
|
+
//
|
|
405
|
+
//
|
|
406
|
+
// break;
|
|
407
|
+
// }
|
|
408
|
+
// }
|
|
353
409
|
} else if (error.message) {
|
|
354
410
|
|
|
355
411
|
if (error?.message === "Network Error") {
|