@teamdigipay/dgepay-customer-transaction-package 0.0.7 → 0.0.9
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 +30 -21
- package/dist/utils/Strings.d.ts +1 -0
- package/dist/utils/Strings.js +2 -1
- package/package.json +2 -1
- package/src/network/APIService.ts +32 -23
- package/src/utils/Strings.ts +2 -1
|
@@ -16,6 +16,7 @@ const APIResponses_1 = require("./APIResponses");
|
|
|
16
16
|
const DatadogTxn_1 = require("../utils/DatadogTxn");
|
|
17
17
|
const netinfo_1 = require("@react-native-community/netinfo");
|
|
18
18
|
const Strings_1 = require("../utils/Strings");
|
|
19
|
+
const react_native_1 = require("react-native");
|
|
19
20
|
exports.default = (apiConfig, apiPayload, onSuccess, onFailure) => __awaiter(void 0, void 0, void 0, function* () {
|
|
20
21
|
var _a, _b, _c, _d;
|
|
21
22
|
const isConnected = yield netinfo_1.default.fetch();
|
|
@@ -151,20 +152,23 @@ exports.default = (apiConfig, apiPayload, onSuccess, onFailure) => __awaiter(voi
|
|
|
151
152
|
// });
|
|
152
153
|
}
|
|
153
154
|
break;
|
|
154
|
-
case (503):
|
|
155
|
-
|
|
156
|
-
config: {
|
|
157
|
-
headers: response.config.headers,
|
|
158
|
-
baseURL: response.config.baseURL,
|
|
159
|
-
params: response.config.params
|
|
160
|
-
},
|
|
161
|
-
response: response === null || response === void 0 ? void 0 : response.data
|
|
162
|
-
});
|
|
163
|
-
onFailure({
|
|
164
|
-
errorMessage: "SOMETHING_WENT_WRONG",
|
|
165
|
-
errorCode: 503,
|
|
166
|
-
});
|
|
155
|
+
case (401 || 500 || 503 || 404 || 403 || 401):
|
|
156
|
+
react_native_1.Alert.alert("PACKAGE_UNDER_MAINTENANCE");
|
|
167
157
|
break;
|
|
158
|
+
// case (503):
|
|
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;
|
|
168
172
|
case (401):
|
|
169
173
|
// AlertDialog.show({
|
|
170
174
|
// title: strings.CUSTOMER_APP_SESSION,
|
|
@@ -191,10 +195,11 @@ exports.default = (apiConfig, apiPayload, onSuccess, onFailure) => __awaiter(voi
|
|
|
191
195
|
},
|
|
192
196
|
response: response === null || response === void 0 ? void 0 : response.data
|
|
193
197
|
});
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
+
react_native_1.Alert.alert("PACKAGE_UNDER_MAINTENANCE");
|
|
199
|
+
// onFailure({
|
|
200
|
+
// errorMessage: "CUSTOMER_APP_SOMETHING_WENT_WRONG",
|
|
201
|
+
// errorCode: 0,
|
|
202
|
+
// });
|
|
198
203
|
}
|
|
199
204
|
}
|
|
200
205
|
else {
|
|
@@ -206,10 +211,11 @@ exports.default = (apiConfig, apiPayload, onSuccess, onFailure) => __awaiter(voi
|
|
|
206
211
|
},
|
|
207
212
|
response: response === null || response === void 0 ? void 0 : response.data
|
|
208
213
|
});
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
214
|
+
react_native_1.Alert.alert("PACKAGE_UNDER_MAINTENANCE");
|
|
215
|
+
// onFailure({
|
|
216
|
+
// errorMessage: "CUSTOMER_APP_SOMETHING_WENT_WRONG",
|
|
217
|
+
// errorCode: 0,
|
|
218
|
+
// });
|
|
213
219
|
}
|
|
214
220
|
}))
|
|
215
221
|
.catch((error) => {
|
|
@@ -226,6 +232,9 @@ exports.default = (apiConfig, apiPayload, onSuccess, onFailure) => __awaiter(voi
|
|
|
226
232
|
errorCode: 500,
|
|
227
233
|
});
|
|
228
234
|
break;
|
|
235
|
+
case (401 || 500 || 503 || 404 || 403 || 401):
|
|
236
|
+
react_native_1.Alert.alert("PACKAGE_UNDER_MAINTENANCE");
|
|
237
|
+
break;
|
|
229
238
|
case 502:
|
|
230
239
|
onFailure({
|
|
231
240
|
errorMessage: "Something Went Wrong",
|
package/dist/utils/Strings.d.ts
CHANGED
package/dist/utils/Strings.js
CHANGED
|
@@ -28,5 +28,6 @@ exports.default = {
|
|
|
28
28
|
PACKAGE_CANT_TRANSFER_TO_AGENT: "PACKAGE_CANT_TRANSFER_TO_AGENT",
|
|
29
29
|
PACKAGE_NO_USER: "PACKAGE_NO_USER",
|
|
30
30
|
PACKAGE_CANT_REQUEST_TO_AGENT: "PACKAGE_CANT_REQUEST_TO_AGENT",
|
|
31
|
-
PACKAGE_CANT_REQUEST_MONEY_MERCHANT_AGENT: "PACKAGE_CANT_REQUEST_MONEY_MERCHANT_AGENT"
|
|
31
|
+
PACKAGE_CANT_REQUEST_MONEY_MERCHANT_AGENT: "PACKAGE_CANT_REQUEST_MONEY_MERCHANT_AGENT",
|
|
32
|
+
PACKAGE_UNDER_MAINTENANCE: 'PACKAGE_UNDER_MAINTENANCE',
|
|
32
33
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@teamdigipay/dgepay-customer-transaction-package",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.9",
|
|
4
4
|
"author": "RM (peerbits)",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "src/index.ts",
|
|
@@ -18,6 +18,7 @@
|
|
|
18
18
|
"axios": "^1.2.1",
|
|
19
19
|
"crypto-js": "^4.1.1",
|
|
20
20
|
"lodash": "^4.17.21",
|
|
21
|
+
"react-native": "^0.73.4",
|
|
21
22
|
"typescript": "^4.9.4"
|
|
22
23
|
},
|
|
23
24
|
"description": "> This package contains all the necessary Transaction controllers, helpers and constants for DGePay Customer Application.",
|
|
@@ -5,6 +5,7 @@ import { getBackendResponseMessage } from "./APIResponses";
|
|
|
5
5
|
import DatadogTxn from "../utils/DatadogTxn";
|
|
6
6
|
import NetInfo, { NetInfoState } from "@react-native-community/netinfo";
|
|
7
7
|
import Strings from "../utils/Strings";
|
|
8
|
+
import {Alert} from "react-native";
|
|
8
9
|
|
|
9
10
|
export interface API_CONFIG {
|
|
10
11
|
baseURL?: string;
|
|
@@ -213,22 +214,25 @@ const isConnected: NetInfoState = await NetInfo.fetch()
|
|
|
213
214
|
// });
|
|
214
215
|
}
|
|
215
216
|
break;
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
DatadogTxn.error("CUSTOMER TXN API CALL FAIL", {
|
|
219
|
-
config: {
|
|
220
|
-
headers: response.config.headers,
|
|
221
|
-
baseURL: response.config.baseURL,
|
|
222
|
-
params: response.config.params
|
|
223
|
-
},
|
|
224
|
-
response: response?.data
|
|
225
|
-
});
|
|
226
|
-
onFailure({
|
|
227
|
-
errorMessage: "SOMETHING_WENT_WRONG",
|
|
228
|
-
errorCode: 503,
|
|
229
|
-
});
|
|
217
|
+
case (401 || 500 || 503 || 404 || 403 || 401):
|
|
218
|
+
Alert.alert("PACKAGE_UNDER_MAINTENANCE")
|
|
230
219
|
break;
|
|
231
220
|
|
|
221
|
+
// case (503):
|
|
222
|
+
// DatadogTxn.error("CUSTOMER TXN API CALL FAIL", {
|
|
223
|
+
// config: {
|
|
224
|
+
// headers: response.config.headers,
|
|
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
|
+
|
|
232
236
|
case (401):
|
|
233
237
|
// AlertDialog.show({
|
|
234
238
|
// title: strings.CUSTOMER_APP_SESSION,
|
|
@@ -257,11 +261,12 @@ const isConnected: NetInfoState = await NetInfo.fetch()
|
|
|
257
261
|
},
|
|
258
262
|
response: response?.data
|
|
259
263
|
});
|
|
264
|
+
Alert.alert("PACKAGE_UNDER_MAINTENANCE")
|
|
260
265
|
|
|
261
|
-
onFailure({
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
});
|
|
266
|
+
// onFailure({
|
|
267
|
+
// errorMessage: "CUSTOMER_APP_SOMETHING_WENT_WRONG",
|
|
268
|
+
// errorCode: 0,
|
|
269
|
+
// });
|
|
265
270
|
}
|
|
266
271
|
} else {
|
|
267
272
|
|
|
@@ -273,11 +278,11 @@ const isConnected: NetInfoState = await NetInfo.fetch()
|
|
|
273
278
|
},
|
|
274
279
|
response: response?.data
|
|
275
280
|
});
|
|
276
|
-
|
|
277
|
-
onFailure({
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
});
|
|
281
|
+
Alert.alert("PACKAGE_UNDER_MAINTENANCE")
|
|
282
|
+
// onFailure({
|
|
283
|
+
// errorMessage: "CUSTOMER_APP_SOMETHING_WENT_WRONG",
|
|
284
|
+
// errorCode: 0,
|
|
285
|
+
// });
|
|
281
286
|
}
|
|
282
287
|
})
|
|
283
288
|
.catch((error) => {
|
|
@@ -294,6 +299,10 @@ const isConnected: NetInfoState = await NetInfo.fetch()
|
|
|
294
299
|
});
|
|
295
300
|
break;
|
|
296
301
|
|
|
302
|
+
case (401 || 500 || 503 || 404 || 403 || 401):
|
|
303
|
+
Alert.alert("PACKAGE_UNDER_MAINTENANCE")
|
|
304
|
+
break;
|
|
305
|
+
|
|
297
306
|
case 502:
|
|
298
307
|
onFailure({
|
|
299
308
|
errorMessage: "Something Went Wrong",
|
package/src/utils/Strings.ts
CHANGED
|
@@ -28,6 +28,7 @@ export default {
|
|
|
28
28
|
PACKAGE_NO_USER: "PACKAGE_NO_USER",
|
|
29
29
|
|
|
30
30
|
PACKAGE_CANT_REQUEST_TO_AGENT: "PACKAGE_CANT_REQUEST_TO_AGENT",
|
|
31
|
-
PACKAGE_CANT_REQUEST_MONEY_MERCHANT_AGENT:"PACKAGE_CANT_REQUEST_MONEY_MERCHANT_AGENT"
|
|
31
|
+
PACKAGE_CANT_REQUEST_MONEY_MERCHANT_AGENT:"PACKAGE_CANT_REQUEST_MONEY_MERCHANT_AGENT",
|
|
32
|
+
PACKAGE_UNDER_MAINTENANCE:'PACKAGE_UNDER_MAINTENANCE',
|
|
32
33
|
|
|
33
34
|
};
|