react-native-timacare 3.3.33 → 3.3.34
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/lib/commonjs/screens/detail-loan/PaymentInfo.js +1 -1
- package/lib/commonjs/screens/detail-loan/PaymentInfo.js.flow +29 -0
- package/lib/commonjs/screens/detail-loan/PaymentInfo.js.map +1 -1
- package/lib/commonjs/screens/detail-loan/ShowQrCode.js +1 -1
- package/lib/commonjs/screens/detail-loan/ShowQrCode.js.flow +29 -0
- package/lib/commonjs/screens/detail-loan/ShowQrCode.js.map +1 -1
- package/lib/commonjs/screens/home/Store.js +1 -1
- package/lib/commonjs/screens/home/Store.js.flow +1 -1
- package/lib/commonjs/screens/home/Store.js.map +1 -1
- package/lib/commonjs/screens/home/index.js +1 -1
- package/lib/commonjs/screens/home/index.js.flow +33 -5
- package/lib/commonjs/screens/home/index.js.map +1 -1
- package/lib/commonjs/services/api/api.js +1 -1
- package/lib/commonjs/services/api/api.js.flow +1537 -1046
- package/lib/commonjs/services/api/api.js.map +1 -1
- package/lib/module/screens/detail-loan/PaymentInfo.js +1 -1
- package/lib/module/screens/detail-loan/PaymentInfo.js.map +1 -1
- package/lib/module/screens/detail-loan/ShowQrCode.js +1 -1
- package/lib/module/screens/detail-loan/ShowQrCode.js.map +1 -1
- package/lib/module/screens/home/Store.js +1 -1
- package/lib/module/screens/home/Store.js.map +1 -1
- package/lib/module/screens/home/index.js +1 -1
- package/lib/module/screens/home/index.js.map +1 -1
- package/lib/module/services/api/api.js +1 -1
- package/lib/module/services/api/api.js.map +1 -1
- package/lib/typescript/screens/home/index.d.ts.map +1 -1
- package/lib/typescript/services/api/api.d.ts +34 -2
- package/lib/typescript/services/api/api.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/screens/detail-loan/PaymentInfo.tsx +29 -0
- package/src/screens/detail-loan/ShowQrCode.tsx +29 -0
- package/src/screens/home/Store.tsx +1 -1
- package/src/screens/home/index.tsx +33 -5
- package/src/services/api/api.ts +1537 -1046
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
//@ts-nocheck
|
|
2
|
-
import { ApisauceInstance, create, ApiResponse } from
|
|
3
|
-
import { getGeneralApiProblem } from
|
|
4
|
-
import { myLog } from
|
|
5
|
-
import otpStore from
|
|
6
|
-
import appStore from
|
|
7
|
-
import axios from
|
|
8
|
-
import { load } from
|
|
9
|
-
import { getSDKConfig, SDKConfig } from
|
|
2
|
+
import { ApisauceInstance, create, ApiResponse } from 'apisauce';
|
|
3
|
+
import { getGeneralApiProblem } from './api-problem';
|
|
4
|
+
import { myLog } from '../../utils/log';
|
|
5
|
+
import otpStore from '../../screens/otp/Store';
|
|
6
|
+
import appStore from '../../AppStore';
|
|
7
|
+
import axios from 'axios';
|
|
8
|
+
import { load } from '../../utils/storage';
|
|
9
|
+
import { getSDKConfig, SDKConfig } from '../../sdkConfig';
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
12
|
* Manages all requests to the API.
|
|
13
13
|
*/
|
|
14
14
|
export class Api {
|
|
15
15
|
private static instance: Api;
|
|
16
|
-
apisauce: ApisauceInstance
|
|
17
|
-
apisauceFormData: ApisauceInstance
|
|
18
|
-
config: SDKConfig
|
|
16
|
+
apisauce: ApisauceInstance;
|
|
17
|
+
apisauceFormData: ApisauceInstance;
|
|
18
|
+
config: SDKConfig;
|
|
19
19
|
/**
|
|
20
20
|
* Configurable options.
|
|
21
21
|
*/
|
|
@@ -26,25 +26,25 @@ export class Api {
|
|
|
26
26
|
* @param config The configuration to use.
|
|
27
27
|
*/
|
|
28
28
|
constructor(config: SDKConfig = getSDKConfig()) {
|
|
29
|
-
this.config = config
|
|
30
|
-
this.setup()
|
|
29
|
+
this.config = config;
|
|
30
|
+
this.setup();
|
|
31
31
|
}
|
|
32
32
|
|
|
33
33
|
public static getInstance(): Api {
|
|
34
|
-
const sdkConfig = getSDKConfig()
|
|
34
|
+
const sdkConfig = getSDKConfig();
|
|
35
35
|
|
|
36
36
|
if (!Api.instance) {
|
|
37
|
-
Api.instance = new Api(sdkConfig)
|
|
37
|
+
Api.instance = new Api(sdkConfig);
|
|
38
38
|
} else if (
|
|
39
39
|
Api.instance.config.baseUrl !== sdkConfig.baseUrl ||
|
|
40
40
|
Api.instance.config.token !== sdkConfig.token ||
|
|
41
41
|
Api.instance.config.timeout !== sdkConfig.timeout
|
|
42
42
|
) {
|
|
43
|
-
Api.instance.config = sdkConfig
|
|
44
|
-
Api.instance.setup()
|
|
43
|
+
Api.instance.config = sdkConfig;
|
|
44
|
+
Api.instance.setup();
|
|
45
45
|
}
|
|
46
46
|
|
|
47
|
-
return Api.instance
|
|
47
|
+
return Api.instance;
|
|
48
48
|
}
|
|
49
49
|
|
|
50
50
|
async setup() {
|
|
@@ -54,21 +54,23 @@ export class Api {
|
|
|
54
54
|
baseURL: this.config.baseUrl,
|
|
55
55
|
timeout: this.config.timeout,
|
|
56
56
|
headers: {
|
|
57
|
-
Accept:
|
|
58
|
-
|
|
59
|
-
|
|
57
|
+
'Accept': 'application/json',
|
|
58
|
+
'Access-Control-Allow-Headers':
|
|
59
|
+
'Origin, X-Requested-With, Content-Type, Accept',
|
|
60
|
+
'Authorization': 'Bearer ' + this.config.token,
|
|
60
61
|
},
|
|
61
|
-
})
|
|
62
|
+
});
|
|
62
63
|
this.apisauceFormData = create({
|
|
63
64
|
baseURL: this.config.baseUrl,
|
|
64
65
|
timeout: this.config.timeout * 10,
|
|
65
66
|
headers: {
|
|
66
67
|
'content-type': 'application/json',
|
|
67
|
-
Accept:
|
|
68
|
-
|
|
69
|
-
|
|
68
|
+
'Accept': 'application/json',
|
|
69
|
+
'Access-Control-Allow-Headers':
|
|
70
|
+
'Origin, X-Requested-With, Content-Type, Accept',
|
|
71
|
+
'Authorization': 'Bearer ' + this.config.token,
|
|
70
72
|
},
|
|
71
|
-
})
|
|
73
|
+
});
|
|
72
74
|
}
|
|
73
75
|
|
|
74
76
|
/**
|
|
@@ -77,19 +79,22 @@ export class Api {
|
|
|
77
79
|
|
|
78
80
|
async Login(params) {
|
|
79
81
|
// make the api call
|
|
80
|
-
const response: ApiResponse<any> = await this.apisauce.post(
|
|
82
|
+
const response: ApiResponse<any> = await this.apisauce.post(
|
|
83
|
+
`api/v1.0/Security/login`,
|
|
84
|
+
params
|
|
85
|
+
);
|
|
81
86
|
|
|
82
87
|
// the typical ways to die when calling an api
|
|
83
88
|
if (!response.ok) {
|
|
84
|
-
const problem = getGeneralApiProblem(response)
|
|
85
|
-
if (problem) return problem
|
|
89
|
+
const problem = getGeneralApiProblem(response);
|
|
90
|
+
if (problem) return problem;
|
|
86
91
|
}
|
|
87
92
|
|
|
88
93
|
// transform the data into the format we are expecting
|
|
89
94
|
try {
|
|
90
|
-
return { kind:
|
|
95
|
+
return { kind: 'ok', data: response.data };
|
|
91
96
|
} catch {
|
|
92
|
-
return { kind:
|
|
97
|
+
return { kind: 'bad-data' };
|
|
93
98
|
}
|
|
94
99
|
}
|
|
95
100
|
|
|
@@ -99,20 +104,23 @@ export class Api {
|
|
|
99
104
|
|
|
100
105
|
async ListLoan(params) {
|
|
101
106
|
// make the api call
|
|
102
|
-
const response: ApiResponse<any> = await this.apisauce.get(
|
|
103
|
-
|
|
107
|
+
const response: ApiResponse<any> = await this.apisauce.get(
|
|
108
|
+
`api/v1.0/Approve/list_loan`,
|
|
109
|
+
params
|
|
110
|
+
);
|
|
111
|
+
myLog(response);
|
|
104
112
|
|
|
105
113
|
// the typical ways to die when calling an api
|
|
106
114
|
if (!response.ok) {
|
|
107
|
-
const problem = getGeneralApiProblem(response)
|
|
108
|
-
if (problem) return problem
|
|
115
|
+
const problem = getGeneralApiProblem(response);
|
|
116
|
+
if (problem) return problem;
|
|
109
117
|
}
|
|
110
118
|
|
|
111
119
|
// transform the data into the format we are expecting
|
|
112
120
|
try {
|
|
113
|
-
return { kind:
|
|
121
|
+
return { kind: 'ok', data: response.data };
|
|
114
122
|
} catch {
|
|
115
|
-
return { kind:
|
|
123
|
+
return { kind: 'bad-data' };
|
|
116
124
|
}
|
|
117
125
|
}
|
|
118
126
|
|
|
@@ -122,20 +130,23 @@ export class Api {
|
|
|
122
130
|
|
|
123
131
|
async PushLoan(params) {
|
|
124
132
|
// make the api call
|
|
125
|
-
const response: ApiResponse<any> = await this.apisauce.post(
|
|
126
|
-
|
|
133
|
+
const response: ApiResponse<any> = await this.apisauce.post(
|
|
134
|
+
`api/v1.0/Approve/push_loan`,
|
|
135
|
+
params
|
|
136
|
+
);
|
|
137
|
+
myLog(response);
|
|
127
138
|
|
|
128
139
|
// the typical ways to die when calling an api
|
|
129
140
|
if (!response.ok) {
|
|
130
|
-
const problem = getGeneralApiProblem(response)
|
|
131
|
-
if (problem) return problem
|
|
141
|
+
const problem = getGeneralApiProblem(response);
|
|
142
|
+
if (problem) return problem;
|
|
132
143
|
}
|
|
133
144
|
|
|
134
145
|
// transform the data into the format we are expecting
|
|
135
146
|
try {
|
|
136
|
-
return { kind:
|
|
147
|
+
return { kind: 'ok', data: response.data };
|
|
137
148
|
} catch {
|
|
138
|
-
return { kind:
|
|
149
|
+
return { kind: 'bad-data' };
|
|
139
150
|
}
|
|
140
151
|
}
|
|
141
152
|
|
|
@@ -145,20 +156,23 @@ export class Api {
|
|
|
145
156
|
|
|
146
157
|
async ListReturn(params) {
|
|
147
158
|
// make the api call
|
|
148
|
-
const response: ApiResponse<any> = await this.apisauce.get(
|
|
149
|
-
|
|
159
|
+
const response: ApiResponse<any> = await this.apisauce.get(
|
|
160
|
+
`api/v1.0/Approve/list_reason`,
|
|
161
|
+
params
|
|
162
|
+
);
|
|
163
|
+
myLog(response);
|
|
150
164
|
|
|
151
165
|
// the typical ways to die when calling an api
|
|
152
166
|
if (!response.ok) {
|
|
153
|
-
const problem = getGeneralApiProblem(response)
|
|
154
|
-
if (problem) return problem
|
|
167
|
+
const problem = getGeneralApiProblem(response);
|
|
168
|
+
if (problem) return problem;
|
|
155
169
|
}
|
|
156
170
|
|
|
157
171
|
// transform the data into the format we are expecting
|
|
158
172
|
try {
|
|
159
|
-
return { kind:
|
|
173
|
+
return { kind: 'ok', data: response.data };
|
|
160
174
|
} catch {
|
|
161
|
-
return { kind:
|
|
175
|
+
return { kind: 'bad-data' };
|
|
162
176
|
}
|
|
163
177
|
}
|
|
164
178
|
|
|
@@ -168,20 +182,23 @@ export class Api {
|
|
|
168
182
|
|
|
169
183
|
async ReturnLoan(params) {
|
|
170
184
|
// make the api call
|
|
171
|
-
const response: ApiResponse<any> = await this.apisauce.post(
|
|
172
|
-
|
|
185
|
+
const response: ApiResponse<any> = await this.apisauce.post(
|
|
186
|
+
`api/v1.0/Approve/return_loan`,
|
|
187
|
+
params
|
|
188
|
+
);
|
|
189
|
+
myLog(response);
|
|
173
190
|
|
|
174
191
|
// the typical ways to die when calling an api
|
|
175
192
|
if (!response.ok) {
|
|
176
|
-
const problem = getGeneralApiProblem(response)
|
|
177
|
-
if (problem) return problem
|
|
193
|
+
const problem = getGeneralApiProblem(response);
|
|
194
|
+
if (problem) return problem;
|
|
178
195
|
}
|
|
179
196
|
|
|
180
197
|
// transform the data into the format we are expecting
|
|
181
198
|
try {
|
|
182
|
-
return { kind:
|
|
199
|
+
return { kind: 'ok', data: response.data };
|
|
183
200
|
} catch {
|
|
184
|
-
return { kind:
|
|
201
|
+
return { kind: 'bad-data' };
|
|
185
202
|
}
|
|
186
203
|
}
|
|
187
204
|
|
|
@@ -191,19 +208,22 @@ export class Api {
|
|
|
191
208
|
|
|
192
209
|
async ListProduct(params) {
|
|
193
210
|
// make the api call
|
|
194
|
-
const response: ApiResponse<any> = await this.apisauce.get(
|
|
211
|
+
const response: ApiResponse<any> = await this.apisauce.get(
|
|
212
|
+
`api/v1.0/Approve/list_product`,
|
|
213
|
+
params
|
|
214
|
+
);
|
|
195
215
|
|
|
196
216
|
// the typical ways to die when calling an api
|
|
197
217
|
if (!response.ok) {
|
|
198
|
-
const problem = getGeneralApiProblem(response)
|
|
199
|
-
if (problem) return problem
|
|
218
|
+
const problem = getGeneralApiProblem(response);
|
|
219
|
+
if (problem) return problem;
|
|
200
220
|
}
|
|
201
221
|
|
|
202
222
|
// transform the data into the format we are expecting
|
|
203
223
|
try {
|
|
204
|
-
return { kind:
|
|
224
|
+
return { kind: 'ok', data: response.data };
|
|
205
225
|
} catch {
|
|
206
|
-
return { kind:
|
|
226
|
+
return { kind: 'bad-data' };
|
|
207
227
|
}
|
|
208
228
|
}
|
|
209
229
|
/**
|
|
@@ -212,19 +232,22 @@ export class Api {
|
|
|
212
232
|
|
|
213
233
|
async ListStatus(params) {
|
|
214
234
|
// make the api call
|
|
215
|
-
const response: ApiResponse<any> = await this.apisauce.get(
|
|
235
|
+
const response: ApiResponse<any> = await this.apisauce.get(
|
|
236
|
+
`api/v1.0/Approve/list_status`,
|
|
237
|
+
params
|
|
238
|
+
);
|
|
216
239
|
|
|
217
240
|
// the typical ways to die when calling an api
|
|
218
241
|
if (!response.ok) {
|
|
219
|
-
const problem = getGeneralApiProblem(response)
|
|
220
|
-
if (problem) return problem
|
|
242
|
+
const problem = getGeneralApiProblem(response);
|
|
243
|
+
if (problem) return problem;
|
|
221
244
|
}
|
|
222
245
|
|
|
223
246
|
// transform the data into the format we are expecting
|
|
224
247
|
try {
|
|
225
|
-
return { kind:
|
|
248
|
+
return { kind: 'ok', data: response.data };
|
|
226
249
|
} catch {
|
|
227
|
-
return { kind:
|
|
250
|
+
return { kind: 'bad-data' };
|
|
228
251
|
}
|
|
229
252
|
}
|
|
230
253
|
/**
|
|
@@ -233,19 +256,22 @@ export class Api {
|
|
|
233
256
|
|
|
234
257
|
async ChangeStatus(params) {
|
|
235
258
|
// make the api call
|
|
236
|
-
const response: ApiResponse<any> = await this.apisauce.post(
|
|
259
|
+
const response: ApiResponse<any> = await this.apisauce.post(
|
|
260
|
+
`api/v1.0/Approve/change_status`,
|
|
261
|
+
params
|
|
262
|
+
);
|
|
237
263
|
|
|
238
264
|
// the typical ways to die when calling an api
|
|
239
265
|
if (!response.ok) {
|
|
240
|
-
const problem = getGeneralApiProblem(response)
|
|
241
|
-
if (problem) return problem
|
|
266
|
+
const problem = getGeneralApiProblem(response);
|
|
267
|
+
if (problem) return problem;
|
|
242
268
|
}
|
|
243
269
|
|
|
244
270
|
// transform the data into the format we are expecting
|
|
245
271
|
try {
|
|
246
|
-
return { kind:
|
|
272
|
+
return { kind: 'ok', data: response.data };
|
|
247
273
|
} catch {
|
|
248
|
-
return { kind:
|
|
274
|
+
return { kind: 'bad-data' };
|
|
249
275
|
}
|
|
250
276
|
}
|
|
251
277
|
/**
|
|
@@ -254,19 +280,22 @@ export class Api {
|
|
|
254
280
|
|
|
255
281
|
async AddComment(params) {
|
|
256
282
|
// make the api call
|
|
257
|
-
const response: ApiResponse<any> = await this.apisauce.post(
|
|
283
|
+
const response: ApiResponse<any> = await this.apisauce.post(
|
|
284
|
+
`api/v1.0/Approve/add_comment`,
|
|
285
|
+
params
|
|
286
|
+
);
|
|
258
287
|
|
|
259
288
|
// the typical ways to die when calling an api
|
|
260
289
|
if (!response.ok) {
|
|
261
|
-
const problem = getGeneralApiProblem(response)
|
|
262
|
-
if (problem) return problem
|
|
290
|
+
const problem = getGeneralApiProblem(response);
|
|
291
|
+
if (problem) return problem;
|
|
263
292
|
}
|
|
264
293
|
|
|
265
294
|
// transform the data into the format we are expecting
|
|
266
295
|
try {
|
|
267
|
-
return { kind:
|
|
296
|
+
return { kind: 'ok', data: response.data };
|
|
268
297
|
} catch {
|
|
269
|
-
return { kind:
|
|
298
|
+
return { kind: 'bad-data' };
|
|
270
299
|
}
|
|
271
300
|
}
|
|
272
301
|
/**
|
|
@@ -275,19 +304,22 @@ export class Api {
|
|
|
275
304
|
|
|
276
305
|
async ListComment(params) {
|
|
277
306
|
// make the api call
|
|
278
|
-
const response: ApiResponse<any> = await this.apisauce.get(
|
|
307
|
+
const response: ApiResponse<any> = await this.apisauce.get(
|
|
308
|
+
`api/v1.0/Approve/get_comment`,
|
|
309
|
+
params
|
|
310
|
+
);
|
|
279
311
|
|
|
280
312
|
// the typical ways to die when calling an api
|
|
281
313
|
if (!response.ok) {
|
|
282
|
-
const problem = getGeneralApiProblem(response)
|
|
283
|
-
if (problem) return problem
|
|
314
|
+
const problem = getGeneralApiProblem(response);
|
|
315
|
+
if (problem) return problem;
|
|
284
316
|
}
|
|
285
317
|
|
|
286
318
|
// transform the data into the format we are expecting
|
|
287
319
|
try {
|
|
288
|
-
return { kind:
|
|
320
|
+
return { kind: 'ok', data: response.data };
|
|
289
321
|
} catch {
|
|
290
|
-
return { kind:
|
|
322
|
+
return { kind: 'bad-data' };
|
|
291
323
|
}
|
|
292
324
|
}
|
|
293
325
|
|
|
@@ -297,20 +329,22 @@ export class Api {
|
|
|
297
329
|
|
|
298
330
|
async GroupsDelete() {
|
|
299
331
|
// make the api call
|
|
300
|
-
const response: ApiResponse<any> = await this.apisauce.get(
|
|
301
|
-
|
|
332
|
+
const response: ApiResponse<any> = await this.apisauce.get(
|
|
333
|
+
`api/v1.0/Approve/get_reason_group`
|
|
334
|
+
);
|
|
335
|
+
myLog(response);
|
|
302
336
|
|
|
303
337
|
// the typical ways to die when calling an api
|
|
304
338
|
if (!response.ok) {
|
|
305
|
-
const problem = getGeneralApiProblem(response)
|
|
306
|
-
if (problem) return problem
|
|
339
|
+
const problem = getGeneralApiProblem(response);
|
|
340
|
+
if (problem) return problem;
|
|
307
341
|
}
|
|
308
342
|
|
|
309
343
|
// transform the data into the format we are expecting
|
|
310
344
|
try {
|
|
311
|
-
return { kind:
|
|
345
|
+
return { kind: 'ok', data: response.data };
|
|
312
346
|
} catch {
|
|
313
|
-
return { kind:
|
|
347
|
+
return { kind: 'bad-data' };
|
|
314
348
|
}
|
|
315
349
|
}
|
|
316
350
|
|
|
@@ -320,20 +354,23 @@ export class Api {
|
|
|
320
354
|
|
|
321
355
|
async ReasonDetail(params) {
|
|
322
356
|
// make the api call
|
|
323
|
-
const response: ApiResponse<any> = await this.apisauce.get(
|
|
324
|
-
|
|
357
|
+
const response: ApiResponse<any> = await this.apisauce.get(
|
|
358
|
+
`api/v1.0/Approve/get_reason_detail`,
|
|
359
|
+
params
|
|
360
|
+
);
|
|
361
|
+
myLog(response);
|
|
325
362
|
|
|
326
363
|
// the typical ways to die when calling an api
|
|
327
364
|
if (!response.ok) {
|
|
328
|
-
const problem = getGeneralApiProblem(response)
|
|
329
|
-
if (problem) return problem
|
|
365
|
+
const problem = getGeneralApiProblem(response);
|
|
366
|
+
if (problem) return problem;
|
|
330
367
|
}
|
|
331
368
|
|
|
332
369
|
// transform the data into the format we are expecting
|
|
333
370
|
try {
|
|
334
|
-
return { kind:
|
|
371
|
+
return { kind: 'ok', data: response.data };
|
|
335
372
|
} catch {
|
|
336
|
-
return { kind:
|
|
373
|
+
return { kind: 'bad-data' };
|
|
337
374
|
}
|
|
338
375
|
}
|
|
339
376
|
|
|
@@ -343,20 +380,23 @@ export class Api {
|
|
|
343
380
|
|
|
344
381
|
async DeleteLoan(body) {
|
|
345
382
|
// make the api call
|
|
346
|
-
const response: ApiResponse<any> = await this.apisauce.get(
|
|
347
|
-
|
|
383
|
+
const response: ApiResponse<any> = await this.apisauce.get(
|
|
384
|
+
`api/v1.0/Approve/cancel_loanbrief`,
|
|
385
|
+
body
|
|
386
|
+
);
|
|
387
|
+
myLog(response);
|
|
348
388
|
|
|
349
389
|
// the typical ways to die when calling an api
|
|
350
390
|
if (!response.ok) {
|
|
351
|
-
const problem = getGeneralApiProblem(response)
|
|
352
|
-
if (problem) return problem
|
|
391
|
+
const problem = getGeneralApiProblem(response);
|
|
392
|
+
if (problem) return problem;
|
|
353
393
|
}
|
|
354
394
|
|
|
355
395
|
// transform the data into the format we are expecting
|
|
356
396
|
try {
|
|
357
|
-
return { kind:
|
|
397
|
+
return { kind: 'ok', data: response.data };
|
|
358
398
|
} catch {
|
|
359
|
-
return { kind:
|
|
399
|
+
return { kind: 'bad-data' };
|
|
360
400
|
}
|
|
361
401
|
}
|
|
362
402
|
|
|
@@ -366,19 +406,22 @@ export class Api {
|
|
|
366
406
|
|
|
367
407
|
async SwitchStaff(body) {
|
|
368
408
|
// make the api call
|
|
369
|
-
const response: ApiResponse<any> = await this.apisauce.post(
|
|
409
|
+
const response: ApiResponse<any> = await this.apisauce.post(
|
|
410
|
+
`api/v1.0/Approve/change_status`,
|
|
411
|
+
body
|
|
412
|
+
);
|
|
370
413
|
|
|
371
414
|
// the typical ways to die when calling an api
|
|
372
415
|
if (!response.ok) {
|
|
373
|
-
const problem = getGeneralApiProblem(response)
|
|
374
|
-
if (problem) return problem
|
|
416
|
+
const problem = getGeneralApiProblem(response);
|
|
417
|
+
if (problem) return problem;
|
|
375
418
|
}
|
|
376
419
|
|
|
377
420
|
// transform the data into the format we are expecting
|
|
378
421
|
try {
|
|
379
|
-
return { kind:
|
|
422
|
+
return { kind: 'ok', data: response.data };
|
|
380
423
|
} catch {
|
|
381
|
-
return { kind:
|
|
424
|
+
return { kind: 'bad-data' };
|
|
382
425
|
}
|
|
383
426
|
}
|
|
384
427
|
|
|
@@ -388,19 +431,21 @@ export class Api {
|
|
|
388
431
|
|
|
389
432
|
async ListStaffSupport() {
|
|
390
433
|
// make the api call
|
|
391
|
-
const response: ApiResponse<any> = await this.apisauce.get(
|
|
434
|
+
const response: ApiResponse<any> = await this.apisauce.get(
|
|
435
|
+
`api/v1.0/Approve/get_approve_employee`
|
|
436
|
+
);
|
|
392
437
|
|
|
393
438
|
// the typical ways to die when calling an api
|
|
394
439
|
if (!response.ok) {
|
|
395
|
-
const problem = getGeneralApiProblem(response)
|
|
396
|
-
if (problem) return problem
|
|
440
|
+
const problem = getGeneralApiProblem(response);
|
|
441
|
+
if (problem) return problem;
|
|
397
442
|
}
|
|
398
443
|
|
|
399
444
|
// transform the data into the format we are expecting
|
|
400
445
|
try {
|
|
401
|
-
return { kind:
|
|
446
|
+
return { kind: 'ok', data: response.data };
|
|
402
447
|
} catch {
|
|
403
|
-
return { kind:
|
|
448
|
+
return { kind: 'bad-data' };
|
|
404
449
|
}
|
|
405
450
|
}
|
|
406
451
|
|
|
@@ -410,18 +455,21 @@ export class Api {
|
|
|
410
455
|
|
|
411
456
|
async LoanDetail(params) {
|
|
412
457
|
// make the api call
|
|
413
|
-
const response: ApiResponse<any> = await this.apisauce.get(
|
|
458
|
+
const response: ApiResponse<any> = await this.apisauce.get(
|
|
459
|
+
`api/v1.0/approve/loanbrief_detail`,
|
|
460
|
+
params
|
|
461
|
+
);
|
|
414
462
|
// the typical ways to die when calling an api
|
|
415
463
|
if (!response.ok) {
|
|
416
|
-
const problem = getGeneralApiProblem(response)
|
|
417
|
-
if (problem) return problem
|
|
464
|
+
const problem = getGeneralApiProblem(response);
|
|
465
|
+
if (problem) return problem;
|
|
418
466
|
}
|
|
419
467
|
|
|
420
468
|
// transform the data into the format we are expecting
|
|
421
469
|
try {
|
|
422
|
-
return { kind:
|
|
470
|
+
return { kind: 'ok', data: response.data };
|
|
423
471
|
} catch {
|
|
424
|
-
return { kind:
|
|
472
|
+
return { kind: 'bad-data' };
|
|
425
473
|
}
|
|
426
474
|
}
|
|
427
475
|
|
|
@@ -431,19 +479,22 @@ export class Api {
|
|
|
431
479
|
|
|
432
480
|
async ConfirmCustomerContract(body) {
|
|
433
481
|
// make the api call
|
|
434
|
-
const response: ApiResponse<any> = await this.apisauce.post(
|
|
482
|
+
const response: ApiResponse<any> = await this.apisauce.post(
|
|
483
|
+
`api/v1.0/Approve/confirm_customer_contract`,
|
|
484
|
+
body
|
|
485
|
+
);
|
|
435
486
|
|
|
436
487
|
// the typical ways to die when calling an api
|
|
437
488
|
if (!response.ok) {
|
|
438
|
-
const problem = getGeneralApiProblem(response)
|
|
439
|
-
if (problem) return problem
|
|
489
|
+
const problem = getGeneralApiProblem(response);
|
|
490
|
+
if (problem) return problem;
|
|
440
491
|
}
|
|
441
492
|
|
|
442
493
|
// transform the data into the format we are expecting
|
|
443
494
|
try {
|
|
444
|
-
return { kind:
|
|
495
|
+
return { kind: 'ok', data: response.data };
|
|
445
496
|
} catch {
|
|
446
|
-
return { kind:
|
|
497
|
+
return { kind: 'bad-data' };
|
|
447
498
|
}
|
|
448
499
|
}
|
|
449
500
|
|
|
@@ -453,18 +504,21 @@ export class Api {
|
|
|
453
504
|
|
|
454
505
|
async AllFiles(params) {
|
|
455
506
|
// make the api call
|
|
456
|
-
const response: ApiResponse<any> = await this.apisauce.get(
|
|
507
|
+
const response: ApiResponse<any> = await this.apisauce.get(
|
|
508
|
+
`api/v1.0/Approve/get_file_all`,
|
|
509
|
+
params
|
|
510
|
+
);
|
|
457
511
|
// the typical ways to die when calling an api
|
|
458
512
|
if (!response.ok) {
|
|
459
|
-
const problem = getGeneralApiProblem(response)
|
|
460
|
-
if (problem) return problem
|
|
513
|
+
const problem = getGeneralApiProblem(response);
|
|
514
|
+
if (problem) return problem;
|
|
461
515
|
}
|
|
462
516
|
|
|
463
517
|
// transform the data into the format we are expecting
|
|
464
518
|
try {
|
|
465
|
-
return { kind:
|
|
519
|
+
return { kind: 'ok', data: response.data };
|
|
466
520
|
} catch {
|
|
467
|
-
return { kind:
|
|
521
|
+
return { kind: 'bad-data' };
|
|
468
522
|
}
|
|
469
523
|
}
|
|
470
524
|
|
|
@@ -474,18 +528,21 @@ export class Api {
|
|
|
474
528
|
|
|
475
529
|
async GetFeeInsurance(params) {
|
|
476
530
|
// make the api call
|
|
477
|
-
const response: ApiResponse<any> = await this.apisauce.get(
|
|
531
|
+
const response: ApiResponse<any> = await this.apisauce.get(
|
|
532
|
+
`api/v1.0/Approve/get_insurence`,
|
|
533
|
+
params
|
|
534
|
+
);
|
|
478
535
|
// the typical ways to die when calling an api
|
|
479
536
|
if (!response.ok) {
|
|
480
|
-
const problem = getGeneralApiProblem(response)
|
|
481
|
-
if (problem) return problem
|
|
537
|
+
const problem = getGeneralApiProblem(response);
|
|
538
|
+
if (problem) return problem;
|
|
482
539
|
}
|
|
483
540
|
|
|
484
541
|
// transform the data into the format we are expecting
|
|
485
542
|
try {
|
|
486
|
-
return { kind:
|
|
543
|
+
return { kind: 'ok', data: response.data };
|
|
487
544
|
} catch {
|
|
488
|
-
return { kind:
|
|
545
|
+
return { kind: 'bad-data' };
|
|
489
546
|
}
|
|
490
547
|
}
|
|
491
548
|
|
|
@@ -495,19 +552,22 @@ export class Api {
|
|
|
495
552
|
|
|
496
553
|
async AppraiserVehicle(params) {
|
|
497
554
|
// make the api call
|
|
498
|
-
const response: ApiResponse<any> = await this.apisauce.get(
|
|
555
|
+
const response: ApiResponse<any> = await this.apisauce.get(
|
|
556
|
+
`api/v1.0/Approve/appraiser_motor`,
|
|
557
|
+
params
|
|
558
|
+
);
|
|
499
559
|
|
|
500
560
|
// the typical ways to die when calling an api
|
|
501
561
|
if (!response.ok) {
|
|
502
|
-
const problem = getGeneralApiProblem(response)
|
|
503
|
-
if (problem) return problem
|
|
562
|
+
const problem = getGeneralApiProblem(response);
|
|
563
|
+
if (problem) return problem;
|
|
504
564
|
}
|
|
505
565
|
|
|
506
566
|
// transform the data into the format we are expecting
|
|
507
567
|
try {
|
|
508
|
-
return { kind:
|
|
568
|
+
return { kind: 'ok', data: response.data };
|
|
509
569
|
} catch {
|
|
510
|
-
return { kind:
|
|
570
|
+
return { kind: 'bad-data' };
|
|
511
571
|
}
|
|
512
572
|
}
|
|
513
573
|
|
|
@@ -517,18 +577,21 @@ export class Api {
|
|
|
517
577
|
|
|
518
578
|
async GetRecording(params) {
|
|
519
579
|
// make the api call
|
|
520
|
-
const response: ApiResponse<any> = await this.apisauce.get(
|
|
580
|
+
const response: ApiResponse<any> = await this.apisauce.get(
|
|
581
|
+
`api/v1.0/Approve/get_recording`,
|
|
582
|
+
params
|
|
583
|
+
);
|
|
521
584
|
// the typical ways to die when calling an api
|
|
522
585
|
if (!response.ok) {
|
|
523
|
-
const problem = getGeneralApiProblem(response)
|
|
524
|
-
if (problem) return problem
|
|
586
|
+
const problem = getGeneralApiProblem(response);
|
|
587
|
+
if (problem) return problem;
|
|
525
588
|
}
|
|
526
589
|
|
|
527
590
|
// transform the data into the format we are expecting
|
|
528
591
|
try {
|
|
529
|
-
return { kind:
|
|
592
|
+
return { kind: 'ok', data: response.data };
|
|
530
593
|
} catch {
|
|
531
|
-
return { kind:
|
|
594
|
+
return { kind: 'bad-data' };
|
|
532
595
|
}
|
|
533
596
|
}
|
|
534
597
|
|
|
@@ -538,19 +601,22 @@ export class Api {
|
|
|
538
601
|
|
|
539
602
|
async DeferredPayment(params) {
|
|
540
603
|
// make the api call
|
|
541
|
-
const response: ApiResponse<any> = await this.apisauce.get(
|
|
542
|
-
|
|
604
|
+
const response: ApiResponse<any> = await this.apisauce.get(
|
|
605
|
+
`api/v1.0/Approve/get_deferred_payment`,
|
|
606
|
+
params
|
|
607
|
+
);
|
|
608
|
+
myLog(response);
|
|
543
609
|
// the typical ways to die when calling an api
|
|
544
610
|
if (!response.ok) {
|
|
545
|
-
const problem = getGeneralApiProblem(response)
|
|
546
|
-
if (problem) return problem
|
|
611
|
+
const problem = getGeneralApiProblem(response);
|
|
612
|
+
if (problem) return problem;
|
|
547
613
|
}
|
|
548
614
|
|
|
549
615
|
// transform the data into the format we are expecting
|
|
550
616
|
try {
|
|
551
|
-
return { kind:
|
|
617
|
+
return { kind: 'ok', data: response.data };
|
|
552
618
|
} catch {
|
|
553
|
-
return { kind:
|
|
619
|
+
return { kind: 'bad-data' };
|
|
554
620
|
}
|
|
555
621
|
}
|
|
556
622
|
|
|
@@ -560,19 +626,22 @@ export class Api {
|
|
|
560
626
|
|
|
561
627
|
async FileByDocuments(params) {
|
|
562
628
|
// make the api call
|
|
563
|
-
const response: ApiResponse<any> = await this.apisauce.get(
|
|
564
|
-
|
|
629
|
+
const response: ApiResponse<any> = await this.apisauce.get(
|
|
630
|
+
`api/v1.0/Approve/get_file_by_document`,
|
|
631
|
+
params
|
|
632
|
+
);
|
|
633
|
+
myLog(response);
|
|
565
634
|
// the typical ways to die when calling an api
|
|
566
635
|
if (!response.ok) {
|
|
567
|
-
const problem = getGeneralApiProblem(response)
|
|
568
|
-
if (problem) return problem
|
|
636
|
+
const problem = getGeneralApiProblem(response);
|
|
637
|
+
if (problem) return problem;
|
|
569
638
|
}
|
|
570
639
|
|
|
571
640
|
// transform the data into the format we are expecting
|
|
572
641
|
try {
|
|
573
|
-
return { kind:
|
|
642
|
+
return { kind: 'ok', data: response.data };
|
|
574
643
|
} catch {
|
|
575
|
-
return { kind:
|
|
644
|
+
return { kind: 'bad-data' };
|
|
576
645
|
}
|
|
577
646
|
}
|
|
578
647
|
|
|
@@ -582,19 +651,22 @@ export class Api {
|
|
|
582
651
|
|
|
583
652
|
async DownloadFileRecord(params) {
|
|
584
653
|
// make the api call
|
|
585
|
-
const response: ApiResponse<any> = await this.apisauce.get(
|
|
586
|
-
|
|
654
|
+
const response: ApiResponse<any> = await this.apisauce.get(
|
|
655
|
+
`api/v1.0/approve/download_file_cisco`,
|
|
656
|
+
params
|
|
657
|
+
);
|
|
658
|
+
myLog(response);
|
|
587
659
|
// the typical ways to die when calling an api
|
|
588
660
|
if (!response.ok) {
|
|
589
|
-
const problem = getGeneralApiProblem(response)
|
|
590
|
-
if (problem) return problem
|
|
661
|
+
const problem = getGeneralApiProblem(response);
|
|
662
|
+
if (problem) return problem;
|
|
591
663
|
}
|
|
592
664
|
|
|
593
665
|
// transform the data into the format we are expecting
|
|
594
666
|
try {
|
|
595
|
-
return { kind:
|
|
667
|
+
return { kind: 'ok', data: response.data };
|
|
596
668
|
} catch {
|
|
597
|
-
return { kind:
|
|
669
|
+
return { kind: 'bad-data' };
|
|
598
670
|
}
|
|
599
671
|
}
|
|
600
672
|
|
|
@@ -604,19 +676,22 @@ export class Api {
|
|
|
604
676
|
|
|
605
677
|
async InterestTool(params) {
|
|
606
678
|
// make the api call
|
|
607
|
-
const response: ApiResponse<any> = await this.apisauce.post(
|
|
608
|
-
|
|
679
|
+
const response: ApiResponse<any> = await this.apisauce.post(
|
|
680
|
+
`api/v1.0/approve/interest_tool`,
|
|
681
|
+
params
|
|
682
|
+
);
|
|
683
|
+
myLog(response);
|
|
609
684
|
// the typical ways to die when calling an api
|
|
610
685
|
if (!response.ok) {
|
|
611
|
-
const problem = getGeneralApiProblem(response)
|
|
612
|
-
if (problem) return problem
|
|
686
|
+
const problem = getGeneralApiProblem(response);
|
|
687
|
+
if (problem) return problem;
|
|
613
688
|
}
|
|
614
689
|
|
|
615
690
|
// transform the data into the format we are expecting
|
|
616
691
|
try {
|
|
617
|
-
return { kind:
|
|
692
|
+
return { kind: 'ok', data: response.data };
|
|
618
693
|
} catch {
|
|
619
|
-
return { kind:
|
|
694
|
+
return { kind: 'bad-data' };
|
|
620
695
|
}
|
|
621
696
|
}
|
|
622
697
|
|
|
@@ -626,19 +701,22 @@ export class Api {
|
|
|
626
701
|
|
|
627
702
|
async InterestTopUpTool(params) {
|
|
628
703
|
// make the api call
|
|
629
|
-
const response: ApiResponse<any> = await this.apisauce.post(
|
|
630
|
-
|
|
704
|
+
const response: ApiResponse<any> = await this.apisauce.post(
|
|
705
|
+
`api/v1.0/approve/interest_topup_tool`,
|
|
706
|
+
params
|
|
707
|
+
);
|
|
708
|
+
myLog(response);
|
|
631
709
|
// the typical ways to die when calling an api
|
|
632
710
|
if (!response.ok) {
|
|
633
|
-
const problem = getGeneralApiProblem(response)
|
|
634
|
-
if (problem) return problem
|
|
711
|
+
const problem = getGeneralApiProblem(response);
|
|
712
|
+
if (problem) return problem;
|
|
635
713
|
}
|
|
636
714
|
|
|
637
715
|
// transform the data into the format we are expecting
|
|
638
716
|
try {
|
|
639
|
-
return { kind:
|
|
717
|
+
return { kind: 'ok', data: response.data };
|
|
640
718
|
} catch {
|
|
641
|
-
return { kind:
|
|
719
|
+
return { kind: 'bad-data' };
|
|
642
720
|
}
|
|
643
721
|
}
|
|
644
722
|
|
|
@@ -662,11 +740,11 @@ export class Api {
|
|
|
662
740
|
{ name: 'Hà Nội', id: 1 },
|
|
663
741
|
{ name: 'Hà Nội', id: 1 },
|
|
664
742
|
{ name: 'Hà Nội', id: 1 },
|
|
665
|
-
]
|
|
743
|
+
],
|
|
666
744
|
},
|
|
667
|
-
problem: ''
|
|
668
|
-
}
|
|
669
|
-
myLog(response)
|
|
745
|
+
problem: '',
|
|
746
|
+
};
|
|
747
|
+
myLog(response);
|
|
670
748
|
// the typical ways to die when calling an api
|
|
671
749
|
if (!response.ok) {
|
|
672
750
|
// const problem = getGeneralApiProblem(response)
|
|
@@ -675,10 +753,10 @@ export class Api {
|
|
|
675
753
|
|
|
676
754
|
// transform the data into the format we are expecting
|
|
677
755
|
try {
|
|
678
|
-
myLog(response.data)
|
|
679
|
-
return { kind:
|
|
756
|
+
myLog(response.data);
|
|
757
|
+
return { kind: 'ok', data: response.data };
|
|
680
758
|
} catch {
|
|
681
|
-
return { kind:
|
|
759
|
+
return { kind: 'bad-data' };
|
|
682
760
|
}
|
|
683
761
|
}
|
|
684
762
|
|
|
@@ -690,18 +768,21 @@ export class Api {
|
|
|
690
768
|
|
|
691
769
|
async getOTP(params) {
|
|
692
770
|
// make the api call
|
|
693
|
-
const response: ApiResponse<any> = await this.apisauce.get(
|
|
771
|
+
const response: ApiResponse<any> = await this.apisauce.get(
|
|
772
|
+
`api/v1.0/security/get_otp`,
|
|
773
|
+
params
|
|
774
|
+
);
|
|
694
775
|
// the typical ways to die when calling an api
|
|
695
776
|
if (!response.ok) {
|
|
696
|
-
const problem = getGeneralApiProblem(response)
|
|
697
|
-
if (problem) return problem
|
|
777
|
+
const problem = getGeneralApiProblem(response);
|
|
778
|
+
if (problem) return problem;
|
|
698
779
|
}
|
|
699
780
|
|
|
700
781
|
// transform the data into the format we are expecting
|
|
701
782
|
try {
|
|
702
|
-
return { kind:
|
|
783
|
+
return { kind: 'ok', data: response.data };
|
|
703
784
|
} catch {
|
|
704
|
-
return { kind:
|
|
785
|
+
return { kind: 'bad-data' };
|
|
705
786
|
}
|
|
706
787
|
}
|
|
707
788
|
|
|
@@ -713,19 +794,22 @@ export class Api {
|
|
|
713
794
|
|
|
714
795
|
async reGetOTP(params) {
|
|
715
796
|
// make the api call
|
|
716
|
-
const response: ApiResponse<any> = await this.apisauce.get(
|
|
797
|
+
const response: ApiResponse<any> = await this.apisauce.get(
|
|
798
|
+
`api/v1.0/security/reget_otp`,
|
|
799
|
+
params
|
|
800
|
+
);
|
|
717
801
|
// the typical ways to die when calling an api
|
|
718
|
-
myLog(response)
|
|
802
|
+
myLog(response);
|
|
719
803
|
if (!response.ok) {
|
|
720
|
-
const problem = getGeneralApiProblem(response)
|
|
721
|
-
if (problem) return problem
|
|
804
|
+
const problem = getGeneralApiProblem(response);
|
|
805
|
+
if (problem) return problem;
|
|
722
806
|
}
|
|
723
807
|
|
|
724
808
|
// transform the data into the format we are expecting
|
|
725
809
|
try {
|
|
726
|
-
return { kind:
|
|
810
|
+
return { kind: 'ok', data: response.data };
|
|
727
811
|
} catch {
|
|
728
|
-
return { kind:
|
|
812
|
+
return { kind: 'bad-data' };
|
|
729
813
|
}
|
|
730
814
|
}
|
|
731
815
|
|
|
@@ -735,18 +819,21 @@ export class Api {
|
|
|
735
819
|
|
|
736
820
|
async verifyOTP(params) {
|
|
737
821
|
// make the api call
|
|
738
|
-
const response: ApiResponse<any> = await this.apisauce.post(
|
|
822
|
+
const response: ApiResponse<any> = await this.apisauce.post(
|
|
823
|
+
`api/v1.0/security/verify_otp`,
|
|
824
|
+
params
|
|
825
|
+
);
|
|
739
826
|
// the typical ways to die when calling an api
|
|
740
827
|
if (!response.ok) {
|
|
741
|
-
const problem = getGeneralApiProblem(response)
|
|
742
|
-
if (problem) return problem
|
|
828
|
+
const problem = getGeneralApiProblem(response);
|
|
829
|
+
if (problem) return problem;
|
|
743
830
|
}
|
|
744
831
|
|
|
745
832
|
// transform the data into the format we are expecting
|
|
746
833
|
try {
|
|
747
|
-
return { kind:
|
|
834
|
+
return { kind: 'ok', data: response.data };
|
|
748
835
|
} catch {
|
|
749
|
-
return { kind:
|
|
836
|
+
return { kind: 'bad-data' };
|
|
750
837
|
}
|
|
751
838
|
}
|
|
752
839
|
|
|
@@ -756,18 +843,20 @@ export class Api {
|
|
|
756
843
|
|
|
757
844
|
async getBanks() {
|
|
758
845
|
// make the api call
|
|
759
|
-
const response: ApiResponse<any> = await this.apisauce.get(
|
|
846
|
+
const response: ApiResponse<any> = await this.apisauce.get(
|
|
847
|
+
`api/v1.0/lendingonline/get_bank`
|
|
848
|
+
);
|
|
760
849
|
// the typical ways to die when calling an api
|
|
761
850
|
if (!response.ok) {
|
|
762
|
-
const problem = getGeneralApiProblem(response)
|
|
763
|
-
if (problem) return problem
|
|
851
|
+
const problem = getGeneralApiProblem(response);
|
|
852
|
+
if (problem) return problem;
|
|
764
853
|
}
|
|
765
854
|
|
|
766
855
|
// transform the data into the format we are expecting
|
|
767
856
|
try {
|
|
768
|
-
return { kind:
|
|
857
|
+
return { kind: 'ok', data: response.data };
|
|
769
858
|
} catch {
|
|
770
|
-
return { kind:
|
|
859
|
+
return { kind: 'bad-data' };
|
|
771
860
|
}
|
|
772
861
|
}
|
|
773
862
|
|
|
@@ -777,19 +866,22 @@ export class Api {
|
|
|
777
866
|
|
|
778
867
|
async createLoan(params) {
|
|
779
868
|
// make the api call
|
|
780
|
-
const response: ApiResponse<any> = await this.apisauce.post(
|
|
781
|
-
|
|
869
|
+
const response: ApiResponse<any> = await this.apisauce.post(
|
|
870
|
+
`api/v1.0/lendingonline/init_loanbrief`,
|
|
871
|
+
params
|
|
872
|
+
);
|
|
873
|
+
myLog(response);
|
|
782
874
|
// the typical ways to die when calling an api
|
|
783
875
|
if (!response.ok) {
|
|
784
|
-
const problem = getGeneralApiProblem(response)
|
|
785
|
-
if (problem) return problem
|
|
876
|
+
const problem = getGeneralApiProblem(response);
|
|
877
|
+
if (problem) return problem;
|
|
786
878
|
}
|
|
787
879
|
|
|
788
880
|
// transform the data into the format we are expecting
|
|
789
881
|
try {
|
|
790
|
-
return { kind:
|
|
882
|
+
return { kind: 'ok', data: response.data };
|
|
791
883
|
} catch {
|
|
792
|
-
return { kind:
|
|
884
|
+
return { kind: 'bad-data' };
|
|
793
885
|
}
|
|
794
886
|
}
|
|
795
887
|
|
|
@@ -799,18 +891,21 @@ export class Api {
|
|
|
799
891
|
|
|
800
892
|
async getProvinces(params) {
|
|
801
893
|
// make the api call
|
|
802
|
-
const response: ApiResponse<any> = await this.apisauce.get(
|
|
894
|
+
const response: ApiResponse<any> = await this.apisauce.get(
|
|
895
|
+
`api/v1.0/landingpage/get_city_all`,
|
|
896
|
+
params
|
|
897
|
+
);
|
|
803
898
|
// the typical ways to die when calling an api
|
|
804
899
|
if (!response.ok) {
|
|
805
|
-
const problem = getGeneralApiProblem(response)
|
|
806
|
-
if (problem) return problem
|
|
900
|
+
const problem = getGeneralApiProblem(response);
|
|
901
|
+
if (problem) return problem;
|
|
807
902
|
}
|
|
808
903
|
|
|
809
904
|
// transform the data into the format we are expecting
|
|
810
905
|
try {
|
|
811
|
-
return { kind:
|
|
906
|
+
return { kind: 'ok', data: response.data };
|
|
812
907
|
} catch {
|
|
813
|
-
return { kind:
|
|
908
|
+
return { kind: 'bad-data' };
|
|
814
909
|
}
|
|
815
910
|
}
|
|
816
911
|
/**
|
|
@@ -819,18 +914,20 @@ export class Api {
|
|
|
819
914
|
|
|
820
915
|
async getDistricts(id) {
|
|
821
916
|
// make the api call
|
|
822
|
-
const response: ApiResponse<any> = await this.apisauce.get(
|
|
917
|
+
const response: ApiResponse<any> = await this.apisauce.get(
|
|
918
|
+
`api/v1.0/landingpage/get_district_all?provinceId=${id}`
|
|
919
|
+
);
|
|
823
920
|
// the typical ways to die when calling an api
|
|
824
921
|
if (!response.ok) {
|
|
825
|
-
const problem = getGeneralApiProblem(response)
|
|
826
|
-
if (problem) return problem
|
|
922
|
+
const problem = getGeneralApiProblem(response);
|
|
923
|
+
if (problem) return problem;
|
|
827
924
|
}
|
|
828
925
|
|
|
829
926
|
// transform the data into the format we are expecting
|
|
830
927
|
try {
|
|
831
|
-
return { kind:
|
|
928
|
+
return { kind: 'ok', data: response.data };
|
|
832
929
|
} catch {
|
|
833
|
-
return { kind:
|
|
930
|
+
return { kind: 'bad-data' };
|
|
834
931
|
}
|
|
835
932
|
}
|
|
836
933
|
|
|
@@ -840,18 +937,20 @@ export class Api {
|
|
|
840
937
|
|
|
841
938
|
async getWards(params) {
|
|
842
939
|
// make the api call
|
|
843
|
-
const response: ApiResponse<any> = await this.apisauce.get(
|
|
940
|
+
const response: ApiResponse<any> = await this.apisauce.get(
|
|
941
|
+
`api/v1.0/landingpage/get_ward_all?districtId=${params}`
|
|
942
|
+
);
|
|
844
943
|
// the typical ways to die when calling an api
|
|
845
944
|
if (!response.ok) {
|
|
846
|
-
const problem = getGeneralApiProblem(response)
|
|
847
|
-
if (problem) return problem
|
|
945
|
+
const problem = getGeneralApiProblem(response);
|
|
946
|
+
if (problem) return problem;
|
|
848
947
|
}
|
|
849
948
|
|
|
850
949
|
// transform the data into the format we are expecting
|
|
851
950
|
try {
|
|
852
|
-
return { kind:
|
|
951
|
+
return { kind: 'ok', data: response.data };
|
|
853
952
|
} catch {
|
|
854
|
-
return { kind:
|
|
953
|
+
return { kind: 'bad-data' };
|
|
855
954
|
}
|
|
856
955
|
}
|
|
857
956
|
|
|
@@ -861,19 +960,22 @@ export class Api {
|
|
|
861
960
|
|
|
862
961
|
async loanPurpose(params) {
|
|
863
962
|
// make the api call
|
|
864
|
-
const response: ApiResponse<any> = await this.apisauce.get(
|
|
865
|
-
|
|
963
|
+
const response: ApiResponse<any> = await this.apisauce.get(
|
|
964
|
+
`api/v1.0/lendingonline/get_loanpurpose`,
|
|
965
|
+
params
|
|
966
|
+
);
|
|
967
|
+
myLog(response);
|
|
866
968
|
// the typical ways to die when calling an api
|
|
867
969
|
if (!response.ok) {
|
|
868
|
-
const problem = getGeneralApiProblem(response)
|
|
869
|
-
if (problem) return problem
|
|
970
|
+
const problem = getGeneralApiProblem(response);
|
|
971
|
+
if (problem) return problem;
|
|
870
972
|
}
|
|
871
973
|
|
|
872
974
|
// transform the data into the format we are expecting
|
|
873
975
|
try {
|
|
874
|
-
return { kind:
|
|
976
|
+
return { kind: 'ok', data: response.data };
|
|
875
977
|
} catch {
|
|
876
|
-
return { kind:
|
|
978
|
+
return { kind: 'bad-data' };
|
|
877
979
|
}
|
|
878
980
|
}
|
|
879
981
|
|
|
@@ -883,18 +985,21 @@ export class Api {
|
|
|
883
985
|
|
|
884
986
|
async getJobs(params) {
|
|
885
987
|
// make the api call
|
|
886
|
-
const response: ApiResponse<any> = await this.apisauce.get(
|
|
988
|
+
const response: ApiResponse<any> = await this.apisauce.get(
|
|
989
|
+
`api/v1.0/lendingonline/get_job`,
|
|
990
|
+
params
|
|
991
|
+
);
|
|
887
992
|
// the typical ways to die when calling an api
|
|
888
993
|
if (!response.ok) {
|
|
889
|
-
const problem = getGeneralApiProblem(response)
|
|
890
|
-
if (problem) return problem
|
|
994
|
+
const problem = getGeneralApiProblem(response);
|
|
995
|
+
if (problem) return problem;
|
|
891
996
|
}
|
|
892
997
|
|
|
893
998
|
// transform the data into the format we are expecting
|
|
894
999
|
try {
|
|
895
|
-
return { kind:
|
|
1000
|
+
return { kind: 'ok', data: response.data };
|
|
896
1001
|
} catch {
|
|
897
|
-
return { kind:
|
|
1002
|
+
return { kind: 'bad-data' };
|
|
898
1003
|
}
|
|
899
1004
|
}
|
|
900
1005
|
|
|
@@ -904,18 +1009,21 @@ export class Api {
|
|
|
904
1009
|
|
|
905
1010
|
async getJobGroup(params) {
|
|
906
1011
|
// make the api call
|
|
907
|
-
const response: ApiResponse<any> = await this.apisauce.get(
|
|
1012
|
+
const response: ApiResponse<any> = await this.apisauce.get(
|
|
1013
|
+
`api/v1.0/lendingonline/get_job_by_group`,
|
|
1014
|
+
params
|
|
1015
|
+
);
|
|
908
1016
|
// the typical ways to die when calling an api
|
|
909
1017
|
if (!response.ok) {
|
|
910
|
-
const problem = getGeneralApiProblem(response)
|
|
911
|
-
if (problem) return problem
|
|
1018
|
+
const problem = getGeneralApiProblem(response);
|
|
1019
|
+
if (problem) return problem;
|
|
912
1020
|
}
|
|
913
1021
|
|
|
914
1022
|
// transform the data into the format we are expecting
|
|
915
1023
|
try {
|
|
916
|
-
return { kind:
|
|
1024
|
+
return { kind: 'ok', data: response.data };
|
|
917
1025
|
} catch {
|
|
918
|
-
return { kind:
|
|
1026
|
+
return { kind: 'bad-data' };
|
|
919
1027
|
}
|
|
920
1028
|
}
|
|
921
1029
|
|
|
@@ -925,19 +1033,22 @@ export class Api {
|
|
|
925
1033
|
|
|
926
1034
|
async updateLoan(params) {
|
|
927
1035
|
// make the api call
|
|
928
|
-
const response: ApiResponse<any> = await this.apisauce.post(
|
|
929
|
-
|
|
1036
|
+
const response: ApiResponse<any> = await this.apisauce.post(
|
|
1037
|
+
`api/v1.0/lendingonline/edit_loanbrief`,
|
|
1038
|
+
params
|
|
1039
|
+
);
|
|
1040
|
+
myLog(response);
|
|
930
1041
|
// the typical ways to die when calling an api
|
|
931
1042
|
if (!response.ok) {
|
|
932
|
-
const problem = getGeneralApiProblem(response)
|
|
933
|
-
if (problem) return problem
|
|
1043
|
+
const problem = getGeneralApiProblem(response);
|
|
1044
|
+
if (problem) return problem;
|
|
934
1045
|
}
|
|
935
1046
|
|
|
936
1047
|
// transform the data into the format we are expecting
|
|
937
1048
|
try {
|
|
938
|
-
return { kind:
|
|
1049
|
+
return { kind: 'ok', data: response.data };
|
|
939
1050
|
} catch {
|
|
940
|
-
return { kind:
|
|
1051
|
+
return { kind: 'bad-data' };
|
|
941
1052
|
}
|
|
942
1053
|
}
|
|
943
1054
|
|
|
@@ -947,18 +1058,21 @@ export class Api {
|
|
|
947
1058
|
|
|
948
1059
|
async visionVR(params, loanbriefId) {
|
|
949
1060
|
// make the api call
|
|
950
|
-
const response: ApiResponse<any> = await this.apisauce.post(
|
|
1061
|
+
const response: ApiResponse<any> = await this.apisauce.post(
|
|
1062
|
+
`api/v1.0/lendingonline/computer_vision_vr?loanbriefId=${loanbriefId}`,
|
|
1063
|
+
params
|
|
1064
|
+
);
|
|
951
1065
|
// the typical ways to die when calling an api
|
|
952
1066
|
if (!response.ok) {
|
|
953
|
-
const problem = getGeneralApiProblem(response)
|
|
954
|
-
if (problem) return problem
|
|
1067
|
+
const problem = getGeneralApiProblem(response);
|
|
1068
|
+
if (problem) return problem;
|
|
955
1069
|
}
|
|
956
1070
|
|
|
957
1071
|
// transform the data into the format we are expecting
|
|
958
1072
|
try {
|
|
959
|
-
return { kind:
|
|
1073
|
+
return { kind: 'ok', data: response.data };
|
|
960
1074
|
} catch {
|
|
961
|
-
return { kind:
|
|
1075
|
+
return { kind: 'bad-data' };
|
|
962
1076
|
}
|
|
963
1077
|
}
|
|
964
1078
|
|
|
@@ -968,23 +1082,27 @@ export class Api {
|
|
|
968
1082
|
|
|
969
1083
|
async ekycNationalCard(params, loanbriefId) {
|
|
970
1084
|
// make the api call
|
|
971
|
-
const response: ApiResponse<any> = await this.apisauce.post(
|
|
972
|
-
|
|
973
|
-
|
|
1085
|
+
const response: ApiResponse<any> = await this.apisauce.post(
|
|
1086
|
+
`api/v1.0/lendingonline/ekyc_national_card?loanbriefId=${loanbriefId}`,
|
|
1087
|
+
params,
|
|
1088
|
+
{
|
|
1089
|
+
headers: {
|
|
1090
|
+
'content-type': 'multipart/form-data',
|
|
1091
|
+
},
|
|
974
1092
|
}
|
|
975
|
-
|
|
976
|
-
myLog(response)
|
|
1093
|
+
);
|
|
1094
|
+
myLog(response);
|
|
977
1095
|
// the typical ways to die when calling an api
|
|
978
1096
|
if (!response.ok) {
|
|
979
|
-
const problem = getGeneralApiProblem(response)
|
|
980
|
-
if (problem) return problem
|
|
1097
|
+
const problem = getGeneralApiProblem(response);
|
|
1098
|
+
if (problem) return problem;
|
|
981
1099
|
}
|
|
982
1100
|
|
|
983
1101
|
// transform the data into the format we are expecting
|
|
984
1102
|
try {
|
|
985
|
-
return { kind:
|
|
1103
|
+
return { kind: 'ok', data: response.data };
|
|
986
1104
|
} catch {
|
|
987
|
-
return { kind:
|
|
1105
|
+
return { kind: 'bad-data' };
|
|
988
1106
|
}
|
|
989
1107
|
}
|
|
990
1108
|
|
|
@@ -994,19 +1112,22 @@ export class Api {
|
|
|
994
1112
|
|
|
995
1113
|
async checkLocation(params) {
|
|
996
1114
|
// make the api call
|
|
997
|
-
const response: ApiResponse<any> = await this.apisauce.get(
|
|
998
|
-
|
|
1115
|
+
const response: ApiResponse<any> = await this.apisauce.get(
|
|
1116
|
+
`api/v1.0/lendingonline/check_location`,
|
|
1117
|
+
params
|
|
1118
|
+
);
|
|
1119
|
+
myLog(response);
|
|
999
1120
|
// the typical ways to die when calling an api
|
|
1000
1121
|
if (!response.ok) {
|
|
1001
|
-
const problem = getGeneralApiProblem(response)
|
|
1002
|
-
if (problem) return problem
|
|
1122
|
+
const problem = getGeneralApiProblem(response);
|
|
1123
|
+
if (problem) return problem;
|
|
1003
1124
|
}
|
|
1004
1125
|
|
|
1005
1126
|
// transform the data into the format we are expecting
|
|
1006
1127
|
try {
|
|
1007
|
-
return { kind:
|
|
1128
|
+
return { kind: 'ok', data: response.data };
|
|
1008
1129
|
} catch {
|
|
1009
|
-
return { kind:
|
|
1130
|
+
return { kind: 'bad-data' };
|
|
1010
1131
|
}
|
|
1011
1132
|
}
|
|
1012
1133
|
|
|
@@ -1016,19 +1137,22 @@ export class Api {
|
|
|
1016
1137
|
|
|
1017
1138
|
async sendRequestCAC(params) {
|
|
1018
1139
|
// make the api call
|
|
1019
|
-
const response: ApiResponse<any> = await this.apisauce.post(
|
|
1020
|
-
|
|
1140
|
+
const response: ApiResponse<any> = await this.apisauce.post(
|
|
1141
|
+
`api/v1.0/lendingonline/send_request_location`,
|
|
1142
|
+
params
|
|
1143
|
+
);
|
|
1144
|
+
myLog(response);
|
|
1021
1145
|
// the typical ways to die when calling an api
|
|
1022
1146
|
if (!response.ok) {
|
|
1023
|
-
const problem = getGeneralApiProblem(response)
|
|
1024
|
-
if (problem) return problem
|
|
1147
|
+
const problem = getGeneralApiProblem(response);
|
|
1148
|
+
if (problem) return problem;
|
|
1025
1149
|
}
|
|
1026
1150
|
|
|
1027
1151
|
// transform the data into the format we are expecting
|
|
1028
1152
|
try {
|
|
1029
|
-
return { kind:
|
|
1153
|
+
return { kind: 'ok', data: response.data };
|
|
1030
1154
|
} catch {
|
|
1031
|
-
return { kind:
|
|
1155
|
+
return { kind: 'bad-data' };
|
|
1032
1156
|
}
|
|
1033
1157
|
}
|
|
1034
1158
|
|
|
@@ -1038,19 +1162,22 @@ export class Api {
|
|
|
1038
1162
|
|
|
1039
1163
|
async fraudCheck(params) {
|
|
1040
1164
|
// make the api call
|
|
1041
|
-
const response: ApiResponse<any> = await this.apisauce.get(
|
|
1042
|
-
|
|
1165
|
+
const response: ApiResponse<any> = await this.apisauce.get(
|
|
1166
|
+
`api/v1.0/lendingonline/result_fraud_detection`,
|
|
1167
|
+
params
|
|
1168
|
+
);
|
|
1169
|
+
myLog(response);
|
|
1043
1170
|
// the typical ways to die when calling an api
|
|
1044
1171
|
if (!response.ok) {
|
|
1045
|
-
const problem = getGeneralApiProblem(response)
|
|
1046
|
-
if (problem) return problem
|
|
1172
|
+
const problem = getGeneralApiProblem(response);
|
|
1173
|
+
if (problem) return problem;
|
|
1047
1174
|
}
|
|
1048
1175
|
|
|
1049
1176
|
// transform the data into the format we are expecting
|
|
1050
1177
|
try {
|
|
1051
|
-
return { kind:
|
|
1178
|
+
return { kind: 'ok', data: response.data };
|
|
1052
1179
|
} catch {
|
|
1053
|
-
return { kind:
|
|
1180
|
+
return { kind: 'bad-data' };
|
|
1054
1181
|
}
|
|
1055
1182
|
}
|
|
1056
1183
|
|
|
@@ -1060,19 +1187,22 @@ export class Api {
|
|
|
1060
1187
|
|
|
1061
1188
|
async loanInfo(params) {
|
|
1062
1189
|
// make the api call
|
|
1063
|
-
const response: ApiResponse<any> = await this.apisauce.get(
|
|
1064
|
-
|
|
1190
|
+
const response: ApiResponse<any> = await this.apisauce.get(
|
|
1191
|
+
`api/v1.0/timacare/get_loan_by_phone`,
|
|
1192
|
+
params
|
|
1193
|
+
);
|
|
1194
|
+
myLog(response);
|
|
1065
1195
|
// the typical ways to die when calling an api
|
|
1066
1196
|
if (!response.ok) {
|
|
1067
|
-
const problem = getGeneralApiProblem(response)
|
|
1068
|
-
if (problem) return problem
|
|
1197
|
+
const problem = getGeneralApiProblem(response);
|
|
1198
|
+
if (problem) return problem;
|
|
1069
1199
|
}
|
|
1070
1200
|
|
|
1071
1201
|
// transform the data into the format we are expecting
|
|
1072
1202
|
try {
|
|
1073
|
-
return { kind:
|
|
1203
|
+
return { kind: 'ok', data: response.data };
|
|
1074
1204
|
} catch {
|
|
1075
|
-
return { kind:
|
|
1205
|
+
return { kind: 'bad-data' };
|
|
1076
1206
|
}
|
|
1077
1207
|
}
|
|
1078
1208
|
|
|
@@ -1082,27 +1212,25 @@ export class Api {
|
|
|
1082
1212
|
|
|
1083
1213
|
async getTopicFirebaseSubscribed(tokenFCM) {
|
|
1084
1214
|
// make the api call
|
|
1085
|
-
const response: ApiResponse<any> = await create({
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
{
|
|
1089
|
-
|
|
1090
|
-
Authorization: `key=${keyFirebase}`,
|
|
1091
|
-
},
|
|
1215
|
+
const response: ApiResponse<any> = await create({
|
|
1216
|
+
baseURL: 'https://iid.googleapis.com',
|
|
1217
|
+
}).post(`/iid/info/${tokenFCM}?details=true`, null, {
|
|
1218
|
+
headers: {
|
|
1219
|
+
Authorization: `key=${keyFirebase}`,
|
|
1092
1220
|
},
|
|
1093
|
-
)
|
|
1094
|
-
myLog(response)
|
|
1221
|
+
});
|
|
1222
|
+
myLog(response);
|
|
1095
1223
|
// the typical ways to die when calling an api
|
|
1096
1224
|
if (!response.ok) {
|
|
1097
|
-
const problem = getGeneralApiProblem(response)
|
|
1098
|
-
if (problem) return problem
|
|
1225
|
+
const problem = getGeneralApiProblem(response);
|
|
1226
|
+
if (problem) return problem;
|
|
1099
1227
|
}
|
|
1100
1228
|
|
|
1101
1229
|
// transform the data into the format we are expecting
|
|
1102
1230
|
try {
|
|
1103
|
-
return { kind:
|
|
1231
|
+
return { kind: 'ok', data: response.data };
|
|
1104
1232
|
} catch {
|
|
1105
|
-
return { kind:
|
|
1233
|
+
return { kind: 'bad-data' };
|
|
1106
1234
|
}
|
|
1107
1235
|
}
|
|
1108
1236
|
|
|
@@ -1112,27 +1240,25 @@ export class Api {
|
|
|
1112
1240
|
|
|
1113
1241
|
async subscribeTopicFirebase(tokenFCM, topic) {
|
|
1114
1242
|
// make the api call
|
|
1115
|
-
const response: ApiResponse<any> = await create({
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
{
|
|
1119
|
-
|
|
1120
|
-
Authorization: `key=${keyFirebase}`,
|
|
1121
|
-
},
|
|
1243
|
+
const response: ApiResponse<any> = await create({
|
|
1244
|
+
baseURL: 'https://iid.googleapis.com',
|
|
1245
|
+
}).post(`/iid/v1/${tokenFCM}/rel/topics/${topic}`, null, {
|
|
1246
|
+
headers: {
|
|
1247
|
+
Authorization: `key=${keyFirebase}`,
|
|
1122
1248
|
},
|
|
1123
|
-
)
|
|
1124
|
-
myLog(response)
|
|
1249
|
+
});
|
|
1250
|
+
myLog(response);
|
|
1125
1251
|
// the typical ways to die when calling an api
|
|
1126
1252
|
if (!response.ok) {
|
|
1127
|
-
const problem = getGeneralApiProblem(response)
|
|
1128
|
-
if (problem) return problem
|
|
1253
|
+
const problem = getGeneralApiProblem(response);
|
|
1254
|
+
if (problem) return problem;
|
|
1129
1255
|
}
|
|
1130
1256
|
|
|
1131
1257
|
// transform the data into the format we are expecting
|
|
1132
1258
|
try {
|
|
1133
|
-
return { kind:
|
|
1259
|
+
return { kind: 'ok', data: response.data };
|
|
1134
1260
|
} catch {
|
|
1135
|
-
return { kind:
|
|
1261
|
+
return { kind: 'bad-data' };
|
|
1136
1262
|
}
|
|
1137
1263
|
}
|
|
1138
1264
|
|
|
@@ -1142,7 +1268,9 @@ export class Api {
|
|
|
1142
1268
|
|
|
1143
1269
|
async unSubscribeTopicFirebase(tokenFCM, topic) {
|
|
1144
1270
|
// make the api call
|
|
1145
|
-
const response: ApiResponse<any> = await create({
|
|
1271
|
+
const response: ApiResponse<any> = await create({
|
|
1272
|
+
baseURL: 'https://iid.googleapis.com',
|
|
1273
|
+
}).post(
|
|
1146
1274
|
'/iid/v1:batchRemove',
|
|
1147
1275
|
{
|
|
1148
1276
|
to: `/topics/${topic}`,
|
|
@@ -1152,20 +1280,20 @@ export class Api {
|
|
|
1152
1280
|
headers: {
|
|
1153
1281
|
Authorization: `key=${keyFirebase}`,
|
|
1154
1282
|
},
|
|
1155
|
-
}
|
|
1156
|
-
)
|
|
1157
|
-
myLog(response)
|
|
1283
|
+
}
|
|
1284
|
+
);
|
|
1285
|
+
myLog(response);
|
|
1158
1286
|
// the typical ways to die when calling an api
|
|
1159
1287
|
if (!response.ok) {
|
|
1160
|
-
const problem = getGeneralApiProblem(response)
|
|
1161
|
-
if (problem) return problem
|
|
1288
|
+
const problem = getGeneralApiProblem(response);
|
|
1289
|
+
if (problem) return problem;
|
|
1162
1290
|
}
|
|
1163
1291
|
|
|
1164
1292
|
// transform the data into the format we are expecting
|
|
1165
1293
|
try {
|
|
1166
|
-
return { kind:
|
|
1294
|
+
return { kind: 'ok', data: response.data };
|
|
1167
1295
|
} catch {
|
|
1168
|
-
return { kind:
|
|
1296
|
+
return { kind: 'bad-data' };
|
|
1169
1297
|
}
|
|
1170
1298
|
}
|
|
1171
1299
|
|
|
@@ -1175,19 +1303,22 @@ export class Api {
|
|
|
1175
1303
|
|
|
1176
1304
|
async schedulePayment(params) {
|
|
1177
1305
|
// make the api call
|
|
1178
|
-
const response: ApiResponse<any> = await this.apisauce.get(
|
|
1179
|
-
|
|
1306
|
+
const response: ApiResponse<any> = await this.apisauce.get(
|
|
1307
|
+
`api/v1.0/lendingonline/schedule_payment`,
|
|
1308
|
+
params
|
|
1309
|
+
);
|
|
1310
|
+
myLog(response);
|
|
1180
1311
|
// the typical ways to die when calling an api
|
|
1181
1312
|
if (!response.ok) {
|
|
1182
|
-
const problem = getGeneralApiProblem(response)
|
|
1183
|
-
if (problem) return problem
|
|
1313
|
+
const problem = getGeneralApiProblem(response);
|
|
1314
|
+
if (problem) return problem;
|
|
1184
1315
|
}
|
|
1185
1316
|
|
|
1186
1317
|
// transform the data into the format we are expecting
|
|
1187
1318
|
try {
|
|
1188
|
-
return { kind:
|
|
1319
|
+
return { kind: 'ok', data: response.data };
|
|
1189
1320
|
} catch {
|
|
1190
|
-
return { kind:
|
|
1321
|
+
return { kind: 'bad-data' };
|
|
1191
1322
|
}
|
|
1192
1323
|
}
|
|
1193
1324
|
|
|
@@ -1197,19 +1328,22 @@ export class Api {
|
|
|
1197
1328
|
|
|
1198
1329
|
async signContractForBorrower(params) {
|
|
1199
1330
|
// make the api call
|
|
1200
|
-
const response: ApiResponse<any> = await this.apisauce.post(
|
|
1201
|
-
|
|
1331
|
+
const response: ApiResponse<any> = await this.apisauce.post(
|
|
1332
|
+
`api/v1.0/esign/SignContractForBorrower`,
|
|
1333
|
+
params
|
|
1334
|
+
);
|
|
1335
|
+
myLog(response);
|
|
1202
1336
|
// the typical ways to die when calling an api
|
|
1203
1337
|
if (!response.ok) {
|
|
1204
|
-
const problem = getGeneralApiProblem(response)
|
|
1205
|
-
if (problem) return problem
|
|
1338
|
+
const problem = getGeneralApiProblem(response);
|
|
1339
|
+
if (problem) return problem;
|
|
1206
1340
|
}
|
|
1207
1341
|
|
|
1208
1342
|
// transform the data into the format we are expecting
|
|
1209
1343
|
try {
|
|
1210
|
-
return { kind:
|
|
1344
|
+
return { kind: 'ok', data: response.data };
|
|
1211
1345
|
} catch {
|
|
1212
|
-
return { kind:
|
|
1346
|
+
return { kind: 'bad-data' };
|
|
1213
1347
|
}
|
|
1214
1348
|
}
|
|
1215
1349
|
|
|
@@ -1219,19 +1353,22 @@ export class Api {
|
|
|
1219
1353
|
|
|
1220
1354
|
async confirmSignContractForBorrower(params) {
|
|
1221
1355
|
// make the api call
|
|
1222
|
-
const response: ApiResponse<any> = await this.apisauce.post(
|
|
1223
|
-
|
|
1356
|
+
const response: ApiResponse<any> = await this.apisauce.post(
|
|
1357
|
+
`api/v1.0/esign/ConfirmSignContractForBorrower`,
|
|
1358
|
+
params
|
|
1359
|
+
);
|
|
1360
|
+
myLog(response);
|
|
1224
1361
|
// the typical ways to die when calling an api
|
|
1225
1362
|
if (!response.ok) {
|
|
1226
|
-
const problem = getGeneralApiProblem(response)
|
|
1227
|
-
if (problem) return problem
|
|
1363
|
+
const problem = getGeneralApiProblem(response);
|
|
1364
|
+
if (problem) return problem;
|
|
1228
1365
|
}
|
|
1229
1366
|
|
|
1230
1367
|
// transform the data into the format we are expecting
|
|
1231
1368
|
try {
|
|
1232
|
-
return { kind:
|
|
1369
|
+
return { kind: 'ok', data: response.data };
|
|
1233
1370
|
} catch {
|
|
1234
|
-
return { kind:
|
|
1371
|
+
return { kind: 'bad-data' };
|
|
1235
1372
|
}
|
|
1236
1373
|
}
|
|
1237
1374
|
|
|
@@ -1241,19 +1378,22 @@ export class Api {
|
|
|
1241
1378
|
|
|
1242
1379
|
async checkValidateESign(params) {
|
|
1243
1380
|
// make the api call
|
|
1244
|
-
const response: ApiResponse<any> = await this.apisauce.get(
|
|
1245
|
-
|
|
1381
|
+
const response: ApiResponse<any> = await this.apisauce.get(
|
|
1382
|
+
`api/v1.0/timacare/check_validate_esign`,
|
|
1383
|
+
params
|
|
1384
|
+
);
|
|
1385
|
+
myLog(response);
|
|
1246
1386
|
// the typical ways to die when calling an api
|
|
1247
1387
|
if (!response.ok) {
|
|
1248
|
-
const problem = getGeneralApiProblem(response)
|
|
1249
|
-
if (problem) return problem
|
|
1388
|
+
const problem = getGeneralApiProblem(response);
|
|
1389
|
+
if (problem) return problem;
|
|
1250
1390
|
}
|
|
1251
1391
|
|
|
1252
1392
|
// transform the data into the format we are expecting
|
|
1253
1393
|
try {
|
|
1254
|
-
return { kind:
|
|
1394
|
+
return { kind: 'ok', data: response.data };
|
|
1255
1395
|
} catch {
|
|
1256
|
-
return { kind:
|
|
1396
|
+
return { kind: 'bad-data' };
|
|
1257
1397
|
}
|
|
1258
1398
|
}
|
|
1259
1399
|
|
|
@@ -1263,19 +1403,22 @@ export class Api {
|
|
|
1263
1403
|
|
|
1264
1404
|
async eSignSendOTP(params) {
|
|
1265
1405
|
// make the api call
|
|
1266
|
-
const response: ApiResponse<any> = await this.apisauce.post(
|
|
1267
|
-
|
|
1406
|
+
const response: ApiResponse<any> = await this.apisauce.post(
|
|
1407
|
+
`api/v1.0/esign/SendOTP`,
|
|
1408
|
+
params
|
|
1409
|
+
);
|
|
1410
|
+
myLog(response);
|
|
1268
1411
|
// the typical ways to die when calling an api
|
|
1269
1412
|
if (!response.ok) {
|
|
1270
|
-
const problem = getGeneralApiProblem(response)
|
|
1271
|
-
if (problem) return problem
|
|
1413
|
+
const problem = getGeneralApiProblem(response);
|
|
1414
|
+
if (problem) return problem;
|
|
1272
1415
|
}
|
|
1273
1416
|
|
|
1274
1417
|
// transform the data into the format we are expecting
|
|
1275
1418
|
try {
|
|
1276
|
-
return { kind:
|
|
1419
|
+
return { kind: 'ok', data: response.data };
|
|
1277
1420
|
} catch {
|
|
1278
|
-
return { kind:
|
|
1421
|
+
return { kind: 'bad-data' };
|
|
1279
1422
|
}
|
|
1280
1423
|
}
|
|
1281
1424
|
|
|
@@ -1285,19 +1428,22 @@ export class Api {
|
|
|
1285
1428
|
|
|
1286
1429
|
async checkEKYC(params) {
|
|
1287
1430
|
// make the api call
|
|
1288
|
-
const response: ApiResponse<any> = await this.apisauce.get(
|
|
1289
|
-
|
|
1431
|
+
const response: ApiResponse<any> = await this.apisauce.get(
|
|
1432
|
+
`api/v1.0/timacare/check_ekyc_ai`,
|
|
1433
|
+
params
|
|
1434
|
+
);
|
|
1435
|
+
myLog(response);
|
|
1290
1436
|
// the typical ways to die when calling an api
|
|
1291
1437
|
if (!response.ok) {
|
|
1292
|
-
const problem = getGeneralApiProblem(response)
|
|
1293
|
-
if (problem) return problem
|
|
1438
|
+
const problem = getGeneralApiProblem(response);
|
|
1439
|
+
if (problem) return problem;
|
|
1294
1440
|
}
|
|
1295
1441
|
|
|
1296
1442
|
// transform the data into the format we are expecting
|
|
1297
1443
|
try {
|
|
1298
|
-
return { kind:
|
|
1444
|
+
return { kind: 'ok', data: response.data };
|
|
1299
1445
|
} catch {
|
|
1300
|
-
return { kind:
|
|
1446
|
+
return { kind: 'bad-data' };
|
|
1301
1447
|
}
|
|
1302
1448
|
}
|
|
1303
1449
|
|
|
@@ -1307,24 +1453,27 @@ export class Api {
|
|
|
1307
1453
|
|
|
1308
1454
|
async uploadImage(body) {
|
|
1309
1455
|
// make the api call
|
|
1310
|
-
const response: ApiResponse<any> = await this.apisauce.post(
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1456
|
+
const response: ApiResponse<any> = await this.apisauce.post(
|
|
1457
|
+
`api/v1.0/file/upload_image`,
|
|
1458
|
+
body,
|
|
1459
|
+
{
|
|
1460
|
+
headers: {
|
|
1461
|
+
'Content-Type': 'multipart/form-data',
|
|
1462
|
+
},
|
|
1463
|
+
}
|
|
1464
|
+
);
|
|
1465
|
+
myLog(response);
|
|
1317
1466
|
// the typical ways to die when calling an api
|
|
1318
1467
|
if (!response.ok) {
|
|
1319
|
-
const problem = getGeneralApiProblem(response)
|
|
1320
|
-
if (problem) return problem
|
|
1468
|
+
const problem = getGeneralApiProblem(response);
|
|
1469
|
+
if (problem) return problem;
|
|
1321
1470
|
}
|
|
1322
1471
|
|
|
1323
1472
|
// transform the data into the format we are expecting
|
|
1324
1473
|
try {
|
|
1325
|
-
return { kind:
|
|
1474
|
+
return { kind: 'ok', data: response.data };
|
|
1326
1475
|
} catch {
|
|
1327
|
-
return { kind:
|
|
1476
|
+
return { kind: 'bad-data' };
|
|
1328
1477
|
}
|
|
1329
1478
|
}
|
|
1330
1479
|
|
|
@@ -1334,13 +1483,17 @@ export class Api {
|
|
|
1334
1483
|
|
|
1335
1484
|
async uploadLiveness(params) {
|
|
1336
1485
|
// make the api call
|
|
1337
|
-
const response: ApiResponse<any> = await this.apisauce.post(
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1486
|
+
const response: ApiResponse<any> = await this.apisauce.post(
|
|
1487
|
+
`api/v1.0/timacare/CheckLivenessBase64`,
|
|
1488
|
+
params,
|
|
1489
|
+
{
|
|
1490
|
+
// headers: {
|
|
1491
|
+
// 'Content-Type': 'multipart/form-data',
|
|
1492
|
+
// Accept: "application/json",
|
|
1493
|
+
// // Authorization: 'Bearer eyJhbGciOiJIUzUxMiJ9.eyJzdWIiOiJpdC1jdi10ZXN0IiwiYXV0aG9yaXRpZXMiOlsiUk9MRV9DVl9URVNUX0VLWUNfVjEiLCJST0xFX0NWX1RFU1RfRUtZQ19WMiIsIlJPTEVfQ1ZfVEVTVF9GQUNFX0xJVkVORVNTIiwiUk9MRV9DVl9URVNUX09DUl9JRCJdLCJpYXQiOjE2Mjg0OTMyODd9.ydNZhJa01devbUOdHCcUp_PHJvNanaHVJ3Qvi2N0mQh86tHdhP1Swy-dGWc43IlQU6qQMUTvktHEWfKyoJBi8A'
|
|
1494
|
+
// },
|
|
1495
|
+
}
|
|
1496
|
+
);
|
|
1344
1497
|
//
|
|
1345
1498
|
// const response: ApiResponse<any> = await this.apisauce.post(`https://gateway.tima-ai.dev/computer-vision-test/image/face/liveness`, params, {
|
|
1346
1499
|
// headers: {
|
|
@@ -1349,18 +1502,18 @@ export class Api {
|
|
|
1349
1502
|
// Authorization: 'Bearer eyJhbGciOiJIUzUxMiJ9.eyJzdWIiOiJpdC1jdi10ZXN0IiwiYXV0aG9yaXRpZXMiOlsiUk9MRV9DVl9URVNUX0VLWUNfVjEiLCJST0xFX0NWX1RFU1RfRUtZQ19WMiIsIlJPTEVfQ1ZfVEVTVF9GQUNFX0xJVkVORVNTIiwiUk9MRV9DVl9URVNUX09DUl9JRCIsIlJPTEVfRUtZQ19PQ1JfVEVTVCJdLCJpYXQiOjE2Mjg1MDQ1OTl9.7A6L4TfltKnLvHfaROjRPhUayLdIYYDhb4zv97BuHZB8EsnHWun0SzT9QAaOhK3HlZ2lgGO2S_8YRJk2jEHzxA'
|
|
1350
1503
|
// },
|
|
1351
1504
|
// })
|
|
1352
|
-
myLog(response)
|
|
1505
|
+
myLog(response);
|
|
1353
1506
|
// the typical ways to die when calling an api
|
|
1354
1507
|
if (!response.ok) {
|
|
1355
|
-
const problem = getGeneralApiProblem(response)
|
|
1356
|
-
if (problem) return problem
|
|
1508
|
+
const problem = getGeneralApiProblem(response);
|
|
1509
|
+
if (problem) return problem;
|
|
1357
1510
|
}
|
|
1358
1511
|
|
|
1359
1512
|
// transform the data into the format we are expecting
|
|
1360
1513
|
try {
|
|
1361
|
-
return { kind:
|
|
1514
|
+
return { kind: 'ok', data: response.data };
|
|
1362
1515
|
} catch {
|
|
1363
|
-
return { kind:
|
|
1516
|
+
return { kind: 'bad-data' };
|
|
1364
1517
|
}
|
|
1365
1518
|
}
|
|
1366
1519
|
|
|
@@ -1370,1365 +1523,1553 @@ export class Api {
|
|
|
1370
1523
|
|
|
1371
1524
|
async checkVerifyImage(params) {
|
|
1372
1525
|
// make the api call
|
|
1373
|
-
const response: ApiResponse<any> = await this.apisauce.get(
|
|
1526
|
+
const response: ApiResponse<any> = await this.apisauce.get(
|
|
1527
|
+
'api/v1.0/timacare/check_verify_image',
|
|
1528
|
+
params,
|
|
1529
|
+
{}
|
|
1530
|
+
);
|
|
1374
1531
|
// the typical ways to die when calling an api
|
|
1375
1532
|
if (!response.ok) {
|
|
1376
|
-
const problem = getGeneralApiProblem(response)
|
|
1377
|
-
if (problem) return problem
|
|
1533
|
+
const problem = getGeneralApiProblem(response);
|
|
1534
|
+
if (problem) return problem;
|
|
1378
1535
|
}
|
|
1379
1536
|
|
|
1380
1537
|
// transform the data into the format we are expecting
|
|
1381
1538
|
try {
|
|
1382
|
-
return { kind:
|
|
1539
|
+
return { kind: 'ok', data: response.data };
|
|
1383
1540
|
} catch {
|
|
1384
|
-
return { kind:
|
|
1541
|
+
return { kind: 'bad-data' };
|
|
1385
1542
|
}
|
|
1386
1543
|
}
|
|
1387
1544
|
|
|
1388
1545
|
async checkSelfieImage(params, loanbriefId) {
|
|
1389
1546
|
// make the api call
|
|
1390
|
-
const response: ApiResponse<any> = await this.apisauce.post(
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1547
|
+
const response: ApiResponse<any> = await this.apisauce.post(
|
|
1548
|
+
`api/v1.0/timacare/CompareFaceNationalCard?loanbriefId=${loanbriefId}`,
|
|
1549
|
+
params,
|
|
1550
|
+
{
|
|
1551
|
+
headers: { 'Content-Type': 'multipart/form-data' },
|
|
1552
|
+
}
|
|
1553
|
+
);
|
|
1394
1554
|
// the typical ways to die when calling an api
|
|
1395
1555
|
if (!response.ok) {
|
|
1396
|
-
const problem = getGeneralApiProblem(response)
|
|
1397
|
-
if (problem) return problem
|
|
1556
|
+
const problem = getGeneralApiProblem(response);
|
|
1557
|
+
if (problem) return problem;
|
|
1398
1558
|
}
|
|
1399
1559
|
|
|
1400
1560
|
// transform the data into the format we are expecting
|
|
1401
1561
|
try {
|
|
1402
|
-
return { kind:
|
|
1562
|
+
return { kind: 'ok', data: response.data };
|
|
1403
1563
|
} catch {
|
|
1404
|
-
return { kind:
|
|
1564
|
+
return { kind: 'bad-data' };
|
|
1405
1565
|
}
|
|
1406
1566
|
}
|
|
1407
1567
|
|
|
1408
1568
|
async uploadVideo(loanbriefId, body) {
|
|
1409
1569
|
// make the api call
|
|
1410
|
-
const response: ApiResponse<any> = await this.apisauce.post(
|
|
1570
|
+
const response: ApiResponse<any> = await this.apisauce.post(
|
|
1571
|
+
`api/v1.0/timacare/UploadVideoLiveness?loanbriefId=${loanbriefId}`,
|
|
1572
|
+
body,
|
|
1573
|
+
{ headers: { 'Content-Type': 'multipart/form-data' } }
|
|
1574
|
+
);
|
|
1411
1575
|
// the typical ways to die when calling an api
|
|
1412
1576
|
if (!response.ok) {
|
|
1413
|
-
const problem = getGeneralApiProblem(response)
|
|
1414
|
-
if (problem) return problem
|
|
1577
|
+
const problem = getGeneralApiProblem(response);
|
|
1578
|
+
if (problem) return problem;
|
|
1415
1579
|
}
|
|
1416
1580
|
|
|
1417
1581
|
// transform the data into the format we are expecting
|
|
1418
1582
|
try {
|
|
1419
|
-
return { kind:
|
|
1583
|
+
return { kind: 'ok', data: response.data };
|
|
1420
1584
|
} catch {
|
|
1421
|
-
return { kind:
|
|
1585
|
+
return { kind: 'bad-data' };
|
|
1422
1586
|
}
|
|
1423
1587
|
}
|
|
1424
1588
|
|
|
1425
1589
|
async renderContract(loanbriefId) {
|
|
1426
1590
|
// make the api call
|
|
1427
1591
|
//http://42.112.27.64:8877
|
|
1428
|
-
const response: ApiResponse<any> = await axios.get(
|
|
1592
|
+
const response: ApiResponse<any> = await axios.get(
|
|
1593
|
+
`http://42.112.27.64:6677/api/v1.0/timacare/get_contract_financial_agreement_base64?loanbriefId=${loanbriefId}`
|
|
1594
|
+
);
|
|
1429
1595
|
|
|
1430
1596
|
// the typical ways to die when calling an api
|
|
1431
1597
|
if (!response.ok) {
|
|
1432
|
-
const problem = getGeneralApiProblem(response)
|
|
1433
|
-
if (problem) return problem
|
|
1598
|
+
const problem = getGeneralApiProblem(response);
|
|
1599
|
+
if (problem) return problem;
|
|
1434
1600
|
}
|
|
1435
1601
|
|
|
1436
1602
|
// transform the data into the format we are expecting
|
|
1437
1603
|
try {
|
|
1438
|
-
return { kind:
|
|
1604
|
+
return { kind: 'ok', data: response.data };
|
|
1439
1605
|
} catch {
|
|
1440
|
-
return { kind:
|
|
1606
|
+
return { kind: 'bad-data' };
|
|
1441
1607
|
}
|
|
1442
1608
|
}
|
|
1443
1609
|
|
|
1444
1610
|
async checkQualifyLoanbriefId(loanbriefId) {
|
|
1445
|
-
const response: ApiResponse<any> = await this.apisauce.get(
|
|
1611
|
+
const response: ApiResponse<any> = await this.apisauce.get(
|
|
1612
|
+
`api/v1.0/TimaCare/check_verify_qualify?loanbriefId=${loanbriefId}`
|
|
1613
|
+
);
|
|
1446
1614
|
console.log('check qualify', response);
|
|
1447
1615
|
|
|
1448
|
-
|
|
1449
1616
|
// the typical ways to die when calling an api
|
|
1450
1617
|
if (!response.ok) {
|
|
1451
|
-
const problem = getGeneralApiProblem(response)
|
|
1452
|
-
if (problem) return problem
|
|
1618
|
+
const problem = getGeneralApiProblem(response);
|
|
1619
|
+
if (problem) return problem;
|
|
1453
1620
|
}
|
|
1454
1621
|
|
|
1455
1622
|
// transform the data into the format we are expecting
|
|
1456
1623
|
try {
|
|
1457
|
-
return { kind:
|
|
1624
|
+
return { kind: 'ok', data: response.data };
|
|
1458
1625
|
} catch {
|
|
1459
|
-
return { kind:
|
|
1626
|
+
return { kind: 'bad-data' };
|
|
1460
1627
|
}
|
|
1461
1628
|
}
|
|
1462
1629
|
|
|
1463
1630
|
async postQualifyLoanbriefId(body) {
|
|
1464
|
-
const response: ApiResponse<any> = await this.apisauce.post(
|
|
1631
|
+
const response: ApiResponse<any> = await this.apisauce.post(
|
|
1632
|
+
`api/v1.0/TimaCare/confirm_verify_qualify`,
|
|
1633
|
+
body
|
|
1634
|
+
);
|
|
1465
1635
|
console.log('send qualify', response);
|
|
1466
1636
|
// the typical ways to die when calling an api
|
|
1467
1637
|
if (!response.ok) {
|
|
1468
|
-
const problem = getGeneralApiProblem(response)
|
|
1469
|
-
if (problem) return problem
|
|
1638
|
+
const problem = getGeneralApiProblem(response);
|
|
1639
|
+
if (problem) return problem;
|
|
1470
1640
|
}
|
|
1471
1641
|
|
|
1472
1642
|
// transform the data into the format we are expecting
|
|
1473
1643
|
try {
|
|
1474
|
-
return { kind:
|
|
1644
|
+
return { kind: 'ok', data: response.data };
|
|
1475
1645
|
} catch {
|
|
1476
|
-
return { kind:
|
|
1646
|
+
return { kind: 'bad-data' };
|
|
1477
1647
|
}
|
|
1478
1648
|
}
|
|
1479
1649
|
|
|
1480
1650
|
async getOptV2(phone, type) {
|
|
1481
|
-
const response: ApiResponse<any> = await this.apisauce.get(
|
|
1651
|
+
const response: ApiResponse<any> = await this.apisauce.get(
|
|
1652
|
+
`api/v1.0/security/get_otp_v2?phone=${phone}&type=${type}`
|
|
1653
|
+
);
|
|
1482
1654
|
console.log('get otp', response);
|
|
1483
1655
|
// the typical ways to die when calling an api
|
|
1484
1656
|
if (!response.ok) {
|
|
1485
|
-
const problem = getGeneralApiProblem(response)
|
|
1486
|
-
if (problem) return problem
|
|
1657
|
+
const problem = getGeneralApiProblem(response);
|
|
1658
|
+
if (problem) return problem;
|
|
1487
1659
|
}
|
|
1488
1660
|
|
|
1489
1661
|
// transform the data into the format we are expecting
|
|
1490
1662
|
try {
|
|
1491
|
-
return { kind:
|
|
1663
|
+
return { kind: 'ok', data: response.data };
|
|
1492
1664
|
} catch {
|
|
1493
|
-
return { kind:
|
|
1665
|
+
return { kind: 'bad-data' };
|
|
1494
1666
|
}
|
|
1495
1667
|
}
|
|
1496
1668
|
|
|
1497
1669
|
async verifyOptV2(body) {
|
|
1498
|
-
const response: ApiResponse<any> = await this.apisauce.post(
|
|
1670
|
+
const response: ApiResponse<any> = await this.apisauce.post(
|
|
1671
|
+
`api/v1.0/security/verify_otp_v2`,
|
|
1672
|
+
body
|
|
1673
|
+
);
|
|
1499
1674
|
console.log('verify otp', response);
|
|
1500
1675
|
// the typical ways to die when calling an api
|
|
1501
1676
|
if (!response.ok) {
|
|
1502
|
-
const problem = getGeneralApiProblem(response)
|
|
1503
|
-
if (problem) return problem
|
|
1677
|
+
const problem = getGeneralApiProblem(response);
|
|
1678
|
+
if (problem) return problem;
|
|
1504
1679
|
}
|
|
1505
1680
|
|
|
1506
1681
|
// transform the data into the format we are expecting
|
|
1507
1682
|
try {
|
|
1508
|
-
return { kind:
|
|
1683
|
+
return { kind: 'ok', data: response.data };
|
|
1509
1684
|
} catch {
|
|
1510
|
-
return { kind:
|
|
1685
|
+
return { kind: 'bad-data' };
|
|
1511
1686
|
}
|
|
1512
1687
|
}
|
|
1513
1688
|
|
|
1514
1689
|
async checkPasscode(phone, deviceId) {
|
|
1515
|
-
const response: ApiResponse<any> = await this.apisauce.get(
|
|
1690
|
+
const response: ApiResponse<any> = await this.apisauce.get(
|
|
1691
|
+
`api/v1.0/timacare/check_passcode?phone=${phone}&deviceId=${deviceId}`
|
|
1692
|
+
);
|
|
1516
1693
|
console.log('check passcode', response);
|
|
1517
1694
|
// the typical ways to die when calling an api
|
|
1518
1695
|
if (!response.ok) {
|
|
1519
|
-
const problem = getGeneralApiProblem(response)
|
|
1520
|
-
if (problem) return problem
|
|
1696
|
+
const problem = getGeneralApiProblem(response);
|
|
1697
|
+
if (problem) return problem;
|
|
1521
1698
|
}
|
|
1522
1699
|
|
|
1523
1700
|
// transform the data into the format we are expecting
|
|
1524
1701
|
try {
|
|
1525
|
-
return { kind:
|
|
1702
|
+
return { kind: 'ok', data: response.data };
|
|
1526
1703
|
} catch {
|
|
1527
|
-
return { kind:
|
|
1704
|
+
return { kind: 'bad-data' };
|
|
1528
1705
|
}
|
|
1529
1706
|
}
|
|
1530
1707
|
|
|
1531
1708
|
async loginPasscode(body) {
|
|
1532
|
-
const response: ApiResponse<any> = await this.apisauce.post(
|
|
1709
|
+
const response: ApiResponse<any> = await this.apisauce.post(
|
|
1710
|
+
`api/v1.0/timacare/login_passcode`,
|
|
1711
|
+
body
|
|
1712
|
+
);
|
|
1533
1713
|
console.log('login passcode', response);
|
|
1534
1714
|
// the typical ways to die when calling an api
|
|
1535
1715
|
if (!response.ok) {
|
|
1536
|
-
const problem = getGeneralApiProblem(response)
|
|
1537
|
-
if (problem) return problem
|
|
1716
|
+
const problem = getGeneralApiProblem(response);
|
|
1717
|
+
if (problem) return problem;
|
|
1538
1718
|
}
|
|
1539
1719
|
|
|
1540
1720
|
// transform the data into the format we are expecting
|
|
1541
1721
|
try {
|
|
1542
|
-
return { kind:
|
|
1722
|
+
return { kind: 'ok', data: response.data };
|
|
1543
1723
|
} catch {
|
|
1544
|
-
return { kind:
|
|
1724
|
+
return { kind: 'bad-data' };
|
|
1545
1725
|
}
|
|
1546
1726
|
}
|
|
1547
1727
|
|
|
1548
1728
|
async setPasscode(body) {
|
|
1549
|
-
const response: ApiResponse<any> = await this.apisauce.post(
|
|
1729
|
+
const response: ApiResponse<any> = await this.apisauce.post(
|
|
1730
|
+
`api/v1.0/timacare/post_passcode`,
|
|
1731
|
+
body
|
|
1732
|
+
);
|
|
1550
1733
|
console.log('set passcode', response);
|
|
1551
1734
|
// the typical ways to die when calling an api
|
|
1552
1735
|
if (!response.ok) {
|
|
1553
|
-
const problem = getGeneralApiProblem(response)
|
|
1554
|
-
if (problem) return problem
|
|
1736
|
+
const problem = getGeneralApiProblem(response);
|
|
1737
|
+
if (problem) return problem;
|
|
1555
1738
|
}
|
|
1556
1739
|
|
|
1557
1740
|
// transform the data into the format we are expecting
|
|
1558
1741
|
try {
|
|
1559
|
-
return { kind:
|
|
1742
|
+
return { kind: 'ok', data: response.data };
|
|
1560
1743
|
} catch {
|
|
1561
|
-
return { kind:
|
|
1744
|
+
return { kind: 'bad-data' };
|
|
1562
1745
|
}
|
|
1563
1746
|
}
|
|
1564
1747
|
|
|
1565
1748
|
async listLoan() {
|
|
1566
1749
|
// make the api call
|
|
1567
|
-
const response: ApiResponse<any> = await this.apisauce.get(
|
|
1568
|
-
|
|
1750
|
+
const response: ApiResponse<any> = await this.apisauce.get(
|
|
1751
|
+
`api/v2.0/loanbrief/list_loan`
|
|
1752
|
+
);
|
|
1753
|
+
myLog(response);
|
|
1569
1754
|
// the typical ways to die when calling an api
|
|
1570
1755
|
if (!response.ok) {
|
|
1571
|
-
const problem = getGeneralApiProblem(response)
|
|
1572
|
-
if (problem) return problem
|
|
1756
|
+
const problem = getGeneralApiProblem(response);
|
|
1757
|
+
if (problem) return problem;
|
|
1573
1758
|
}
|
|
1574
1759
|
|
|
1575
1760
|
// transform the data into the format we are expecting
|
|
1576
1761
|
try {
|
|
1577
|
-
return { kind:
|
|
1762
|
+
return { kind: 'ok', data: response.data };
|
|
1578
1763
|
} catch {
|
|
1579
|
-
return { kind:
|
|
1764
|
+
return { kind: 'bad-data' };
|
|
1580
1765
|
}
|
|
1581
1766
|
}
|
|
1582
1767
|
|
|
1583
1768
|
async listLoanPending() {
|
|
1584
1769
|
// make the api call
|
|
1585
|
-
const response: ApiResponse<any> = await this.apisauce.get(
|
|
1586
|
-
|
|
1770
|
+
const response: ApiResponse<any> = await this.apisauce.get(
|
|
1771
|
+
`api/v2.0/loanbrief/loan_brief`
|
|
1772
|
+
);
|
|
1773
|
+
myLog(response);
|
|
1587
1774
|
// the typical ways to die when calling an api
|
|
1588
1775
|
if (!response.ok) {
|
|
1589
|
-
const problem = getGeneralApiProblem(response)
|
|
1590
|
-
if (problem) return problem
|
|
1776
|
+
const problem = getGeneralApiProblem(response);
|
|
1777
|
+
if (problem) return problem;
|
|
1591
1778
|
}
|
|
1592
1779
|
|
|
1593
1780
|
// transform the data into the format we are expecting
|
|
1594
1781
|
try {
|
|
1595
|
-
return { kind:
|
|
1782
|
+
return { kind: 'ok', data: response.data };
|
|
1596
1783
|
} catch {
|
|
1597
|
-
return { kind:
|
|
1784
|
+
return { kind: 'bad-data' };
|
|
1598
1785
|
}
|
|
1599
1786
|
}
|
|
1600
1787
|
|
|
1601
1788
|
async getDetailLoan(id) {
|
|
1602
1789
|
// make the api call
|
|
1603
|
-
const response: ApiResponse<any> = await this.apisauce.get(
|
|
1604
|
-
|
|
1790
|
+
const response: ApiResponse<any> = await this.apisauce.get(
|
|
1791
|
+
`api/v2.0/loanbrief/detail?id=${id}`
|
|
1792
|
+
);
|
|
1793
|
+
myLog(response);
|
|
1605
1794
|
// the typical ways to die when calling an api
|
|
1606
1795
|
if (!response.ok) {
|
|
1607
|
-
const problem = getGeneralApiProblem(response)
|
|
1608
|
-
if (problem) return problem
|
|
1796
|
+
const problem = getGeneralApiProblem(response);
|
|
1797
|
+
if (problem) return problem;
|
|
1609
1798
|
}
|
|
1610
1799
|
|
|
1611
1800
|
// transform the data into the format we are expecting
|
|
1612
1801
|
try {
|
|
1613
|
-
return { kind:
|
|
1802
|
+
return { kind: 'ok', data: response.data };
|
|
1614
1803
|
} catch {
|
|
1615
|
-
return { kind:
|
|
1804
|
+
return { kind: 'bad-data' };
|
|
1616
1805
|
}
|
|
1617
1806
|
}
|
|
1618
1807
|
|
|
1619
1808
|
async getBrandProduct() {
|
|
1620
1809
|
// make the api call
|
|
1621
|
-
const response: ApiResponse<any> = await this.apisauce.get(
|
|
1622
|
-
|
|
1810
|
+
const response: ApiResponse<any> = await this.apisauce.get(
|
|
1811
|
+
`api/v1.0/landingpage/get_brand_product`
|
|
1812
|
+
);
|
|
1813
|
+
myLog(response);
|
|
1623
1814
|
// the typical ways to die when calling an api
|
|
1624
1815
|
if (!response.ok) {
|
|
1625
|
-
const problem = getGeneralApiProblem(response)
|
|
1626
|
-
if (problem) return problem
|
|
1816
|
+
const problem = getGeneralApiProblem(response);
|
|
1817
|
+
if (problem) return problem;
|
|
1627
1818
|
}
|
|
1628
1819
|
|
|
1629
1820
|
// transform the data into the format we are expecting
|
|
1630
1821
|
try {
|
|
1631
|
-
return { kind:
|
|
1822
|
+
return { kind: 'ok', data: response.data };
|
|
1632
1823
|
} catch {
|
|
1633
|
-
return { kind:
|
|
1824
|
+
return { kind: 'bad-data' };
|
|
1634
1825
|
}
|
|
1635
1826
|
}
|
|
1636
1827
|
|
|
1637
1828
|
async getNameBrand(id) {
|
|
1638
1829
|
// make the api call
|
|
1639
|
-
const response: ApiResponse<any> = await this.apisauce.get(
|
|
1640
|
-
|
|
1830
|
+
const response: ApiResponse<any> = await this.apisauce.get(
|
|
1831
|
+
`api/v1.0/landingpage/get_name_motobike?brandId=${id}`
|
|
1832
|
+
);
|
|
1833
|
+
myLog(response);
|
|
1641
1834
|
// the typical ways to die when calling an api
|
|
1642
1835
|
if (!response.ok) {
|
|
1643
|
-
const problem = getGeneralApiProblem(response)
|
|
1644
|
-
if (problem) return problem
|
|
1836
|
+
const problem = getGeneralApiProblem(response);
|
|
1837
|
+
if (problem) return problem;
|
|
1645
1838
|
}
|
|
1646
1839
|
|
|
1647
1840
|
// transform the data into the format we are expecting
|
|
1648
1841
|
try {
|
|
1649
|
-
return { kind:
|
|
1842
|
+
return { kind: 'ok', data: response.data };
|
|
1650
1843
|
} catch {
|
|
1651
|
-
return { kind:
|
|
1844
|
+
return { kind: 'bad-data' };
|
|
1652
1845
|
}
|
|
1653
1846
|
}
|
|
1654
1847
|
|
|
1655
1848
|
async getYearProduct(id) {
|
|
1656
1849
|
// make the api call
|
|
1657
|
-
const response: ApiResponse<any> = await this.apisauce.get(
|
|
1658
|
-
|
|
1850
|
+
const response: ApiResponse<any> = await this.apisauce.get(
|
|
1851
|
+
`api/v1.0/landingpage/get_year_product?brandId=${id}`
|
|
1852
|
+
);
|
|
1853
|
+
myLog(response);
|
|
1659
1854
|
// the typical ways to die when calling an api
|
|
1660
1855
|
if (!response.ok) {
|
|
1661
|
-
const problem = getGeneralApiProblem(response)
|
|
1662
|
-
if (problem) return problem
|
|
1856
|
+
const problem = getGeneralApiProblem(response);
|
|
1857
|
+
if (problem) return problem;
|
|
1663
1858
|
}
|
|
1664
1859
|
|
|
1665
1860
|
// transform the data into the format we are expecting
|
|
1666
1861
|
try {
|
|
1667
|
-
return { kind:
|
|
1862
|
+
return { kind: 'ok', data: response.data };
|
|
1668
1863
|
} catch {
|
|
1669
|
-
return { kind:
|
|
1864
|
+
return { kind: 'bad-data' };
|
|
1670
1865
|
}
|
|
1671
1866
|
}
|
|
1672
1867
|
|
|
1673
1868
|
async getModelProduct(id, year) {
|
|
1674
1869
|
// make the api call
|
|
1675
|
-
const response: ApiResponse<any> = await this.apisauce
|
|
1676
|
-
|
|
1677
|
-
|
|
1870
|
+
const response: ApiResponse<any> = await this.apisauce
|
|
1871
|
+
.get(`api/v1.0/landingpage/get_product_brand_year?brandId=${id}&year=${year}
|
|
1872
|
+
`);
|
|
1873
|
+
myLog(response);
|
|
1678
1874
|
// the typical ways to die when calling an api
|
|
1679
1875
|
if (!response.ok) {
|
|
1680
|
-
const problem = getGeneralApiProblem(response)
|
|
1681
|
-
if (problem) return problem
|
|
1876
|
+
const problem = getGeneralApiProblem(response);
|
|
1877
|
+
if (problem) return problem;
|
|
1682
1878
|
}
|
|
1683
1879
|
|
|
1684
1880
|
// transform the data into the format we are expecting
|
|
1685
1881
|
try {
|
|
1686
|
-
return { kind:
|
|
1882
|
+
return { kind: 'ok', data: response.data };
|
|
1687
1883
|
} catch {
|
|
1688
|
-
return { kind:
|
|
1884
|
+
return { kind: 'bad-data' };
|
|
1689
1885
|
}
|
|
1690
1886
|
}
|
|
1691
1887
|
|
|
1692
1888
|
async quickSubmit(body) {
|
|
1693
1889
|
// make the api call
|
|
1694
|
-
const response: ApiResponse<any> = await this.apisauce.post(
|
|
1695
|
-
|
|
1890
|
+
const response: ApiResponse<any> = await this.apisauce.post(
|
|
1891
|
+
`api/v2.0/loanbrief/init`,
|
|
1892
|
+
body
|
|
1893
|
+
);
|
|
1894
|
+
myLog(response);
|
|
1696
1895
|
// the typical ways to die when calling an api
|
|
1697
1896
|
if (!response.ok) {
|
|
1698
|
-
const problem = getGeneralApiProblem(response)
|
|
1699
|
-
if (problem) return problem
|
|
1897
|
+
const problem = getGeneralApiProblem(response);
|
|
1898
|
+
if (problem) return problem;
|
|
1700
1899
|
}
|
|
1701
1900
|
|
|
1702
1901
|
// transform the data into the format we are expecting
|
|
1703
1902
|
try {
|
|
1704
|
-
return { kind:
|
|
1903
|
+
return { kind: 'ok', data: response.data };
|
|
1705
1904
|
} catch {
|
|
1706
|
-
return { kind:
|
|
1905
|
+
return { kind: 'bad-data' };
|
|
1707
1906
|
}
|
|
1708
1907
|
}
|
|
1709
1908
|
|
|
1710
1909
|
async getDocument(id) {
|
|
1711
1910
|
// make the api call
|
|
1712
|
-
const response: ApiResponse<any> = await this.apisauce.get(
|
|
1713
|
-
|
|
1911
|
+
const response: ApiResponse<any> = await this.apisauce.get(
|
|
1912
|
+
`api/v2.0/loanbrief/document?loanbriefId=${id}`
|
|
1913
|
+
);
|
|
1914
|
+
myLog(response);
|
|
1714
1915
|
// the typical ways to die when calling an api
|
|
1715
1916
|
if (!response.ok) {
|
|
1716
|
-
const problem = getGeneralApiProblem(response)
|
|
1717
|
-
if (problem) return problem
|
|
1917
|
+
const problem = getGeneralApiProblem(response);
|
|
1918
|
+
if (problem) return problem;
|
|
1718
1919
|
}
|
|
1719
1920
|
|
|
1720
1921
|
// transform the data into the format we are expecting
|
|
1721
1922
|
try {
|
|
1722
|
-
return { kind:
|
|
1923
|
+
return { kind: 'ok', data: response.data };
|
|
1723
1924
|
} catch {
|
|
1724
|
-
return { kind:
|
|
1925
|
+
return { kind: 'bad-data' };
|
|
1725
1926
|
}
|
|
1726
1927
|
}
|
|
1727
1928
|
|
|
1728
1929
|
async uploadDocument(body) {
|
|
1729
1930
|
// make the api call
|
|
1730
|
-
const response: ApiResponse<any> = await this.apisauce.post(
|
|
1731
|
-
|
|
1931
|
+
const response: ApiResponse<any> = await this.apisauce.post(
|
|
1932
|
+
`api/v2.0/loanbrief/upload_document`,
|
|
1933
|
+
body,
|
|
1934
|
+
{ headers: { 'Content-Type': 'multipart/form-data' } }
|
|
1935
|
+
);
|
|
1936
|
+
myLog(response);
|
|
1732
1937
|
// the typical ways to die when calling an api
|
|
1733
1938
|
if (!response.ok) {
|
|
1734
|
-
const problem = getGeneralApiProblem(response)
|
|
1735
|
-
if (problem) return problem
|
|
1939
|
+
const problem = getGeneralApiProblem(response);
|
|
1940
|
+
if (problem) return problem;
|
|
1736
1941
|
}
|
|
1737
1942
|
|
|
1738
1943
|
// transform the data into the format we are expecting
|
|
1739
1944
|
try {
|
|
1740
|
-
return { kind:
|
|
1945
|
+
return { kind: 'ok', data: response.data };
|
|
1741
1946
|
} catch {
|
|
1742
|
-
return { kind:
|
|
1947
|
+
return { kind: 'bad-data' };
|
|
1743
1948
|
}
|
|
1744
1949
|
}
|
|
1745
1950
|
|
|
1746
1951
|
async getStatusWorking() {
|
|
1747
1952
|
// make the api call
|
|
1748
|
-
const response: ApiResponse<any> = await this.apisauce.get(
|
|
1749
|
-
|
|
1953
|
+
const response: ApiResponse<any> = await this.apisauce.get(
|
|
1954
|
+
`api/v2.0/loanbrief/employment_status`
|
|
1955
|
+
);
|
|
1956
|
+
myLog(response);
|
|
1750
1957
|
// the typical ways to die when calling an api
|
|
1751
1958
|
if (!response.ok) {
|
|
1752
|
-
const problem = getGeneralApiProblem(response)
|
|
1753
|
-
if (problem) return problem
|
|
1959
|
+
const problem = getGeneralApiProblem(response);
|
|
1960
|
+
if (problem) return problem;
|
|
1754
1961
|
}
|
|
1755
1962
|
|
|
1756
1963
|
// transform the data into the format we are expecting
|
|
1757
1964
|
try {
|
|
1758
|
-
return { kind:
|
|
1965
|
+
return { kind: 'ok', data: response.data };
|
|
1759
1966
|
} catch {
|
|
1760
|
-
return { kind:
|
|
1967
|
+
return { kind: 'bad-data' };
|
|
1761
1968
|
}
|
|
1762
1969
|
}
|
|
1763
1970
|
|
|
1764
1971
|
async getSourceFund() {
|
|
1765
1972
|
// make the api call
|
|
1766
|
-
const response: ApiResponse<any> = await this.apisauce.get(
|
|
1767
|
-
|
|
1973
|
+
const response: ApiResponse<any> = await this.apisauce.get(
|
|
1974
|
+
`api/v2.0/loanbrief/source_of_fund`
|
|
1975
|
+
);
|
|
1976
|
+
myLog(response);
|
|
1768
1977
|
// the typical ways to die when calling an api
|
|
1769
1978
|
if (!response.ok) {
|
|
1770
|
-
const problem = getGeneralApiProblem(response)
|
|
1771
|
-
if (problem) return problem
|
|
1979
|
+
const problem = getGeneralApiProblem(response);
|
|
1980
|
+
if (problem) return problem;
|
|
1772
1981
|
}
|
|
1773
1982
|
|
|
1774
1983
|
// transform the data into the format we are expecting
|
|
1775
1984
|
try {
|
|
1776
|
-
return { kind:
|
|
1985
|
+
return { kind: 'ok', data: response.data };
|
|
1777
1986
|
} catch {
|
|
1778
|
-
return { kind:
|
|
1987
|
+
return { kind: 'bad-data' };
|
|
1779
1988
|
}
|
|
1780
1989
|
}
|
|
1781
1990
|
|
|
1782
1991
|
async getJobTitle() {
|
|
1783
1992
|
// make the api call
|
|
1784
|
-
const response: ApiResponse<any> = await this.apisauce.get(
|
|
1785
|
-
|
|
1993
|
+
const response: ApiResponse<any> = await this.apisauce.get(
|
|
1994
|
+
`api/v2.0/loanbrief/job_title`
|
|
1995
|
+
);
|
|
1996
|
+
myLog(response);
|
|
1786
1997
|
// the typical ways to die when calling an api
|
|
1787
1998
|
if (!response.ok) {
|
|
1788
|
-
const problem = getGeneralApiProblem(response)
|
|
1789
|
-
if (problem) return problem
|
|
1999
|
+
const problem = getGeneralApiProblem(response);
|
|
2000
|
+
if (problem) return problem;
|
|
1790
2001
|
}
|
|
1791
2002
|
|
|
1792
2003
|
// transform the data into the format we are expecting
|
|
1793
2004
|
try {
|
|
1794
|
-
return { kind:
|
|
2005
|
+
return { kind: 'ok', data: response.data };
|
|
1795
2006
|
} catch {
|
|
1796
|
-
return { kind:
|
|
2007
|
+
return { kind: 'bad-data' };
|
|
1797
2008
|
}
|
|
1798
2009
|
}
|
|
1799
2010
|
|
|
1800
2011
|
async getOccupation() {
|
|
1801
2012
|
// make the api call
|
|
1802
|
-
const response: ApiResponse<any> = await this.apisauce.get(
|
|
1803
|
-
|
|
2013
|
+
const response: ApiResponse<any> = await this.apisauce.get(
|
|
2014
|
+
`api/v2.0/loanbrief/occupation`
|
|
2015
|
+
);
|
|
2016
|
+
myLog(response);
|
|
1804
2017
|
// the typical ways to die when calling an api
|
|
1805
2018
|
if (!response.ok) {
|
|
1806
|
-
const problem = getGeneralApiProblem(response)
|
|
1807
|
-
if (problem) return problem
|
|
2019
|
+
const problem = getGeneralApiProblem(response);
|
|
2020
|
+
if (problem) return problem;
|
|
1808
2021
|
}
|
|
1809
2022
|
|
|
1810
2023
|
// transform the data into the format we are expecting
|
|
1811
2024
|
try {
|
|
1812
|
-
return { kind:
|
|
2025
|
+
return { kind: 'ok', data: response.data };
|
|
1813
2026
|
} catch {
|
|
1814
|
-
return { kind:
|
|
2027
|
+
return { kind: 'bad-data' };
|
|
1815
2028
|
}
|
|
1816
2029
|
}
|
|
1817
2030
|
|
|
1818
2031
|
async getJobCIMB() {
|
|
1819
2032
|
// make the api call
|
|
1820
|
-
const response: ApiResponse<any> = await this.apisauce.get(
|
|
1821
|
-
|
|
2033
|
+
const response: ApiResponse<any> = await this.apisauce.get(
|
|
2034
|
+
`api/v2.0/loanbrief/job_cimb`
|
|
2035
|
+
);
|
|
2036
|
+
myLog(response);
|
|
1822
2037
|
// the typical ways to die when calling an api
|
|
1823
2038
|
if (!response.ok) {
|
|
1824
|
-
const problem = getGeneralApiProblem(response)
|
|
1825
|
-
if (problem) return problem
|
|
2039
|
+
const problem = getGeneralApiProblem(response);
|
|
2040
|
+
if (problem) return problem;
|
|
1826
2041
|
}
|
|
1827
2042
|
|
|
1828
2043
|
// transform the data into the format we are expecting
|
|
1829
2044
|
try {
|
|
1830
|
-
return { kind:
|
|
2045
|
+
return { kind: 'ok', data: response.data };
|
|
1831
2046
|
} catch {
|
|
1832
|
-
return { kind:
|
|
2047
|
+
return { kind: 'bad-data' };
|
|
1833
2048
|
}
|
|
1834
2049
|
}
|
|
1835
2050
|
async getPositionCIMB() {
|
|
1836
2051
|
// make the api call
|
|
1837
|
-
const response: ApiResponse<any> = await this.apisauce.get(
|
|
1838
|
-
|
|
2052
|
+
const response: ApiResponse<any> = await this.apisauce.get(
|
|
2053
|
+
`api/v2.0/loanbrief/position_cimb`
|
|
2054
|
+
);
|
|
2055
|
+
myLog(response);
|
|
1839
2056
|
// the typical ways to die when calling an api
|
|
1840
2057
|
if (!response.ok) {
|
|
1841
|
-
const problem = getGeneralApiProblem(response)
|
|
1842
|
-
if (problem) return problem
|
|
2058
|
+
const problem = getGeneralApiProblem(response);
|
|
2059
|
+
if (problem) return problem;
|
|
1843
2060
|
}
|
|
1844
2061
|
|
|
1845
2062
|
// transform the data into the format we are expecting
|
|
1846
2063
|
try {
|
|
1847
|
-
return { kind:
|
|
2064
|
+
return { kind: 'ok', data: response.data };
|
|
1848
2065
|
} catch {
|
|
1849
|
-
return { kind:
|
|
2066
|
+
return { kind: 'bad-data' };
|
|
1850
2067
|
}
|
|
1851
2068
|
}
|
|
1852
2069
|
async getIncomeCIMB() {
|
|
1853
2070
|
// make the api call
|
|
1854
|
-
const response: ApiResponse<any> = await this.apisauce.get(
|
|
1855
|
-
|
|
2071
|
+
const response: ApiResponse<any> = await this.apisauce.get(
|
|
2072
|
+
`api/v2.0/loanbrief/income_cimb`
|
|
2073
|
+
);
|
|
2074
|
+
myLog(response);
|
|
1856
2075
|
// the typical ways to die when calling an api
|
|
1857
2076
|
if (!response.ok) {
|
|
1858
|
-
const problem = getGeneralApiProblem(response)
|
|
1859
|
-
if (problem) return problem
|
|
2077
|
+
const problem = getGeneralApiProblem(response);
|
|
2078
|
+
if (problem) return problem;
|
|
1860
2079
|
}
|
|
1861
2080
|
|
|
1862
2081
|
// transform the data into the format we are expecting
|
|
1863
2082
|
try {
|
|
1864
|
-
return { kind:
|
|
2083
|
+
return { kind: 'ok', data: response.data };
|
|
1865
2084
|
} catch {
|
|
1866
|
-
return { kind:
|
|
2085
|
+
return { kind: 'bad-data' };
|
|
1867
2086
|
}
|
|
1868
2087
|
}
|
|
1869
2088
|
async getJobStatusCIMB() {
|
|
1870
2089
|
// make the api call
|
|
1871
|
-
const response: ApiResponse<any> = await this.apisauce.get(
|
|
1872
|
-
|
|
2090
|
+
const response: ApiResponse<any> = await this.apisauce.get(
|
|
2091
|
+
`api/v2.0/loanbrief/job_status_cimb`
|
|
2092
|
+
);
|
|
2093
|
+
myLog(response);
|
|
1873
2094
|
// the typical ways to die when calling an api
|
|
1874
2095
|
if (!response.ok) {
|
|
1875
|
-
const problem = getGeneralApiProblem(response)
|
|
1876
|
-
if (problem) return problem
|
|
2096
|
+
const problem = getGeneralApiProblem(response);
|
|
2097
|
+
if (problem) return problem;
|
|
1877
2098
|
}
|
|
1878
2099
|
|
|
1879
2100
|
// transform the data into the format we are expecting
|
|
1880
2101
|
try {
|
|
1881
|
-
return { kind:
|
|
2102
|
+
return { kind: 'ok', data: response.data };
|
|
1882
2103
|
} catch {
|
|
1883
|
-
return { kind:
|
|
2104
|
+
return { kind: 'bad-data' };
|
|
1884
2105
|
}
|
|
1885
2106
|
}
|
|
1886
2107
|
|
|
1887
2108
|
async getDetailFullSubmit(id) {
|
|
1888
2109
|
// make the api call
|
|
1889
|
-
const response: ApiResponse<any> = await this.apisauce.get(
|
|
1890
|
-
|
|
2110
|
+
const response: ApiResponse<any> = await this.apisauce.get(
|
|
2111
|
+
`api/v2.0/loanbrief/detail_next?id=${id}`
|
|
2112
|
+
);
|
|
2113
|
+
myLog(response);
|
|
1891
2114
|
// the typical ways to die when calling an api
|
|
1892
2115
|
if (!response.ok) {
|
|
1893
|
-
const problem = getGeneralApiProblem(response)
|
|
1894
|
-
if (problem) return problem
|
|
2116
|
+
const problem = getGeneralApiProblem(response);
|
|
2117
|
+
if (problem) return problem;
|
|
1895
2118
|
}
|
|
1896
2119
|
|
|
1897
2120
|
// transform the data into the format we are expecting
|
|
1898
2121
|
try {
|
|
1899
|
-
return { kind:
|
|
2122
|
+
return { kind: 'ok', data: response.data };
|
|
1900
2123
|
} catch {
|
|
1901
|
-
return { kind:
|
|
2124
|
+
return { kind: 'bad-data' };
|
|
1902
2125
|
}
|
|
1903
2126
|
}
|
|
1904
2127
|
|
|
1905
2128
|
async fullSubmit(body) {
|
|
1906
2129
|
// make the api call
|
|
1907
|
-
const response: ApiResponse<any> = await this.apisauce.post(
|
|
1908
|
-
|
|
2130
|
+
const response: ApiResponse<any> = await this.apisauce.post(
|
|
2131
|
+
`api/v2.0/loanbrief/init_next`,
|
|
2132
|
+
body
|
|
2133
|
+
);
|
|
2134
|
+
myLog(response);
|
|
1909
2135
|
// the typical ways to die when calling an api
|
|
1910
2136
|
if (!response.ok) {
|
|
1911
|
-
const problem = getGeneralApiProblem(response)
|
|
1912
|
-
if (problem) return problem
|
|
2137
|
+
const problem = getGeneralApiProblem(response);
|
|
2138
|
+
if (problem) return problem;
|
|
1913
2139
|
}
|
|
1914
2140
|
|
|
1915
2141
|
// transform the data into the format we are expecting
|
|
1916
2142
|
try {
|
|
1917
|
-
return { kind:
|
|
2143
|
+
return { kind: 'ok', data: response.data };
|
|
1918
2144
|
} catch {
|
|
1919
|
-
return { kind:
|
|
2145
|
+
return { kind: 'bad-data' };
|
|
1920
2146
|
}
|
|
1921
2147
|
}
|
|
1922
2148
|
|
|
1923
2149
|
async getPaymentSchedule(id) {
|
|
1924
2150
|
// make the api call
|
|
1925
|
-
const response: ApiResponse<any> = await this.apisauce.get(
|
|
1926
|
-
|
|
2151
|
+
const response: ApiResponse<any> = await this.apisauce.get(
|
|
2152
|
+
`api/v2.0/loanbrief/payment_plan?id=${id}`
|
|
2153
|
+
);
|
|
2154
|
+
myLog(response);
|
|
1927
2155
|
// the typical ways to die when calling an api
|
|
1928
2156
|
if (!response.ok) {
|
|
1929
|
-
const problem = getGeneralApiProblem(response)
|
|
1930
|
-
if (problem) return problem
|
|
2157
|
+
const problem = getGeneralApiProblem(response);
|
|
2158
|
+
if (problem) return problem;
|
|
1931
2159
|
}
|
|
1932
2160
|
|
|
1933
2161
|
// transform the data into the format we are expecting
|
|
1934
2162
|
try {
|
|
1935
|
-
return { kind:
|
|
2163
|
+
return { kind: 'ok', data: response.data };
|
|
1936
2164
|
} catch {
|
|
1937
|
-
return { kind:
|
|
2165
|
+
return { kind: 'bad-data' };
|
|
1938
2166
|
}
|
|
1939
2167
|
}
|
|
1940
2168
|
|
|
1941
2169
|
async getLoanInfo(id) {
|
|
1942
2170
|
// make the api call
|
|
1943
|
-
const response: ApiResponse<any> = await this.apisauce.get(
|
|
1944
|
-
|
|
2171
|
+
const response: ApiResponse<any> = await this.apisauce.get(
|
|
2172
|
+
`api/v2.0/loanbrief/loan_detail?id=${id}`
|
|
2173
|
+
);
|
|
2174
|
+
myLog(response);
|
|
1945
2175
|
// the typical ways to die when calling an api
|
|
1946
2176
|
if (!response.ok) {
|
|
1947
|
-
const problem = getGeneralApiProblem(response)
|
|
1948
|
-
if (problem) return problem
|
|
2177
|
+
const problem = getGeneralApiProblem(response);
|
|
2178
|
+
if (problem) return problem;
|
|
1949
2179
|
}
|
|
1950
2180
|
|
|
1951
2181
|
// transform the data into the format we are expecting
|
|
1952
2182
|
try {
|
|
1953
|
-
return { kind:
|
|
2183
|
+
return { kind: 'ok', data: response.data };
|
|
1954
2184
|
} catch {
|
|
1955
|
-
return { kind:
|
|
2185
|
+
return { kind: 'bad-data' };
|
|
1956
2186
|
}
|
|
1957
2187
|
}
|
|
1958
2188
|
|
|
1959
2189
|
async getLoanPaymentSchedule(id) {
|
|
1960
2190
|
// make the api call
|
|
1961
|
-
const response: ApiResponse<any> = await this.apisauce.get(
|
|
1962
|
-
|
|
2191
|
+
const response: ApiResponse<any> = await this.apisauce.get(
|
|
2192
|
+
`api/v2.0/loanbrief/schedule_payment?id=${id}`
|
|
2193
|
+
);
|
|
2194
|
+
myLog(response);
|
|
1963
2195
|
// the typical ways to die when calling an api
|
|
1964
2196
|
if (!response.ok) {
|
|
1965
|
-
const problem = getGeneralApiProblem(response)
|
|
1966
|
-
if (problem) return problem
|
|
2197
|
+
const problem = getGeneralApiProblem(response);
|
|
2198
|
+
if (problem) return problem;
|
|
1967
2199
|
}
|
|
1968
2200
|
|
|
1969
2201
|
// transform the data into the format we are expecting
|
|
1970
2202
|
try {
|
|
1971
|
-
return { kind:
|
|
2203
|
+
return { kind: 'ok', data: response.data };
|
|
1972
2204
|
} catch {
|
|
1973
|
-
return { kind:
|
|
2205
|
+
return { kind: 'bad-data' };
|
|
1974
2206
|
}
|
|
1975
2207
|
}
|
|
1976
2208
|
|
|
1977
2209
|
async getTotalMoneyPayment(id, type) {
|
|
1978
2210
|
// make the api call
|
|
1979
|
-
const response: ApiResponse<any> = await this.apisauce.get(
|
|
1980
|
-
|
|
2211
|
+
const response: ApiResponse<any> = await this.apisauce.get(
|
|
2212
|
+
`api/v2.0/loanbrief/payment_infor?id=${id}&typePaymentId=${type}`
|
|
2213
|
+
);
|
|
2214
|
+
myLog(response);
|
|
1981
2215
|
// the typical ways to die when calling an api
|
|
1982
2216
|
if (!response.ok) {
|
|
1983
|
-
const problem = getGeneralApiProblem(response)
|
|
1984
|
-
if (problem) return problem
|
|
2217
|
+
const problem = getGeneralApiProblem(response);
|
|
2218
|
+
if (problem) return problem;
|
|
1985
2219
|
}
|
|
1986
2220
|
|
|
1987
2221
|
// transform the data into the format we are expecting
|
|
1988
2222
|
try {
|
|
1989
|
-
return { kind:
|
|
2223
|
+
return { kind: 'ok', data: response.data };
|
|
1990
2224
|
} catch {
|
|
1991
|
-
return { kind:
|
|
2225
|
+
return { kind: 'bad-data' };
|
|
1992
2226
|
}
|
|
1993
2227
|
}
|
|
1994
2228
|
|
|
1995
2229
|
async getNotification() {
|
|
1996
2230
|
// make the api call
|
|
1997
|
-
const response: ApiResponse<any> = await this.apisauce.get(
|
|
1998
|
-
|
|
2231
|
+
const response: ApiResponse<any> = await this.apisauce.get(
|
|
2232
|
+
`api/v2.0/loanbrief/get_notification`
|
|
2233
|
+
);
|
|
2234
|
+
myLog(response);
|
|
1999
2235
|
// the typical ways to die when calling an api
|
|
2000
2236
|
if (!response.ok) {
|
|
2001
|
-
const problem = getGeneralApiProblem(response)
|
|
2002
|
-
if (problem) return problem
|
|
2237
|
+
const problem = getGeneralApiProblem(response);
|
|
2238
|
+
if (problem) return problem;
|
|
2003
2239
|
}
|
|
2004
2240
|
|
|
2005
2241
|
// transform the data into the format we are expecting
|
|
2006
2242
|
try {
|
|
2007
|
-
return { kind:
|
|
2243
|
+
return { kind: 'ok', data: response.data };
|
|
2008
2244
|
} catch {
|
|
2009
|
-
return { kind:
|
|
2245
|
+
return { kind: 'bad-data' };
|
|
2010
2246
|
}
|
|
2011
2247
|
}
|
|
2012
2248
|
|
|
2013
2249
|
async confirmData(id) {
|
|
2014
2250
|
// make the api call
|
|
2015
|
-
const response: ApiResponse<any> = await this.apisauce.post(
|
|
2016
|
-
|
|
2251
|
+
const response: ApiResponse<any> = await this.apisauce.post(
|
|
2252
|
+
`api/v2.0/loanbrief/addition_submit?id=${id}`
|
|
2253
|
+
);
|
|
2254
|
+
myLog(response);
|
|
2017
2255
|
// the typical ways to die when calling an api
|
|
2018
2256
|
if (!response.ok) {
|
|
2019
|
-
const problem = getGeneralApiProblem(response)
|
|
2020
|
-
if (problem) return problem
|
|
2257
|
+
const problem = getGeneralApiProblem(response);
|
|
2258
|
+
if (problem) return problem;
|
|
2021
2259
|
}
|
|
2022
2260
|
|
|
2023
2261
|
// transform the data into the format we are expecting
|
|
2024
2262
|
try {
|
|
2025
|
-
return { kind:
|
|
2263
|
+
return { kind: 'ok', data: response.data };
|
|
2026
2264
|
} catch {
|
|
2027
|
-
return { kind:
|
|
2265
|
+
return { kind: 'bad-data' };
|
|
2028
2266
|
}
|
|
2029
2267
|
}
|
|
2030
2268
|
|
|
2031
2269
|
async getTypeMerried() {
|
|
2032
2270
|
// make the api call
|
|
2033
|
-
const response: ApiResponse<any> = await this.apisauce.get(
|
|
2034
|
-
|
|
2271
|
+
const response: ApiResponse<any> = await this.apisauce.get(
|
|
2272
|
+
`api/v1.0/landingpage/get_type_merried`
|
|
2273
|
+
);
|
|
2274
|
+
myLog(response);
|
|
2035
2275
|
// the typical ways to die when calling an api
|
|
2036
2276
|
if (!response.ok) {
|
|
2037
|
-
const problem = getGeneralApiProblem(response)
|
|
2038
|
-
if (problem) return problem
|
|
2277
|
+
const problem = getGeneralApiProblem(response);
|
|
2278
|
+
if (problem) return problem;
|
|
2039
2279
|
}
|
|
2040
2280
|
|
|
2041
2281
|
// transform the data into the format we are expecting
|
|
2042
2282
|
try {
|
|
2043
|
-
return { kind:
|
|
2283
|
+
return { kind: 'ok', data: response.data };
|
|
2044
2284
|
} catch {
|
|
2045
|
-
return { kind:
|
|
2285
|
+
return { kind: 'bad-data' };
|
|
2046
2286
|
}
|
|
2047
2287
|
}
|
|
2048
2288
|
|
|
2049
2289
|
async getFCMToken() {
|
|
2050
2290
|
// make the api call
|
|
2051
|
-
const response: ApiResponse<any> = await this.apisauce.get(
|
|
2052
|
-
|
|
2291
|
+
const response: ApiResponse<any> = await this.apisauce.get(
|
|
2292
|
+
`api/v2.0/loanbrief/key_fcm`
|
|
2293
|
+
);
|
|
2294
|
+
myLog(response);
|
|
2053
2295
|
// the typical ways to die when calling an api
|
|
2054
2296
|
if (!response.ok) {
|
|
2055
|
-
const problem = getGeneralApiProblem(response)
|
|
2056
|
-
if (problem) return problem
|
|
2297
|
+
const problem = getGeneralApiProblem(response);
|
|
2298
|
+
if (problem) return problem;
|
|
2057
2299
|
}
|
|
2058
2300
|
|
|
2059
2301
|
// transform the data into the format we are expecting
|
|
2060
2302
|
try {
|
|
2061
|
-
return { kind:
|
|
2303
|
+
return { kind: 'ok', data: response.data };
|
|
2062
2304
|
} catch {
|
|
2063
|
-
return { kind:
|
|
2305
|
+
return { kind: 'bad-data' };
|
|
2064
2306
|
}
|
|
2065
2307
|
}
|
|
2066
2308
|
|
|
2067
2309
|
async getInfo() {
|
|
2068
2310
|
// make the api call
|
|
2069
|
-
const response: ApiResponse<any> = await this.apisauce.post(
|
|
2070
|
-
|
|
2311
|
+
const response: ApiResponse<any> = await this.apisauce.post(
|
|
2312
|
+
`api/v2.0/loanbrief/infomation_customer`
|
|
2313
|
+
);
|
|
2314
|
+
myLog(response);
|
|
2071
2315
|
// the typical ways to die when calling an api
|
|
2072
2316
|
if (!response.ok) {
|
|
2073
|
-
const problem = getGeneralApiProblem(response)
|
|
2074
|
-
if (problem) return problem
|
|
2317
|
+
const problem = getGeneralApiProblem(response);
|
|
2318
|
+
if (problem) return problem;
|
|
2075
2319
|
}
|
|
2076
2320
|
|
|
2077
2321
|
// transform the data into the format we are expecting
|
|
2078
2322
|
try {
|
|
2079
|
-
return { kind:
|
|
2323
|
+
return { kind: 'ok', data: response.data };
|
|
2080
2324
|
} catch {
|
|
2081
|
-
return { kind:
|
|
2325
|
+
return { kind: 'bad-data' };
|
|
2082
2326
|
}
|
|
2083
2327
|
}
|
|
2084
2328
|
|
|
2085
2329
|
async getContract(loanId) {
|
|
2086
2330
|
// make the api call
|
|
2087
|
-
const response: ApiResponse<any> = await this.apisauce.get(
|
|
2088
|
-
|
|
2331
|
+
const response: ApiResponse<any> = await this.apisauce.get(
|
|
2332
|
+
`api/v2.0/loanbrief/view_esign_contract?loanBriefId=${loanId}`
|
|
2333
|
+
);
|
|
2334
|
+
myLog(response);
|
|
2089
2335
|
// the typical ways to die when calling an api
|
|
2090
2336
|
if (!response.ok) {
|
|
2091
|
-
const problem = getGeneralApiProblem(response)
|
|
2092
|
-
if (problem) return problem
|
|
2337
|
+
const problem = getGeneralApiProblem(response);
|
|
2338
|
+
if (problem) return problem;
|
|
2093
2339
|
}
|
|
2094
2340
|
|
|
2095
2341
|
// transform the data into the format we are expecting
|
|
2096
2342
|
try {
|
|
2097
|
-
return { kind:
|
|
2343
|
+
return { kind: 'ok', data: response.data };
|
|
2098
2344
|
} catch {
|
|
2099
|
-
return { kind:
|
|
2345
|
+
return { kind: 'bad-data' };
|
|
2100
2346
|
}
|
|
2101
2347
|
}
|
|
2102
2348
|
|
|
2103
2349
|
async confirmContract(body) {
|
|
2104
2350
|
// make the api call
|
|
2105
|
-
const response: ApiResponse<any> = await this.apisauce.post(
|
|
2106
|
-
|
|
2351
|
+
const response: ApiResponse<any> = await this.apisauce.post(
|
|
2352
|
+
`api/v2.0/loanbrief/confirm_esign_contract`,
|
|
2353
|
+
body
|
|
2354
|
+
);
|
|
2355
|
+
myLog(response);
|
|
2107
2356
|
// the typical ways to die when calling an api
|
|
2108
2357
|
if (!response.ok) {
|
|
2109
|
-
const problem = getGeneralApiProblem(response)
|
|
2110
|
-
if (problem) return problem
|
|
2358
|
+
const problem = getGeneralApiProblem(response);
|
|
2359
|
+
if (problem) return problem;
|
|
2111
2360
|
}
|
|
2112
2361
|
|
|
2113
2362
|
// transform the data into the format we are expecting
|
|
2114
2363
|
try {
|
|
2115
|
-
return { kind:
|
|
2364
|
+
return { kind: 'ok', data: response.data };
|
|
2116
2365
|
} catch {
|
|
2117
|
-
return { kind:
|
|
2366
|
+
return { kind: 'bad-data' };
|
|
2118
2367
|
}
|
|
2119
2368
|
}
|
|
2120
2369
|
|
|
2121
2370
|
async getOtpSign(type) {
|
|
2122
2371
|
// make the api call
|
|
2123
|
-
const response: ApiResponse<any> = await this.apisauce.get(
|
|
2124
|
-
|
|
2372
|
+
const response: ApiResponse<any> = await this.apisauce.get(
|
|
2373
|
+
`api/v2.0/loanbrief/get_otp_esign_contract?type=${type}&isTermesEtConditions=true`
|
|
2374
|
+
);
|
|
2375
|
+
myLog(response);
|
|
2125
2376
|
// the typical ways to die when calling an api
|
|
2126
2377
|
if (!response.ok) {
|
|
2127
|
-
const problem = getGeneralApiProblem(response)
|
|
2128
|
-
if (problem) return problem
|
|
2378
|
+
const problem = getGeneralApiProblem(response);
|
|
2379
|
+
if (problem) return problem;
|
|
2129
2380
|
}
|
|
2130
2381
|
|
|
2131
2382
|
// transform the data into the format we are expecting
|
|
2132
2383
|
try {
|
|
2133
|
-
return { kind:
|
|
2384
|
+
return { kind: 'ok', data: response.data };
|
|
2134
2385
|
} catch {
|
|
2135
|
-
return { kind:
|
|
2386
|
+
return { kind: 'bad-data' };
|
|
2136
2387
|
}
|
|
2137
2388
|
}
|
|
2138
2389
|
|
|
2139
2390
|
async logout() {
|
|
2140
2391
|
// make the api call
|
|
2141
|
-
const response: ApiResponse<any> = await this.apisauce.get(
|
|
2142
|
-
|
|
2392
|
+
const response: ApiResponse<any> = await this.apisauce.get(
|
|
2393
|
+
`api/v2.0/loanbrief/log_out`
|
|
2394
|
+
);
|
|
2395
|
+
myLog(response);
|
|
2143
2396
|
// the typical ways to die when calling an api
|
|
2144
2397
|
if (!response.ok) {
|
|
2145
|
-
const problem = getGeneralApiProblem(response)
|
|
2146
|
-
if (problem) return problem
|
|
2398
|
+
const problem = getGeneralApiProblem(response);
|
|
2399
|
+
if (problem) return problem;
|
|
2147
2400
|
}
|
|
2148
2401
|
|
|
2149
2402
|
// transform the data into the format we are expecting
|
|
2150
2403
|
try {
|
|
2151
|
-
return { kind:
|
|
2404
|
+
return { kind: 'ok', data: response.data };
|
|
2152
2405
|
} catch {
|
|
2153
|
-
return { kind:
|
|
2406
|
+
return { kind: 'bad-data' };
|
|
2154
2407
|
}
|
|
2155
2408
|
}
|
|
2156
2409
|
|
|
2157
2410
|
async getInsurance(params) {
|
|
2158
2411
|
// make the api call
|
|
2159
|
-
const response: ApiResponse<any> = await this.apisauce.get(
|
|
2160
|
-
|
|
2412
|
+
const response: ApiResponse<any> = await this.apisauce.get(
|
|
2413
|
+
`api/v2.0/loanbrief/get_insurance_estimated`,
|
|
2414
|
+
params
|
|
2415
|
+
);
|
|
2416
|
+
myLog(response);
|
|
2161
2417
|
// the typical ways to die when calling an api
|
|
2162
2418
|
if (!response.ok) {
|
|
2163
|
-
const problem = getGeneralApiProblem(response)
|
|
2164
|
-
if (problem) return problem
|
|
2419
|
+
const problem = getGeneralApiProblem(response);
|
|
2420
|
+
if (problem) return problem;
|
|
2165
2421
|
}
|
|
2166
2422
|
|
|
2167
2423
|
// transform the data into the format we are expecting
|
|
2168
2424
|
try {
|
|
2169
|
-
return { kind:
|
|
2425
|
+
return { kind: 'ok', data: response.data };
|
|
2170
2426
|
} catch {
|
|
2171
|
-
return { kind:
|
|
2427
|
+
return { kind: 'bad-data' };
|
|
2172
2428
|
}
|
|
2173
2429
|
}
|
|
2174
2430
|
async confirmInsurance(body) {
|
|
2175
2431
|
// make the api call
|
|
2176
|
-
const response: ApiResponse<any> = await this.apisauce.post(
|
|
2177
|
-
|
|
2432
|
+
const response: ApiResponse<any> = await this.apisauce.post(
|
|
2433
|
+
`api/v2.0/loanbrief/confirm_buy_insurance`,
|
|
2434
|
+
body
|
|
2435
|
+
);
|
|
2436
|
+
myLog(response);
|
|
2178
2437
|
// the typical ways to die when calling an api
|
|
2179
2438
|
if (!response.ok) {
|
|
2180
|
-
const problem = getGeneralApiProblem(response)
|
|
2181
|
-
if (problem) return problem
|
|
2439
|
+
const problem = getGeneralApiProblem(response);
|
|
2440
|
+
if (problem) return problem;
|
|
2182
2441
|
}
|
|
2183
2442
|
|
|
2184
2443
|
// transform the data into the format we are expecting
|
|
2185
2444
|
try {
|
|
2186
|
-
return { kind:
|
|
2445
|
+
return { kind: 'ok', data: response.data };
|
|
2187
2446
|
} catch {
|
|
2188
|
-
return { kind:
|
|
2447
|
+
return { kind: 'bad-data' };
|
|
2189
2448
|
}
|
|
2190
2449
|
}
|
|
2191
2450
|
|
|
2192
2451
|
async uploadLivenessV2(params) {
|
|
2193
2452
|
// make the api call
|
|
2194
|
-
const response: ApiResponse<any> = await this.apisauce.post(
|
|
2195
|
-
|
|
2453
|
+
const response: ApiResponse<any> = await this.apisauce.post(
|
|
2454
|
+
`api/v2.0/loanbrief/compare_face`,
|
|
2455
|
+
params
|
|
2456
|
+
);
|
|
2457
|
+
myLog('Liveness V2', response);
|
|
2196
2458
|
// the typical ways to die when calling an api
|
|
2197
2459
|
if (!response.ok) {
|
|
2198
|
-
const problem = getGeneralApiProblem(response)
|
|
2199
|
-
if (problem) return problem
|
|
2460
|
+
const problem = getGeneralApiProblem(response);
|
|
2461
|
+
if (problem) return problem;
|
|
2200
2462
|
}
|
|
2201
2463
|
|
|
2202
2464
|
// transform the data into the format we are expecting
|
|
2203
2465
|
try {
|
|
2204
|
-
return { kind:
|
|
2466
|
+
return { kind: 'ok', data: response.data };
|
|
2205
2467
|
} catch {
|
|
2206
|
-
return { kind:
|
|
2468
|
+
return { kind: 'bad-data' };
|
|
2207
2469
|
}
|
|
2208
2470
|
}
|
|
2209
2471
|
|
|
2210
2472
|
async customerCancel(params) {
|
|
2211
2473
|
// make the api call
|
|
2212
|
-
const response: ApiResponse<any> = await this.apisauce.post(
|
|
2213
|
-
|
|
2474
|
+
const response: ApiResponse<any> = await this.apisauce.post(
|
|
2475
|
+
`api/v2.0/loanbrief/customer_cancel`,
|
|
2476
|
+
params
|
|
2477
|
+
);
|
|
2478
|
+
myLog('Cancel Loan', response);
|
|
2214
2479
|
// the typical ways to die when calling an api
|
|
2215
2480
|
if (!response.ok) {
|
|
2216
|
-
const problem = getGeneralApiProblem(response)
|
|
2217
|
-
if (problem) return problem
|
|
2481
|
+
const problem = getGeneralApiProblem(response);
|
|
2482
|
+
if (problem) return problem;
|
|
2218
2483
|
}
|
|
2219
2484
|
|
|
2220
2485
|
// transform the data into the format we are expecting
|
|
2221
2486
|
try {
|
|
2222
|
-
return { kind:
|
|
2487
|
+
return { kind: 'ok', data: response.data };
|
|
2223
2488
|
} catch {
|
|
2224
|
-
return { kind:
|
|
2489
|
+
return { kind: 'bad-data' };
|
|
2225
2490
|
}
|
|
2226
2491
|
}
|
|
2227
2492
|
|
|
2228
2493
|
// Luồng tái vay
|
|
2229
2494
|
async detailLoanReborrow(id) {
|
|
2230
2495
|
// make the api call
|
|
2231
|
-
const response: ApiResponse<any> = await this.apisauce.get(
|
|
2496
|
+
const response: ApiResponse<any> = await this.apisauce.get(
|
|
2497
|
+
`api/v2.0/loanbrief/detail_reborrow?loanBriefId=${id}`
|
|
2498
|
+
);
|
|
2232
2499
|
if (!response.ok) {
|
|
2233
|
-
const problem = getGeneralApiProblem(response)
|
|
2234
|
-
if (problem) return problem
|
|
2500
|
+
const problem = getGeneralApiProblem(response);
|
|
2501
|
+
if (problem) return problem;
|
|
2235
2502
|
}
|
|
2236
2503
|
|
|
2237
2504
|
// transform the data into the format we are expecting
|
|
2238
2505
|
try {
|
|
2239
|
-
return { kind:
|
|
2506
|
+
return { kind: 'ok', data: response.data };
|
|
2240
2507
|
} catch {
|
|
2241
|
-
return { kind:
|
|
2508
|
+
return { kind: 'bad-data' };
|
|
2242
2509
|
}
|
|
2243
2510
|
}
|
|
2244
2511
|
|
|
2245
2512
|
async getJobTima() {
|
|
2246
2513
|
// make the api call
|
|
2247
|
-
const response: ApiResponse<any> = await this.apisauce.get(
|
|
2514
|
+
const response: ApiResponse<any> = await this.apisauce.get(
|
|
2515
|
+
`api/v1.0/landingpage/get_job`
|
|
2516
|
+
);
|
|
2248
2517
|
if (!response.ok) {
|
|
2249
|
-
const problem = getGeneralApiProblem(response)
|
|
2250
|
-
if (problem) return problem
|
|
2518
|
+
const problem = getGeneralApiProblem(response);
|
|
2519
|
+
if (problem) return problem;
|
|
2251
2520
|
}
|
|
2252
2521
|
// transform the data into the format we are expecting
|
|
2253
2522
|
try {
|
|
2254
|
-
return { kind:
|
|
2523
|
+
return { kind: 'ok', data: response.data };
|
|
2255
2524
|
} catch {
|
|
2256
|
-
return { kind:
|
|
2525
|
+
return { kind: 'bad-data' };
|
|
2257
2526
|
}
|
|
2258
2527
|
}
|
|
2259
2528
|
|
|
2260
2529
|
async getJobDescriptionTima(id) {
|
|
2261
2530
|
// make the api call
|
|
2262
|
-
const response: ApiResponse<any> = await this.apisauce.get(
|
|
2531
|
+
const response: ApiResponse<any> = await this.apisauce.get(
|
|
2532
|
+
`api/v1.0/landingpage/get_job_description?jobId=${id}`
|
|
2533
|
+
);
|
|
2263
2534
|
if (!response.ok) {
|
|
2264
|
-
const problem = getGeneralApiProblem(response)
|
|
2265
|
-
if (problem) return problem
|
|
2535
|
+
const problem = getGeneralApiProblem(response);
|
|
2536
|
+
if (problem) return problem;
|
|
2266
2537
|
}
|
|
2267
2538
|
// transform the data into the format we are expecting
|
|
2268
2539
|
try {
|
|
2269
|
-
return { kind:
|
|
2540
|
+
return { kind: 'ok', data: response.data };
|
|
2270
2541
|
} catch {
|
|
2271
|
-
return { kind:
|
|
2542
|
+
return { kind: 'bad-data' };
|
|
2272
2543
|
}
|
|
2273
2544
|
}
|
|
2274
2545
|
|
|
2275
2546
|
async getBanks() {
|
|
2276
2547
|
// make the api call
|
|
2277
|
-
const response: ApiResponse<any> = await this.apisauce.get(
|
|
2548
|
+
const response: ApiResponse<any> = await this.apisauce.get(
|
|
2549
|
+
`api/v1.0/landingpage/get_bank`
|
|
2550
|
+
);
|
|
2278
2551
|
if (!response.ok) {
|
|
2279
|
-
const problem = getGeneralApiProblem(response)
|
|
2280
|
-
if (problem) return problem
|
|
2552
|
+
const problem = getGeneralApiProblem(response);
|
|
2553
|
+
if (problem) return problem;
|
|
2281
2554
|
}
|
|
2282
2555
|
// transform the data into the format we are expecting
|
|
2283
2556
|
try {
|
|
2284
|
-
return { kind:
|
|
2557
|
+
return { kind: 'ok', data: response.data };
|
|
2285
2558
|
} catch {
|
|
2286
|
-
return { kind:
|
|
2559
|
+
return { kind: 'bad-data' };
|
|
2287
2560
|
}
|
|
2288
2561
|
}
|
|
2289
2562
|
|
|
2290
2563
|
async updateLoanReborrow(body) {
|
|
2291
2564
|
// make the api call
|
|
2292
|
-
const response: ApiResponse<any> = await this.apisauce.post(
|
|
2565
|
+
const response: ApiResponse<any> = await this.apisauce.post(
|
|
2566
|
+
`api/v2.0/loanbrief/init_reborrow`,
|
|
2567
|
+
body
|
|
2568
|
+
);
|
|
2293
2569
|
console.log(response);
|
|
2294
2570
|
|
|
2295
2571
|
if (!response.ok) {
|
|
2296
|
-
const problem = getGeneralApiProblem(response)
|
|
2297
|
-
if (problem) return problem
|
|
2572
|
+
const problem = getGeneralApiProblem(response);
|
|
2573
|
+
if (problem) return problem;
|
|
2298
2574
|
}
|
|
2299
2575
|
// transform the data into the format we are expecting
|
|
2300
2576
|
try {
|
|
2301
|
-
return { kind:
|
|
2577
|
+
return { kind: 'ok', data: response.data };
|
|
2302
2578
|
} catch {
|
|
2303
|
-
return { kind:
|
|
2579
|
+
return { kind: 'bad-data' };
|
|
2304
2580
|
}
|
|
2305
2581
|
}
|
|
2306
2582
|
|
|
2307
2583
|
async getPaymentScheduleTima(id) {
|
|
2308
2584
|
// make the api call
|
|
2309
|
-
const response: ApiResponse<any> = await this.apisauce.get(
|
|
2310
|
-
|
|
2585
|
+
const response: ApiResponse<any> = await this.apisauce.get(
|
|
2586
|
+
`api/v2.0/loanbrief/payment_schedule_tima?loanBriefId=${id}`
|
|
2587
|
+
);
|
|
2588
|
+
myLog(response);
|
|
2311
2589
|
// the typical ways to die when calling an api
|
|
2312
2590
|
if (!response.ok) {
|
|
2313
|
-
const problem = getGeneralApiProblem(response)
|
|
2314
|
-
if (problem) return problem
|
|
2591
|
+
const problem = getGeneralApiProblem(response);
|
|
2592
|
+
if (problem) return problem;
|
|
2315
2593
|
}
|
|
2316
2594
|
|
|
2317
2595
|
// transform the data into the format we are expecting
|
|
2318
2596
|
try {
|
|
2319
|
-
return { kind:
|
|
2597
|
+
return { kind: 'ok', data: response.data };
|
|
2320
2598
|
} catch {
|
|
2321
|
-
return { kind:
|
|
2599
|
+
return { kind: 'bad-data' };
|
|
2322
2600
|
}
|
|
2323
2601
|
}
|
|
2324
2602
|
|
|
2325
2603
|
async confirmRule(loandID) {
|
|
2326
2604
|
// make the api call
|
|
2327
|
-
const response: ApiResponse<any> = await this.apisauce.post(
|
|
2328
|
-
|
|
2329
|
-
|
|
2330
|
-
|
|
2605
|
+
const response: ApiResponse<any> = await this.apisauce.post(
|
|
2606
|
+
`api/v2.0/loanbrief/log_confirm_tima_rules`,
|
|
2607
|
+
{
|
|
2608
|
+
LoanBriefId: loandID,
|
|
2609
|
+
}
|
|
2610
|
+
);
|
|
2611
|
+
myLog(response);
|
|
2331
2612
|
// the typical ways to die when calling an api
|
|
2332
2613
|
if (!response.ok) {
|
|
2333
|
-
const problem = getGeneralApiProblem(response)
|
|
2334
|
-
if (problem) return problem
|
|
2614
|
+
const problem = getGeneralApiProblem(response);
|
|
2615
|
+
if (problem) return problem;
|
|
2335
2616
|
}
|
|
2336
2617
|
|
|
2337
2618
|
// transform the data into the format we are expecting
|
|
2338
2619
|
try {
|
|
2339
|
-
return { kind:
|
|
2620
|
+
return { kind: 'ok', data: response.data };
|
|
2340
2621
|
} catch {
|
|
2341
|
-
return { kind:
|
|
2622
|
+
return { kind: 'bad-data' };
|
|
2342
2623
|
}
|
|
2343
2624
|
}
|
|
2344
2625
|
|
|
2345
2626
|
async addNfcData(body: any) {
|
|
2346
2627
|
// make the api call
|
|
2347
|
-
const response: ApiResponse<any> = await this.apisauce.post(
|
|
2348
|
-
|
|
2628
|
+
const response: ApiResponse<any> = await this.apisauce.post(
|
|
2629
|
+
`api/v1.0/timacare/add_nfc_raw`,
|
|
2630
|
+
body
|
|
2631
|
+
);
|
|
2632
|
+
myLog(response);
|
|
2349
2633
|
// the typical ways to die when calling an api
|
|
2350
2634
|
if (!response.ok) {
|
|
2351
|
-
const problem = getGeneralApiProblem(response)
|
|
2352
|
-
if (problem) return problem
|
|
2635
|
+
const problem = getGeneralApiProblem(response);
|
|
2636
|
+
if (problem) return problem;
|
|
2353
2637
|
}
|
|
2354
2638
|
// transform the data into the format we are expecting
|
|
2355
2639
|
try {
|
|
2356
|
-
return { kind:
|
|
2640
|
+
return { kind: 'ok', data: response.data };
|
|
2357
2641
|
} catch {
|
|
2358
|
-
return { kind:
|
|
2642
|
+
return { kind: 'bad-data' };
|
|
2359
2643
|
}
|
|
2360
2644
|
}
|
|
2361
2645
|
|
|
2362
2646
|
async verifyLiveness(body: any) {
|
|
2363
2647
|
// make the api call
|
|
2364
|
-
const response: ApiResponse<any> = await this.apisauce.post(
|
|
2365
|
-
|
|
2648
|
+
const response: ApiResponse<any> = await this.apisauce.post(
|
|
2649
|
+
`api/v1.0/timacare/livenessv2`,
|
|
2650
|
+
body
|
|
2651
|
+
);
|
|
2652
|
+
myLog(response);
|
|
2366
2653
|
// the typical ways to die when calling an api
|
|
2367
2654
|
if (!response.ok) {
|
|
2368
|
-
const problem = getGeneralApiProblem(response)
|
|
2369
|
-
if (problem) return problem
|
|
2655
|
+
const problem = getGeneralApiProblem(response);
|
|
2656
|
+
if (problem) return problem;
|
|
2370
2657
|
}
|
|
2371
2658
|
// transform the data into the format we are expecting
|
|
2372
2659
|
try {
|
|
2373
|
-
return { kind:
|
|
2660
|
+
return { kind: 'ok', data: response.data };
|
|
2374
2661
|
} catch {
|
|
2375
|
-
return { kind:
|
|
2662
|
+
return { kind: 'bad-data' };
|
|
2376
2663
|
}
|
|
2377
2664
|
}
|
|
2378
2665
|
|
|
2379
2666
|
async verifyLiveness2(body: any) {
|
|
2380
2667
|
// make the api call
|
|
2381
|
-
const response: ApiResponse<any> = await this.apisauce.post(
|
|
2382
|
-
|
|
2668
|
+
const response: ApiResponse<any> = await this.apisauce.post(
|
|
2669
|
+
`api/v2.0/autode/liveness`,
|
|
2670
|
+
body
|
|
2671
|
+
);
|
|
2672
|
+
myLog(response);
|
|
2383
2673
|
// the typical ways to die when calling an api
|
|
2384
2674
|
if (!response.ok) {
|
|
2385
|
-
const problem = getGeneralApiProblem(response)
|
|
2386
|
-
if (problem) return problem
|
|
2675
|
+
const problem = getGeneralApiProblem(response);
|
|
2676
|
+
if (problem) return problem;
|
|
2387
2677
|
}
|
|
2388
2678
|
// transform the data into the format we are expecting
|
|
2389
2679
|
try {
|
|
2390
|
-
return { kind:
|
|
2680
|
+
return { kind: 'ok', data: response.data };
|
|
2391
2681
|
} catch {
|
|
2392
|
-
return { kind:
|
|
2682
|
+
return { kind: 'bad-data' };
|
|
2393
2683
|
}
|
|
2394
2684
|
}
|
|
2395
2685
|
|
|
2396
2686
|
async saveImages(body: any) {
|
|
2397
2687
|
// make the api call
|
|
2398
|
-
const response: ApiResponse<any> = await this.apisauce.post(
|
|
2399
|
-
|
|
2688
|
+
const response: ApiResponse<any> = await this.apisauce.post(
|
|
2689
|
+
`api/v1.0/timacare/save_image_liveness`,
|
|
2690
|
+
body
|
|
2691
|
+
);
|
|
2692
|
+
myLog(response);
|
|
2400
2693
|
// the typical ways to die when calling an api
|
|
2401
2694
|
if (!response.ok) {
|
|
2402
|
-
const problem = getGeneralApiProblem(response)
|
|
2403
|
-
if (problem) return problem
|
|
2695
|
+
const problem = getGeneralApiProblem(response);
|
|
2696
|
+
if (problem) return problem;
|
|
2404
2697
|
}
|
|
2405
2698
|
// transform the data into the format we are expecting
|
|
2406
2699
|
try {
|
|
2407
|
-
return { kind:
|
|
2700
|
+
return { kind: 'ok', data: response.data };
|
|
2408
2701
|
} catch {
|
|
2409
|
-
return { kind:
|
|
2702
|
+
return { kind: 'bad-data' };
|
|
2410
2703
|
}
|
|
2411
2704
|
}
|
|
2412
2705
|
|
|
2413
2706
|
async getActionLiveness() {
|
|
2414
2707
|
// make the api call
|
|
2415
|
-
const response: ApiResponse<any> = await this.apisauce.get(
|
|
2416
|
-
|
|
2708
|
+
const response: ApiResponse<any> = await this.apisauce.get(
|
|
2709
|
+
`api/v1.0/timacare/get_action_liveness`
|
|
2710
|
+
);
|
|
2711
|
+
myLog(response);
|
|
2417
2712
|
// the typical ways to die when calling an api
|
|
2418
2713
|
if (!response.ok) {
|
|
2419
|
-
const problem = getGeneralApiProblem(response)
|
|
2420
|
-
if (problem) return problem
|
|
2714
|
+
const problem = getGeneralApiProblem(response);
|
|
2715
|
+
if (problem) return problem;
|
|
2421
2716
|
}
|
|
2422
2717
|
// transform the data into the format we are expecting
|
|
2423
2718
|
try {
|
|
2424
|
-
return { kind:
|
|
2719
|
+
return { kind: 'ok', data: response.data };
|
|
2425
2720
|
} catch {
|
|
2426
|
-
return { kind:
|
|
2721
|
+
return { kind: 'bad-data' };
|
|
2427
2722
|
}
|
|
2428
2723
|
}
|
|
2429
2724
|
|
|
2430
2725
|
async getConfigLiveness() {
|
|
2431
2726
|
// make the api call
|
|
2432
|
-
const response: ApiResponse<any> = await this.apisauce.get(
|
|
2727
|
+
const response: ApiResponse<any> = await this.apisauce.get(
|
|
2728
|
+
`api/v1.0/timacare/get_config_liveness`
|
|
2729
|
+
);
|
|
2433
2730
|
// the typical ways to die when calling an api
|
|
2434
2731
|
if (!response.ok) {
|
|
2435
|
-
const problem = getGeneralApiProblem(response)
|
|
2436
|
-
if (problem) return problem
|
|
2732
|
+
const problem = getGeneralApiProblem(response);
|
|
2733
|
+
if (problem) return problem;
|
|
2437
2734
|
}
|
|
2438
2735
|
// transform the data into the format we are expecting
|
|
2439
2736
|
try {
|
|
2440
|
-
return { kind:
|
|
2737
|
+
return { kind: 'ok', data: response.data };
|
|
2441
2738
|
} catch {
|
|
2442
|
-
return { kind:
|
|
2739
|
+
return { kind: 'bad-data' };
|
|
2443
2740
|
}
|
|
2444
2741
|
}
|
|
2445
2742
|
|
|
2446
2743
|
async getConfigOcr() {
|
|
2447
2744
|
// make the api call
|
|
2448
|
-
const response: ApiResponse<any> = await this.apisauce.get(
|
|
2745
|
+
const response: ApiResponse<any> = await this.apisauce.get(
|
|
2746
|
+
`api/v1.0/timacare/get_config_ocr_image`
|
|
2747
|
+
);
|
|
2449
2748
|
// the typical ways to die when calling an api
|
|
2450
2749
|
if (!response.ok) {
|
|
2451
|
-
const problem = getGeneralApiProblem(response)
|
|
2452
|
-
if (problem) return problem
|
|
2750
|
+
const problem = getGeneralApiProblem(response);
|
|
2751
|
+
if (problem) return problem;
|
|
2453
2752
|
}
|
|
2454
2753
|
// transform the data into the format we are expecting
|
|
2455
2754
|
try {
|
|
2456
|
-
return { kind:
|
|
2755
|
+
return { kind: 'ok', data: response.data };
|
|
2457
2756
|
} catch {
|
|
2458
|
-
return { kind:
|
|
2757
|
+
return { kind: 'bad-data' };
|
|
2459
2758
|
}
|
|
2460
2759
|
}
|
|
2461
2760
|
|
|
2462
2761
|
async previewContract(loanId) {
|
|
2463
2762
|
// make the api call
|
|
2464
|
-
const response: ApiResponse<any> = await this.apisauce.get(
|
|
2763
|
+
const response: ApiResponse<any> = await this.apisauce.get(
|
|
2764
|
+
`api/v1.0/esign/view_esign_contract?loanBriefId=${loanId}`
|
|
2765
|
+
);
|
|
2465
2766
|
// the typical ways to die when calling an api
|
|
2466
2767
|
if (!response.ok) {
|
|
2467
|
-
const problem = getGeneralApiProblem(response)
|
|
2468
|
-
if (problem) return problem
|
|
2768
|
+
const problem = getGeneralApiProblem(response);
|
|
2769
|
+
if (problem) return problem;
|
|
2469
2770
|
}
|
|
2470
2771
|
// transform the data into the format we are expecting
|
|
2471
2772
|
try {
|
|
2472
|
-
return { kind:
|
|
2773
|
+
return { kind: 'ok', data: response.data };
|
|
2473
2774
|
} catch {
|
|
2474
|
-
return { kind:
|
|
2775
|
+
return { kind: 'bad-data' };
|
|
2475
2776
|
}
|
|
2476
2777
|
}
|
|
2477
2778
|
|
|
2478
2779
|
async getPlanPaymentTima(loanId) {
|
|
2479
2780
|
// make the api call
|
|
2480
|
-
const response: ApiResponse<any> = await this.apisauce.get(
|
|
2781
|
+
const response: ApiResponse<any> = await this.apisauce.get(
|
|
2782
|
+
`api/v2.0/loanbrief/payment_plan_tima?id=${loanId}`
|
|
2783
|
+
);
|
|
2481
2784
|
// the typical ways to die when calling an api
|
|
2482
2785
|
if (!response.ok) {
|
|
2483
|
-
const problem = getGeneralApiProblem(response)
|
|
2484
|
-
if (problem) return problem
|
|
2786
|
+
const problem = getGeneralApiProblem(response);
|
|
2787
|
+
if (problem) return problem;
|
|
2485
2788
|
}
|
|
2486
2789
|
// transform the data into the format we are expecting
|
|
2487
2790
|
try {
|
|
2488
|
-
return { kind:
|
|
2791
|
+
return { kind: 'ok', data: response.data };
|
|
2489
2792
|
} catch {
|
|
2490
|
-
return { kind:
|
|
2793
|
+
return { kind: 'bad-data' };
|
|
2491
2794
|
}
|
|
2492
2795
|
}
|
|
2493
2796
|
|
|
2494
2797
|
async getQrPayment(body) {
|
|
2495
2798
|
// make the api call
|
|
2496
|
-
const response: ApiResponse<any> = await this.apisauce.post(
|
|
2497
|
-
|
|
2799
|
+
const response: ApiResponse<any> = await this.apisauce.post(
|
|
2800
|
+
`api/v2.0/loanbrief/qr_payment_tima`,
|
|
2801
|
+
body
|
|
2802
|
+
);
|
|
2803
|
+
myLog(response);
|
|
2498
2804
|
// the typical ways to die when calling an api
|
|
2499
2805
|
if (!response.ok) {
|
|
2500
|
-
const problem = getGeneralApiProblem(response)
|
|
2501
|
-
if (problem) return problem
|
|
2806
|
+
const problem = getGeneralApiProblem(response);
|
|
2807
|
+
if (problem) return problem;
|
|
2502
2808
|
}
|
|
2503
2809
|
// transform the data into the format we are expecting
|
|
2504
2810
|
try {
|
|
2505
|
-
return { kind:
|
|
2811
|
+
return { kind: 'ok', data: response.data };
|
|
2506
2812
|
} catch {
|
|
2507
|
-
return { kind:
|
|
2813
|
+
return { kind: 'bad-data' };
|
|
2508
2814
|
}
|
|
2509
2815
|
}
|
|
2510
2816
|
|
|
2511
|
-
|
|
2512
2817
|
async getInfoUpdateTopup(id) {
|
|
2513
2818
|
// make the api call
|
|
2514
|
-
const response: ApiResponse<any> = await this.apisauce.get(
|
|
2515
|
-
|
|
2819
|
+
const response: ApiResponse<any> = await this.apisauce.get(
|
|
2820
|
+
`api/v2.0/loanbrief/get_info_update_topup?id=${id}`
|
|
2821
|
+
);
|
|
2822
|
+
myLog(response);
|
|
2516
2823
|
// the typical ways to die when calling an api
|
|
2517
2824
|
if (!response.ok) {
|
|
2518
|
-
const problem = getGeneralApiProblem(response)
|
|
2519
|
-
if (problem) return problem
|
|
2825
|
+
const problem = getGeneralApiProblem(response);
|
|
2826
|
+
if (problem) return problem;
|
|
2520
2827
|
}
|
|
2521
2828
|
// transform the data into the format we are expecting
|
|
2522
2829
|
try {
|
|
2523
|
-
return { kind:
|
|
2830
|
+
return { kind: 'ok', data: response.data };
|
|
2524
2831
|
} catch {
|
|
2525
|
-
return { kind:
|
|
2832
|
+
return { kind: 'bad-data' };
|
|
2526
2833
|
}
|
|
2527
2834
|
}
|
|
2528
2835
|
|
|
2529
2836
|
async getLoanTimeAll() {
|
|
2530
2837
|
// make the api call
|
|
2531
|
-
const response: ApiResponse<any> = await this.apisauce.get(
|
|
2532
|
-
|
|
2838
|
+
const response: ApiResponse<any> = await this.apisauce.get(
|
|
2839
|
+
`api/v1.0/landingpage/get_loan_time_all`
|
|
2840
|
+
);
|
|
2841
|
+
myLog(response);
|
|
2533
2842
|
// the typical ways to die when calling an api
|
|
2534
2843
|
if (!response.ok) {
|
|
2535
|
-
const problem = getGeneralApiProblem(response)
|
|
2536
|
-
if (problem) return problem
|
|
2844
|
+
const problem = getGeneralApiProblem(response);
|
|
2845
|
+
if (problem) return problem;
|
|
2537
2846
|
}
|
|
2538
2847
|
// transform the data into the format we are expecting
|
|
2539
2848
|
try {
|
|
2540
|
-
return { kind:
|
|
2849
|
+
return { kind: 'ok', data: response.data };
|
|
2541
2850
|
} catch {
|
|
2542
|
-
return { kind:
|
|
2851
|
+
return { kind: 'bad-data' };
|
|
2543
2852
|
}
|
|
2544
2853
|
}
|
|
2545
2854
|
|
|
2546
2855
|
async getRateTypeAll() {
|
|
2547
2856
|
// make the api call
|
|
2548
|
-
const response: ApiResponse<any> = await this.apisauce.get(
|
|
2549
|
-
|
|
2857
|
+
const response: ApiResponse<any> = await this.apisauce.get(
|
|
2858
|
+
`api/v1.0/landingpage/get_rate_type_all`
|
|
2859
|
+
);
|
|
2860
|
+
myLog(response);
|
|
2550
2861
|
// the typical ways to die when calling an api
|
|
2551
2862
|
if (!response.ok) {
|
|
2552
|
-
const problem = getGeneralApiProblem(response)
|
|
2553
|
-
if (problem) return problem
|
|
2863
|
+
const problem = getGeneralApiProblem(response);
|
|
2864
|
+
if (problem) return problem;
|
|
2554
2865
|
}
|
|
2555
2866
|
// transform the data into the format we are expecting
|
|
2556
2867
|
try {
|
|
2557
|
-
return { kind:
|
|
2868
|
+
return { kind: 'ok', data: response.data };
|
|
2558
2869
|
} catch {
|
|
2559
|
-
return { kind:
|
|
2870
|
+
return { kind: 'bad-data' };
|
|
2560
2871
|
}
|
|
2561
2872
|
}
|
|
2562
2873
|
|
|
2563
2874
|
async getRateTypeAllNew() {
|
|
2564
2875
|
// make the api call
|
|
2565
|
-
const response: ApiResponse<any> = await this.apisauce.get(
|
|
2566
|
-
|
|
2876
|
+
const response: ApiResponse<any> = await this.apisauce.get(
|
|
2877
|
+
`api/v2.0/autodev2/get_rate_type`
|
|
2878
|
+
);
|
|
2879
|
+
myLog(response);
|
|
2567
2880
|
// the typical ways to die when calling an api
|
|
2568
2881
|
if (!response.ok) {
|
|
2569
|
-
const problem = getGeneralApiProblem(response)
|
|
2570
|
-
if (problem) return problem
|
|
2882
|
+
const problem = getGeneralApiProblem(response);
|
|
2883
|
+
if (problem) return problem;
|
|
2571
2884
|
}
|
|
2572
2885
|
// transform the data into the format we are expecting
|
|
2573
2886
|
try {
|
|
2574
|
-
return { kind:
|
|
2887
|
+
return { kind: 'ok', data: response.data };
|
|
2575
2888
|
} catch {
|
|
2576
|
-
return { kind:
|
|
2889
|
+
return { kind: 'bad-data' };
|
|
2577
2890
|
}
|
|
2578
2891
|
}
|
|
2579
2892
|
|
|
2580
2893
|
async getInsurenceTimeAll() {
|
|
2581
2894
|
// make the api call
|
|
2582
|
-
const response: ApiResponse<any> = await this.apisauce.get(
|
|
2583
|
-
|
|
2895
|
+
const response: ApiResponse<any> = await this.apisauce.get(
|
|
2896
|
+
`api/v1.0/landingpage/get_insurence_time_all`
|
|
2897
|
+
);
|
|
2898
|
+
myLog(response);
|
|
2584
2899
|
// the typical ways to die when calling an api
|
|
2585
2900
|
if (!response.ok) {
|
|
2586
|
-
const problem = getGeneralApiProblem(response)
|
|
2587
|
-
if (problem) return problem
|
|
2901
|
+
const problem = getGeneralApiProblem(response);
|
|
2902
|
+
if (problem) return problem;
|
|
2588
2903
|
}
|
|
2589
2904
|
// transform the data into the format we are expecting
|
|
2590
2905
|
try {
|
|
2591
|
-
return { kind:
|
|
2906
|
+
return { kind: 'ok', data: response.data };
|
|
2592
2907
|
} catch {
|
|
2593
|
-
return { kind:
|
|
2908
|
+
return { kind: 'bad-data' };
|
|
2594
2909
|
}
|
|
2595
2910
|
}
|
|
2596
2911
|
|
|
2597
2912
|
async getFirstDayPayment(id, type) {
|
|
2598
2913
|
// make the api call
|
|
2599
|
-
const response: ApiResponse<any> = await this.apisauce.get(
|
|
2600
|
-
|
|
2914
|
+
const response: ApiResponse<any> = await this.apisauce.get(
|
|
2915
|
+
`api/v2.0/loanbrief/get_first_payment_date?id=${id}&typeLoan=${type}`
|
|
2916
|
+
);
|
|
2917
|
+
myLog(response);
|
|
2601
2918
|
// the typical ways to die when calling an api
|
|
2602
2919
|
if (!response.ok) {
|
|
2603
|
-
const problem = getGeneralApiProblem(response)
|
|
2604
|
-
if (problem) return problem
|
|
2920
|
+
const problem = getGeneralApiProblem(response);
|
|
2921
|
+
if (problem) return problem;
|
|
2605
2922
|
}
|
|
2606
2923
|
// transform the data into the format we are expecting
|
|
2607
2924
|
try {
|
|
2608
|
-
return { kind:
|
|
2925
|
+
return { kind: 'ok', data: response.data };
|
|
2609
2926
|
} catch {
|
|
2610
|
-
return { kind:
|
|
2927
|
+
return { kind: 'bad-data' };
|
|
2611
2928
|
}
|
|
2612
2929
|
}
|
|
2613
2930
|
|
|
2614
|
-
async getInfoInsurence(
|
|
2931
|
+
async getInfoInsurence(
|
|
2932
|
+
id,
|
|
2933
|
+
loanAmount,
|
|
2934
|
+
loanTime,
|
|
2935
|
+
rateTypeId,
|
|
2936
|
+
timeInsurenceCustomer,
|
|
2937
|
+
timeInsuranceProperty
|
|
2938
|
+
) {
|
|
2615
2939
|
// make the api call
|
|
2616
|
-
const response: ApiResponse<any> = await this.apisauce.get(
|
|
2617
|
-
|
|
2940
|
+
const response: ApiResponse<any> = await this.apisauce.get(
|
|
2941
|
+
`api/v2.0/loanbrief/reget_info_insurence?id=${id}&loanAmount=${loanAmount}&loanTime=${loanTime}&rateTypeId=${rateTypeId}&timeInsurenceCustomer=${timeInsurenceCustomer}&timeInsuranceProperty=${timeInsuranceProperty}`
|
|
2942
|
+
);
|
|
2943
|
+
myLog(response);
|
|
2618
2944
|
// the typical ways to die when calling an api
|
|
2619
2945
|
if (!response.ok) {
|
|
2620
|
-
const problem = getGeneralApiProblem(response)
|
|
2621
|
-
if (problem) return problem
|
|
2946
|
+
const problem = getGeneralApiProblem(response);
|
|
2947
|
+
if (problem) return problem;
|
|
2622
2948
|
}
|
|
2623
2949
|
// transform the data into the format we are expecting
|
|
2624
2950
|
try {
|
|
2625
|
-
return { kind:
|
|
2951
|
+
return { kind: 'ok', data: response.data };
|
|
2626
2952
|
} catch {
|
|
2627
|
-
return { kind:
|
|
2953
|
+
return { kind: 'bad-data' };
|
|
2628
2954
|
}
|
|
2629
2955
|
}
|
|
2630
2956
|
|
|
2631
2957
|
async updateInfoTopup(body) {
|
|
2632
2958
|
// make the api call
|
|
2633
|
-
const response: ApiResponse<any> = await this.apisauce.post(
|
|
2634
|
-
|
|
2959
|
+
const response: ApiResponse<any> = await this.apisauce.post(
|
|
2960
|
+
'api/v2.0/loanbrief/update_info_topup',
|
|
2961
|
+
body
|
|
2962
|
+
);
|
|
2963
|
+
myLog(response);
|
|
2635
2964
|
// the typical ways to die when calling an api
|
|
2636
2965
|
if (!response.ok) {
|
|
2637
|
-
const problem = getGeneralApiProblem(response)
|
|
2638
|
-
if (problem) return problem
|
|
2966
|
+
const problem = getGeneralApiProblem(response);
|
|
2967
|
+
if (problem) return problem;
|
|
2639
2968
|
}
|
|
2640
2969
|
// transform the data into the format we are expecting
|
|
2641
2970
|
try {
|
|
2642
|
-
return { kind:
|
|
2971
|
+
return { kind: 'ok', data: response.data };
|
|
2643
2972
|
} catch {
|
|
2644
|
-
return { kind:
|
|
2973
|
+
return { kind: 'bad-data' };
|
|
2645
2974
|
}
|
|
2646
2975
|
}
|
|
2647
2976
|
|
|
2648
2977
|
async getPlanPaymentV2(id) {
|
|
2649
2978
|
// make the api call
|
|
2650
|
-
const response: ApiResponse<any> = await this.apisauce.get(
|
|
2651
|
-
|
|
2979
|
+
const response: ApiResponse<any> = await this.apisauce.get(
|
|
2980
|
+
`api/v2.0/loanbrief/payment_plan_tima_v2?id=${id}`
|
|
2981
|
+
);
|
|
2982
|
+
myLog(response);
|
|
2652
2983
|
// the typical ways to die when calling an api
|
|
2653
2984
|
if (!response.ok) {
|
|
2654
|
-
const problem = getGeneralApiProblem(response)
|
|
2655
|
-
if (problem) return problem
|
|
2985
|
+
const problem = getGeneralApiProblem(response);
|
|
2986
|
+
if (problem) return problem;
|
|
2656
2987
|
}
|
|
2657
2988
|
// transform the data into the format we are expecting
|
|
2658
2989
|
try {
|
|
2659
|
-
return { kind:
|
|
2990
|
+
return { kind: 'ok', data: response.data };
|
|
2660
2991
|
} catch {
|
|
2661
|
-
return { kind:
|
|
2992
|
+
return { kind: 'bad-data' };
|
|
2662
2993
|
}
|
|
2663
2994
|
}
|
|
2664
2995
|
|
|
2665
|
-
|
|
2666
2996
|
// toàn trình số
|
|
2667
2997
|
//api update chứng từ để ocr
|
|
2668
2998
|
async uploadImageOcr(data) {
|
|
2669
2999
|
// make the api call
|
|
2670
|
-
const response: ApiResponse<any> = await this.apisauce.post(
|
|
3000
|
+
const response: ApiResponse<any> = await this.apisauce.post(
|
|
3001
|
+
`api/v2.0/autode/upload_image`,
|
|
3002
|
+
data,
|
|
3003
|
+
{ headers: { 'Content-Type': 'multipart/form-data' } }
|
|
3004
|
+
);
|
|
2671
3005
|
// the typical ways to die when calling an api
|
|
2672
3006
|
if (!response.ok) {
|
|
2673
|
-
const problem = getGeneralApiProblem(response)
|
|
2674
|
-
if (problem) return problem
|
|
3007
|
+
const problem = getGeneralApiProblem(response);
|
|
3008
|
+
if (problem) return problem;
|
|
2675
3009
|
}
|
|
2676
3010
|
// transform the data into the format we are expecting
|
|
2677
3011
|
try {
|
|
2678
|
-
return { kind:
|
|
3012
|
+
return { kind: 'ok', data: response.data };
|
|
2679
3013
|
} catch {
|
|
2680
|
-
return { kind:
|
|
3014
|
+
return { kind: 'bad-data' };
|
|
2681
3015
|
}
|
|
2682
3016
|
}
|
|
2683
3017
|
|
|
2684
3018
|
// api lưu thông tin nfc
|
|
2685
3019
|
async saveNfcInfo(data) {
|
|
2686
3020
|
// make the api call
|
|
2687
|
-
const response: ApiResponse<any> = await this.apisauce.post(
|
|
3021
|
+
const response: ApiResponse<any> = await this.apisauce.post(
|
|
3022
|
+
`api/v2.0/autode/save_info_nfc`,
|
|
3023
|
+
data
|
|
3024
|
+
);
|
|
2688
3025
|
// the typical ways to die when calling an api
|
|
2689
3026
|
if (!response.ok) {
|
|
2690
|
-
const problem = getGeneralApiProblem(response)
|
|
2691
|
-
if (problem) return problem
|
|
3027
|
+
const problem = getGeneralApiProblem(response);
|
|
3028
|
+
if (problem) return problem;
|
|
2692
3029
|
}
|
|
2693
3030
|
// transform the data into the format we are expecting
|
|
2694
3031
|
try {
|
|
2695
|
-
return { kind:
|
|
3032
|
+
return { kind: 'ok', data: response.data };
|
|
2696
3033
|
} catch {
|
|
2697
|
-
return { kind:
|
|
3034
|
+
return { kind: 'bad-data' };
|
|
2698
3035
|
}
|
|
2699
3036
|
}
|
|
2700
3037
|
|
|
2701
3038
|
// Lấy thông tin khách hàng (luồng mới)
|
|
2702
3039
|
async getInfoCustomer(id) {
|
|
2703
3040
|
// make the api call
|
|
2704
|
-
const response: ApiResponse<any> = await this.apisauce.get(
|
|
3041
|
+
const response: ApiResponse<any> = await this.apisauce.get(
|
|
3042
|
+
`api/v2.0/autode/get_info_customer?loanBriefId=${id}`
|
|
3043
|
+
);
|
|
2705
3044
|
// the typical ways to die when calling an api
|
|
2706
3045
|
if (!response.ok) {
|
|
2707
|
-
const problem = getGeneralApiProblem(response)
|
|
2708
|
-
if (problem) return problem
|
|
3046
|
+
const problem = getGeneralApiProblem(response);
|
|
3047
|
+
if (problem) return problem;
|
|
2709
3048
|
}
|
|
2710
3049
|
// transform the data into the format we are expecting
|
|
2711
3050
|
try {
|
|
2712
|
-
return { kind:
|
|
3051
|
+
return { kind: 'ok', data: response.data };
|
|
2713
3052
|
} catch {
|
|
2714
|
-
return { kind:
|
|
3053
|
+
return { kind: 'bad-data' };
|
|
2715
3054
|
}
|
|
2716
3055
|
}
|
|
2717
3056
|
|
|
2718
3057
|
// Lấy thông tin khách hàng (luồng mới)
|
|
2719
3058
|
async getInfoCustomerV2(id) {
|
|
2720
3059
|
// make the api call
|
|
2721
|
-
const response: ApiResponse<any> = await this.apisauce.get(
|
|
3060
|
+
const response: ApiResponse<any> = await this.apisauce.get(
|
|
3061
|
+
`api/v2.0/autodev2/get_info_customer?loanBriefId=${id}`
|
|
3062
|
+
);
|
|
2722
3063
|
// the typical ways to die when calling an api
|
|
2723
3064
|
if (!response.ok) {
|
|
2724
|
-
const problem = getGeneralApiProblem(response)
|
|
2725
|
-
if (problem) return problem
|
|
3065
|
+
const problem = getGeneralApiProblem(response);
|
|
3066
|
+
if (problem) return problem;
|
|
2726
3067
|
}
|
|
2727
3068
|
// transform the data into the format we are expecting
|
|
2728
3069
|
try {
|
|
2729
|
-
return { kind:
|
|
3070
|
+
return { kind: 'ok', data: response.data };
|
|
2730
3071
|
} catch {
|
|
2731
|
-
return { kind:
|
|
3072
|
+
return { kind: 'bad-data' };
|
|
2732
3073
|
}
|
|
2733
3074
|
}
|
|
2734
3075
|
|
|
@@ -2736,17 +3077,20 @@ export class Api {
|
|
|
2736
3077
|
|
|
2737
3078
|
async updateInfoCustomer(body) {
|
|
2738
3079
|
// make the api call
|
|
2739
|
-
const response: ApiResponse<any> = await this.apisauce.post(
|
|
3080
|
+
const response: ApiResponse<any> = await this.apisauce.post(
|
|
3081
|
+
`api/v2.0/autode/update_info_customer`,
|
|
3082
|
+
body
|
|
3083
|
+
);
|
|
2740
3084
|
// the typical ways to die when calling an api
|
|
2741
3085
|
if (!response.ok) {
|
|
2742
|
-
const problem = getGeneralApiProblem(response)
|
|
2743
|
-
if (problem) return problem
|
|
3086
|
+
const problem = getGeneralApiProblem(response);
|
|
3087
|
+
if (problem) return problem;
|
|
2744
3088
|
}
|
|
2745
3089
|
// transform the data into the format we are expecting
|
|
2746
3090
|
try {
|
|
2747
|
-
return { kind:
|
|
3091
|
+
return { kind: 'ok', data: response.data };
|
|
2748
3092
|
} catch {
|
|
2749
|
-
return { kind:
|
|
3093
|
+
return { kind: 'bad-data' };
|
|
2750
3094
|
}
|
|
2751
3095
|
}
|
|
2752
3096
|
|
|
@@ -2754,682 +3098,829 @@ export class Api {
|
|
|
2754
3098
|
|
|
2755
3099
|
async updateInfoCustomerV2(body) {
|
|
2756
3100
|
// make the api call
|
|
2757
|
-
const response: ApiResponse<any> = await this.apisauce.post(
|
|
3101
|
+
const response: ApiResponse<any> = await this.apisauce.post(
|
|
3102
|
+
`api/v2.0/autodev2/update_info_customer`,
|
|
3103
|
+
body
|
|
3104
|
+
);
|
|
2758
3105
|
// the typical ways to die when calling an api
|
|
2759
3106
|
if (!response.ok) {
|
|
2760
|
-
const problem = getGeneralApiProblem(response)
|
|
2761
|
-
if (problem) return problem
|
|
3107
|
+
const problem = getGeneralApiProblem(response);
|
|
3108
|
+
if (problem) return problem;
|
|
2762
3109
|
}
|
|
2763
3110
|
// transform the data into the format we are expecting
|
|
2764
3111
|
try {
|
|
2765
|
-
return { kind:
|
|
3112
|
+
return { kind: 'ok', data: response.data };
|
|
2766
3113
|
} catch {
|
|
2767
|
-
return { kind:
|
|
3114
|
+
return { kind: 'bad-data' };
|
|
2768
3115
|
}
|
|
2769
3116
|
}
|
|
2770
3117
|
|
|
2771
3118
|
// Lấy thông tin khoản vay (luồng mới)
|
|
2772
3119
|
async getInfoLoan(id) {
|
|
2773
3120
|
// make the api call
|
|
2774
|
-
const response: ApiResponse<any> = await this.apisauce.get(
|
|
3121
|
+
const response: ApiResponse<any> = await this.apisauce.get(
|
|
3122
|
+
`api/v2.0/autode/get_info_borrow?loanBriefId=${id}`
|
|
3123
|
+
);
|
|
2775
3124
|
// the typical ways to die when calling an api
|
|
2776
3125
|
if (!response.ok) {
|
|
2777
|
-
const problem = getGeneralApiProblem(response)
|
|
2778
|
-
if (problem) return problem
|
|
3126
|
+
const problem = getGeneralApiProblem(response);
|
|
3127
|
+
if (problem) return problem;
|
|
2779
3128
|
}
|
|
2780
3129
|
// transform the data into the format we are expecting
|
|
2781
3130
|
try {
|
|
2782
|
-
return { kind:
|
|
3131
|
+
return { kind: 'ok', data: response.data };
|
|
2783
3132
|
} catch {
|
|
2784
|
-
return { kind:
|
|
3133
|
+
return { kind: 'bad-data' };
|
|
2785
3134
|
}
|
|
2786
3135
|
}
|
|
2787
3136
|
|
|
2788
|
-
async getInfoInsurence2(
|
|
3137
|
+
async getInfoInsurence2(
|
|
3138
|
+
id,
|
|
3139
|
+
loanAmount,
|
|
3140
|
+
loanTime,
|
|
3141
|
+
rateTypeId,
|
|
3142
|
+
timeInsurenceCustomer,
|
|
3143
|
+
timeInsuranceProperty
|
|
3144
|
+
) {
|
|
2789
3145
|
// make the api call
|
|
2790
|
-
const response: ApiResponse<any> = await this.apisauce.get(
|
|
2791
|
-
|
|
3146
|
+
const response: ApiResponse<any> = await this.apisauce.get(
|
|
3147
|
+
`api/v2.0/autode/reget_info_insurence?id=${id}&loanAmount=${loanAmount}&loanTime=${loanTime}&rateTypeId=${rateTypeId}&timeInsurenceCustomer=${timeInsurenceCustomer}&timeInsuranceProperty=${timeInsuranceProperty}`
|
|
3148
|
+
);
|
|
3149
|
+
myLog(response);
|
|
2792
3150
|
// the typical ways to die when calling an api
|
|
2793
3151
|
if (!response.ok) {
|
|
2794
|
-
const problem = getGeneralApiProblem(response)
|
|
2795
|
-
if (problem) return problem
|
|
3152
|
+
const problem = getGeneralApiProblem(response);
|
|
3153
|
+
if (problem) return problem;
|
|
2796
3154
|
}
|
|
2797
3155
|
// transform the data into the format we are expecting
|
|
2798
3156
|
try {
|
|
2799
|
-
return { kind:
|
|
3157
|
+
return { kind: 'ok', data: response.data };
|
|
2800
3158
|
} catch {
|
|
2801
|
-
return { kind:
|
|
3159
|
+
return { kind: 'bad-data' };
|
|
2802
3160
|
}
|
|
2803
3161
|
}
|
|
2804
3162
|
|
|
2805
3163
|
async getBrandCar() {
|
|
2806
3164
|
// make the api call
|
|
2807
|
-
const response: ApiResponse<any> = await this.apisauce.get(
|
|
3165
|
+
const response: ApiResponse<any> = await this.apisauce.get(
|
|
3166
|
+
`api/v1.0/dictionary/get_brand_car`
|
|
3167
|
+
);
|
|
2808
3168
|
// the typical ways to die when calling an api
|
|
2809
3169
|
if (!response.ok) {
|
|
2810
|
-
const problem = getGeneralApiProblem(response)
|
|
2811
|
-
if (problem) return problem
|
|
3170
|
+
const problem = getGeneralApiProblem(response);
|
|
3171
|
+
if (problem) return problem;
|
|
2812
3172
|
}
|
|
2813
3173
|
// transform the data into the format we are expecting
|
|
2814
3174
|
try {
|
|
2815
|
-
return { kind:
|
|
3175
|
+
return { kind: 'ok', data: response.data };
|
|
2816
3176
|
} catch {
|
|
2817
|
-
return { kind:
|
|
3177
|
+
return { kind: 'bad-data' };
|
|
2818
3178
|
}
|
|
2819
3179
|
}
|
|
2820
3180
|
|
|
2821
3181
|
async getYearCar(name) {
|
|
2822
3182
|
// make the api call
|
|
2823
|
-
const response: ApiResponse<any> = await this.apisauce.get(
|
|
3183
|
+
const response: ApiResponse<any> = await this.apisauce.get(
|
|
3184
|
+
`api/v1.0/dictionary/get_year_car?brand=${name}`
|
|
3185
|
+
);
|
|
2824
3186
|
// the typical ways to die when calling an api
|
|
2825
3187
|
if (!response.ok) {
|
|
2826
|
-
const problem = getGeneralApiProblem(response)
|
|
2827
|
-
if (problem) return problem
|
|
3188
|
+
const problem = getGeneralApiProblem(response);
|
|
3189
|
+
if (problem) return problem;
|
|
2828
3190
|
}
|
|
2829
3191
|
// transform the data into the format we are expecting
|
|
2830
3192
|
try {
|
|
2831
|
-
return { kind:
|
|
3193
|
+
return { kind: 'ok', data: response.data };
|
|
2832
3194
|
} catch {
|
|
2833
|
-
return { kind:
|
|
3195
|
+
return { kind: 'bad-data' };
|
|
2834
3196
|
}
|
|
2835
3197
|
}
|
|
2836
3198
|
|
|
2837
3199
|
async getNameCar(name, year) {
|
|
2838
3200
|
// make the api call
|
|
2839
|
-
const response: ApiResponse<any> = await this.apisauce.get(
|
|
3201
|
+
const response: ApiResponse<any> = await this.apisauce.get(
|
|
3202
|
+
`api/v1.0/dictionary/get_vehicles_car?brand=${name}&year=${year}`
|
|
3203
|
+
);
|
|
2840
3204
|
// the typical ways to die when calling an api
|
|
2841
3205
|
if (!response.ok) {
|
|
2842
|
-
const problem = getGeneralApiProblem(response)
|
|
2843
|
-
if (problem) return problem
|
|
3206
|
+
const problem = getGeneralApiProblem(response);
|
|
3207
|
+
if (problem) return problem;
|
|
2844
3208
|
}
|
|
2845
3209
|
// transform the data into the format we are expecting
|
|
2846
3210
|
try {
|
|
2847
|
-
return { kind:
|
|
3211
|
+
return { kind: 'ok', data: response.data };
|
|
2848
3212
|
} catch {
|
|
2849
|
-
return { kind:
|
|
3213
|
+
return { kind: 'bad-data' };
|
|
2850
3214
|
}
|
|
2851
3215
|
}
|
|
2852
3216
|
|
|
2853
3217
|
async updateInfoLoan(body) {
|
|
2854
3218
|
// make the api call
|
|
2855
|
-
const response: ApiResponse<any> = await this.apisauce.post(
|
|
3219
|
+
const response: ApiResponse<any> = await this.apisauce.post(
|
|
3220
|
+
`api/v2.0/autode/update_info_borrow`,
|
|
3221
|
+
body
|
|
3222
|
+
);
|
|
2856
3223
|
// the typical ways to die when calling an api
|
|
2857
3224
|
if (!response.ok) {
|
|
2858
|
-
const problem = getGeneralApiProblem(response)
|
|
2859
|
-
if (problem) return problem
|
|
3225
|
+
const problem = getGeneralApiProblem(response);
|
|
3226
|
+
if (problem) return problem;
|
|
2860
3227
|
}
|
|
2861
3228
|
// transform the data into the format we are expecting
|
|
2862
3229
|
try {
|
|
2863
|
-
return { kind:
|
|
3230
|
+
return { kind: 'ok', data: response.data };
|
|
2864
3231
|
} catch {
|
|
2865
|
-
return { kind:
|
|
3232
|
+
return { kind: 'bad-data' };
|
|
2866
3233
|
}
|
|
2867
3234
|
}
|
|
2868
3235
|
|
|
2869
3236
|
async updateInfoLoanV2(body) {
|
|
2870
3237
|
// make the api call
|
|
2871
|
-
const response: ApiResponse<any> = await this.apisauce.post(
|
|
3238
|
+
const response: ApiResponse<any> = await this.apisauce.post(
|
|
3239
|
+
`api/v2.0/autodev2/update_info_loan`,
|
|
3240
|
+
body
|
|
3241
|
+
);
|
|
2872
3242
|
// the typical ways to die when calling an api
|
|
2873
3243
|
if (!response.ok) {
|
|
2874
|
-
const problem = getGeneralApiProblem(response)
|
|
2875
|
-
if (problem) return problem
|
|
3244
|
+
const problem = getGeneralApiProblem(response);
|
|
3245
|
+
if (problem) return problem;
|
|
2876
3246
|
}
|
|
2877
3247
|
// transform the data into the format we are expecting
|
|
2878
3248
|
try {
|
|
2879
|
-
return { kind:
|
|
3249
|
+
return { kind: 'ok', data: response.data };
|
|
2880
3250
|
} catch {
|
|
2881
|
-
return { kind:
|
|
3251
|
+
return { kind: 'bad-data' };
|
|
2882
3252
|
}
|
|
2883
3253
|
}
|
|
2884
3254
|
|
|
2885
3255
|
// Lấy thông tin công việc (luồng mới)
|
|
2886
3256
|
async getInfoJob(id) {
|
|
2887
3257
|
// make the api call
|
|
2888
|
-
const response: ApiResponse<any> = await this.apisauce.get(
|
|
3258
|
+
const response: ApiResponse<any> = await this.apisauce.get(
|
|
3259
|
+
`api/v2.0/autode/get_info_job?loanBriefId=${id}`
|
|
3260
|
+
);
|
|
2889
3261
|
// the typical ways to die when calling an api
|
|
2890
3262
|
if (!response.ok) {
|
|
2891
|
-
const problem = getGeneralApiProblem(response)
|
|
2892
|
-
if (problem) return problem
|
|
3263
|
+
const problem = getGeneralApiProblem(response);
|
|
3264
|
+
if (problem) return problem;
|
|
2893
3265
|
}
|
|
2894
3266
|
// transform the data into the format we are expecting
|
|
2895
3267
|
try {
|
|
2896
|
-
return { kind:
|
|
3268
|
+
return { kind: 'ok', data: response.data };
|
|
2897
3269
|
} catch {
|
|
2898
|
-
return { kind:
|
|
3270
|
+
return { kind: 'bad-data' };
|
|
2899
3271
|
}
|
|
2900
3272
|
}
|
|
2901
3273
|
|
|
2902
3274
|
// Lấy thông tin công việc (luồng mới)
|
|
2903
3275
|
async getInfoJobV2(id) {
|
|
2904
3276
|
// make the api call
|
|
2905
|
-
const response: ApiResponse<any> = await this.apisauce.get(
|
|
3277
|
+
const response: ApiResponse<any> = await this.apisauce.get(
|
|
3278
|
+
`api/v2.0/autodev2/get_info_job?loanBriefId=${id}`
|
|
3279
|
+
);
|
|
2906
3280
|
// the typical ways to die when calling an api
|
|
2907
3281
|
if (!response.ok) {
|
|
2908
|
-
const problem = getGeneralApiProblem(response)
|
|
2909
|
-
if (problem) return problem
|
|
3282
|
+
const problem = getGeneralApiProblem(response);
|
|
3283
|
+
if (problem) return problem;
|
|
2910
3284
|
}
|
|
2911
3285
|
// transform the data into the format we are expecting
|
|
2912
3286
|
try {
|
|
2913
|
-
return { kind:
|
|
3287
|
+
return { kind: 'ok', data: response.data };
|
|
2914
3288
|
} catch {
|
|
2915
|
-
return { kind:
|
|
3289
|
+
return { kind: 'bad-data' };
|
|
2916
3290
|
}
|
|
2917
3291
|
}
|
|
2918
3292
|
|
|
2919
3293
|
async updateInfoJob(body) {
|
|
2920
3294
|
// make the api call
|
|
2921
|
-
const response: ApiResponse<any> = await this.apisauce.post(
|
|
3295
|
+
const response: ApiResponse<any> = await this.apisauce.post(
|
|
3296
|
+
`api/v2.0/autode/update_info_job`,
|
|
3297
|
+
body
|
|
3298
|
+
);
|
|
2922
3299
|
// the typical ways to die when calling an api
|
|
2923
3300
|
if (!response.ok) {
|
|
2924
|
-
const problem = getGeneralApiProblem(response)
|
|
2925
|
-
if (problem) return problem
|
|
3301
|
+
const problem = getGeneralApiProblem(response);
|
|
3302
|
+
if (problem) return problem;
|
|
2926
3303
|
}
|
|
2927
3304
|
// transform the data into the format we are expecting
|
|
2928
3305
|
try {
|
|
2929
|
-
return { kind:
|
|
3306
|
+
return { kind: 'ok', data: response.data };
|
|
2930
3307
|
} catch {
|
|
2931
|
-
return { kind:
|
|
3308
|
+
return { kind: 'bad-data' };
|
|
2932
3309
|
}
|
|
2933
3310
|
}
|
|
2934
3311
|
|
|
2935
3312
|
async updateInfoJobV2(body) {
|
|
2936
3313
|
// make the api call
|
|
2937
|
-
const response: ApiResponse<any> = await this.apisauce.post(
|
|
3314
|
+
const response: ApiResponse<any> = await this.apisauce.post(
|
|
3315
|
+
`api/v2.0/autodev2/update_info_job`,
|
|
3316
|
+
body
|
|
3317
|
+
);
|
|
2938
3318
|
// the typical ways to die when calling an api
|
|
2939
3319
|
if (!response.ok) {
|
|
2940
|
-
const problem = getGeneralApiProblem(response)
|
|
2941
|
-
if (problem) return problem
|
|
3320
|
+
const problem = getGeneralApiProblem(response);
|
|
3321
|
+
if (problem) return problem;
|
|
2942
3322
|
}
|
|
2943
3323
|
// transform the data into the format we are expecting
|
|
2944
3324
|
try {
|
|
2945
|
-
return { kind:
|
|
3325
|
+
return { kind: 'ok', data: response.data };
|
|
2946
3326
|
} catch {
|
|
2947
|
-
return { kind:
|
|
3327
|
+
return { kind: 'bad-data' };
|
|
2948
3328
|
}
|
|
2949
3329
|
}
|
|
2950
3330
|
|
|
2951
3331
|
async getRelationship() {
|
|
2952
3332
|
// make the api call
|
|
2953
|
-
const response: ApiResponse<any> = await this.apisauce.get(
|
|
3333
|
+
const response: ApiResponse<any> = await this.apisauce.get(
|
|
3334
|
+
`api/v1.0/landingpage/get_relative_family`
|
|
3335
|
+
);
|
|
2954
3336
|
// the typical ways to die when calling an api
|
|
2955
3337
|
if (!response.ok) {
|
|
2956
|
-
const problem = getGeneralApiProblem(response)
|
|
2957
|
-
if (problem) return problem
|
|
3338
|
+
const problem = getGeneralApiProblem(response);
|
|
3339
|
+
if (problem) return problem;
|
|
2958
3340
|
}
|
|
2959
3341
|
// transform the data into the format we are expecting
|
|
2960
3342
|
try {
|
|
2961
|
-
return { kind:
|
|
3343
|
+
return { kind: 'ok', data: response.data };
|
|
2962
3344
|
} catch {
|
|
2963
|
-
return { kind:
|
|
3345
|
+
return { kind: 'bad-data' };
|
|
2964
3346
|
}
|
|
2965
3347
|
}
|
|
2966
3348
|
|
|
2967
3349
|
async getPaymentPlan(id) {
|
|
2968
3350
|
// make the api call
|
|
2969
|
-
const response: ApiResponse<any> = await this.apisauce.get(
|
|
3351
|
+
const response: ApiResponse<any> = await this.apisauce.get(
|
|
3352
|
+
`api/v2.0/autode/payment_plan_tima?loanBriefId=${id}`
|
|
3353
|
+
);
|
|
2970
3354
|
// the typical ways to die when calling an api
|
|
2971
3355
|
if (!response.ok) {
|
|
2972
|
-
const problem = getGeneralApiProblem(response)
|
|
2973
|
-
if (problem) return problem
|
|
3356
|
+
const problem = getGeneralApiProblem(response);
|
|
3357
|
+
if (problem) return problem;
|
|
2974
3358
|
}
|
|
2975
3359
|
// transform the data into the format we are expecting
|
|
2976
3360
|
try {
|
|
2977
|
-
return { kind:
|
|
3361
|
+
return { kind: 'ok', data: response.data };
|
|
2978
3362
|
} catch {
|
|
2979
|
-
return { kind:
|
|
3363
|
+
return { kind: 'bad-data' };
|
|
2980
3364
|
}
|
|
2981
3365
|
}
|
|
2982
3366
|
|
|
2983
3367
|
async changePipeline(body) {
|
|
2984
3368
|
// make the api call
|
|
2985
|
-
const response: ApiResponse<any> = await this.apisauce.post(
|
|
3369
|
+
const response: ApiResponse<any> = await this.apisauce.post(
|
|
3370
|
+
`api/v2.0/autode/change_pipeline`,
|
|
3371
|
+
body
|
|
3372
|
+
);
|
|
2986
3373
|
// the typical ways to die when calling an api
|
|
2987
3374
|
if (!response.ok) {
|
|
2988
|
-
const problem = getGeneralApiProblem(response)
|
|
2989
|
-
if (problem) return problem
|
|
3375
|
+
const problem = getGeneralApiProblem(response);
|
|
3376
|
+
if (problem) return problem;
|
|
2990
3377
|
}
|
|
2991
3378
|
// transform the data into the format we are expecting
|
|
2992
3379
|
try {
|
|
2993
|
-
return { kind:
|
|
3380
|
+
return { kind: 'ok', data: response.data };
|
|
2994
3381
|
} catch {
|
|
2995
|
-
return { kind:
|
|
3382
|
+
return { kind: 'bad-data' };
|
|
2996
3383
|
}
|
|
2997
3384
|
}
|
|
2998
3385
|
|
|
2999
3386
|
async getFirstPaymentTTS(id) {
|
|
3000
3387
|
// make the api call
|
|
3001
|
-
const response: ApiResponse<any> = await this.apisauce.get(
|
|
3388
|
+
const response: ApiResponse<any> = await this.apisauce.get(
|
|
3389
|
+
`api/v2.0/autode/get_first_payment_date?id=${id}`
|
|
3390
|
+
);
|
|
3002
3391
|
// the typical ways to die when calling an api
|
|
3003
3392
|
if (!response.ok) {
|
|
3004
|
-
const problem = getGeneralApiProblem(response)
|
|
3005
|
-
if (problem) return problem
|
|
3393
|
+
const problem = getGeneralApiProblem(response);
|
|
3394
|
+
if (problem) return problem;
|
|
3006
3395
|
}
|
|
3007
3396
|
// transform the data into the format we are expecting
|
|
3008
3397
|
try {
|
|
3009
|
-
return { kind:
|
|
3398
|
+
return { kind: 'ok', data: response.data };
|
|
3010
3399
|
} catch {
|
|
3011
|
-
return { kind:
|
|
3400
|
+
return { kind: 'bad-data' };
|
|
3012
3401
|
}
|
|
3013
3402
|
}
|
|
3014
3403
|
|
|
3015
3404
|
async getFirstPaymentTTSV2(id) {
|
|
3016
3405
|
// make the api call
|
|
3017
|
-
const response: ApiResponse<any> = await this.apisauce.get(
|
|
3406
|
+
const response: ApiResponse<any> = await this.apisauce.get(
|
|
3407
|
+
`api/v2.0/autodev2/get_first_payment_date?id=${id}`
|
|
3408
|
+
);
|
|
3018
3409
|
// the typical ways to die when calling an api
|
|
3019
3410
|
if (!response.ok) {
|
|
3020
|
-
const problem = getGeneralApiProblem(response)
|
|
3021
|
-
if (problem) return problem
|
|
3411
|
+
const problem = getGeneralApiProblem(response);
|
|
3412
|
+
if (problem) return problem;
|
|
3022
3413
|
}
|
|
3023
3414
|
// transform the data into the format we are expecting
|
|
3024
3415
|
try {
|
|
3025
|
-
return { kind:
|
|
3416
|
+
return { kind: 'ok', data: response.data };
|
|
3026
3417
|
} catch {
|
|
3027
|
-
return { kind:
|
|
3418
|
+
return { kind: 'bad-data' };
|
|
3028
3419
|
}
|
|
3029
3420
|
}
|
|
3030
3421
|
|
|
3031
3422
|
async verifySign(body) {
|
|
3032
3423
|
// make the api call
|
|
3033
|
-
const response: ApiResponse<any> = await this.apisauce.post(
|
|
3424
|
+
const response: ApiResponse<any> = await this.apisauce.post(
|
|
3425
|
+
`api/v2.0/autode/transactions_secured`,
|
|
3426
|
+
body
|
|
3427
|
+
);
|
|
3034
3428
|
// the typical ways to die when calling an api
|
|
3035
3429
|
if (!response.ok) {
|
|
3036
|
-
const problem = getGeneralApiProblem(response)
|
|
3037
|
-
if (problem) return problem
|
|
3430
|
+
const problem = getGeneralApiProblem(response);
|
|
3431
|
+
if (problem) return problem;
|
|
3038
3432
|
}
|
|
3039
3433
|
// transform the data into the format we are expecting
|
|
3040
3434
|
try {
|
|
3041
|
-
return { kind:
|
|
3435
|
+
return { kind: 'ok', data: response.data };
|
|
3042
3436
|
} catch {
|
|
3043
|
-
return { kind:
|
|
3437
|
+
return { kind: 'bad-data' };
|
|
3044
3438
|
}
|
|
3045
3439
|
}
|
|
3046
3440
|
|
|
3047
3441
|
async getInfoLoanTopupTts(id) {
|
|
3048
3442
|
// make the api call
|
|
3049
|
-
const response: ApiResponse<any> = await this.apisauce.get(
|
|
3443
|
+
const response: ApiResponse<any> = await this.apisauce.get(
|
|
3444
|
+
`api/v2.0/autode/get_info_borrow_topup?loanBriefId=${id}`
|
|
3445
|
+
);
|
|
3050
3446
|
// the typical ways to die when calling an api
|
|
3051
3447
|
if (!response.ok) {
|
|
3052
|
-
const problem = getGeneralApiProblem(response)
|
|
3053
|
-
if (problem) return problem
|
|
3448
|
+
const problem = getGeneralApiProblem(response);
|
|
3449
|
+
if (problem) return problem;
|
|
3054
3450
|
}
|
|
3055
3451
|
// transform the data into the format we are expecting
|
|
3056
3452
|
try {
|
|
3057
|
-
return { kind:
|
|
3453
|
+
return { kind: 'ok', data: response.data };
|
|
3058
3454
|
} catch {
|
|
3059
|
-
return { kind:
|
|
3455
|
+
return { kind: 'bad-data' };
|
|
3060
3456
|
}
|
|
3061
3457
|
}
|
|
3062
3458
|
|
|
3063
3459
|
async updateInfoLoanTopup(body) {
|
|
3064
3460
|
// make the api call
|
|
3065
|
-
const response: ApiResponse<any> = await this.apisauce.post(
|
|
3461
|
+
const response: ApiResponse<any> = await this.apisauce.post(
|
|
3462
|
+
`api/v2.0/autode/update_info_borrow_topup`,
|
|
3463
|
+
body
|
|
3464
|
+
);
|
|
3066
3465
|
// the typical ways to die when calling an api
|
|
3067
3466
|
if (!response.ok) {
|
|
3068
|
-
const problem = getGeneralApiProblem(response)
|
|
3069
|
-
if (problem) return problem
|
|
3467
|
+
const problem = getGeneralApiProblem(response);
|
|
3468
|
+
if (problem) return problem;
|
|
3070
3469
|
}
|
|
3071
3470
|
// transform the data into the format we are expecting
|
|
3072
3471
|
try {
|
|
3073
|
-
return { kind:
|
|
3472
|
+
return { kind: 'ok', data: response.data };
|
|
3074
3473
|
} catch {
|
|
3075
|
-
return { kind:
|
|
3474
|
+
return { kind: 'bad-data' };
|
|
3076
3475
|
}
|
|
3077
3476
|
}
|
|
3078
3477
|
|
|
3079
3478
|
async getLoanTimeByType(rateTypeId, typeLoan) {
|
|
3080
3479
|
// make the api call
|
|
3081
|
-
const response: ApiResponse<any> = await this.apisauce.get(
|
|
3480
|
+
const response: ApiResponse<any> = await this.apisauce.get(
|
|
3481
|
+
`api/v2.0/autodev2/get_loan_time?rateTypeId=${rateTypeId}`
|
|
3482
|
+
);
|
|
3082
3483
|
// the typical ways to die when calling an api
|
|
3083
3484
|
if (!response.ok) {
|
|
3084
|
-
const problem = getGeneralApiProblem(response)
|
|
3085
|
-
if (problem) return problem
|
|
3485
|
+
const problem = getGeneralApiProblem(response);
|
|
3486
|
+
if (problem) return problem;
|
|
3086
3487
|
}
|
|
3087
3488
|
// transform the data into the format we are expecting
|
|
3088
3489
|
try {
|
|
3089
|
-
return { kind:
|
|
3490
|
+
return { kind: 'ok', data: response.data };
|
|
3090
3491
|
} catch {
|
|
3091
|
-
return { kind:
|
|
3492
|
+
return { kind: 'bad-data' };
|
|
3092
3493
|
}
|
|
3093
3494
|
}
|
|
3094
3495
|
|
|
3095
|
-
async sign_viettel_for_borrower(body: {
|
|
3096
|
-
loanBriefId: number,
|
|
3097
|
-
}) {
|
|
3496
|
+
async sign_viettel_for_borrower(body: { loanBriefId: number }) {
|
|
3098
3497
|
// make the api call
|
|
3099
|
-
const response: ApiResponse<any> = await this.apisauce.post(
|
|
3498
|
+
const response: ApiResponse<any> = await this.apisauce.post(
|
|
3499
|
+
`api/v1.0/esign/sign_viettel_for_borrower`,
|
|
3500
|
+
body
|
|
3501
|
+
);
|
|
3100
3502
|
// the typical ways to die when calling an api
|
|
3101
3503
|
if (!response.ok) {
|
|
3102
|
-
const problem = getGeneralApiProblem(response)
|
|
3103
|
-
if (problem) return problem
|
|
3504
|
+
const problem = getGeneralApiProblem(response);
|
|
3505
|
+
if (problem) return problem;
|
|
3104
3506
|
}
|
|
3105
3507
|
// transform the data into the format we are expecting
|
|
3106
3508
|
try {
|
|
3107
|
-
return { kind:
|
|
3509
|
+
return { kind: 'ok', data: response.data };
|
|
3108
3510
|
} catch {
|
|
3109
|
-
return { kind:
|
|
3511
|
+
return { kind: 'bad-data' };
|
|
3110
3512
|
}
|
|
3111
3513
|
}
|
|
3112
3514
|
|
|
3113
3515
|
async sign_viettel_for_borrower_cimb(body: {
|
|
3114
|
-
loanBriefId: number
|
|
3115
|
-
isTermesEtConditions: boolean
|
|
3516
|
+
loanBriefId: number;
|
|
3517
|
+
isTermesEtConditions: boolean;
|
|
3116
3518
|
}) {
|
|
3117
3519
|
// make the api call
|
|
3118
|
-
const response: ApiResponse<any> = await this.apisauce.post(
|
|
3520
|
+
const response: ApiResponse<any> = await this.apisauce.post(
|
|
3521
|
+
`api/v1.0/esign/sign_viettel_for_borrower_cimb`,
|
|
3522
|
+
body
|
|
3523
|
+
);
|
|
3119
3524
|
// the typical ways to die when calling an api
|
|
3120
3525
|
if (!response.ok) {
|
|
3121
|
-
const problem = getGeneralApiProblem(response)
|
|
3122
|
-
if (problem) return problem
|
|
3526
|
+
const problem = getGeneralApiProblem(response);
|
|
3527
|
+
if (problem) return problem;
|
|
3123
3528
|
}
|
|
3124
3529
|
// transform the data into the format we are expecting
|
|
3125
3530
|
try {
|
|
3126
|
-
return { kind:
|
|
3531
|
+
return { kind: 'ok', data: response.data };
|
|
3127
3532
|
} catch {
|
|
3128
|
-
return { kind:
|
|
3533
|
+
return { kind: 'bad-data' };
|
|
3129
3534
|
}
|
|
3130
3535
|
}
|
|
3131
3536
|
|
|
3132
3537
|
async uploadImageAutoDE(data) {
|
|
3133
3538
|
// make the api call
|
|
3134
|
-
const response: ApiResponse<any> = await this.apisauce.post(
|
|
3539
|
+
const response: ApiResponse<any> = await this.apisauce.post(
|
|
3540
|
+
`api/v2.0/autodev2/upload_image`,
|
|
3541
|
+
data,
|
|
3542
|
+
{ headers: { 'Content-Type': 'multipart/form-data' } }
|
|
3543
|
+
);
|
|
3135
3544
|
// the typical ways to die when calling an api
|
|
3136
3545
|
if (!response.ok) {
|
|
3137
|
-
const problem = getGeneralApiProblem(response)
|
|
3138
|
-
if (problem) return problem
|
|
3546
|
+
const problem = getGeneralApiProblem(response);
|
|
3547
|
+
if (problem) return problem;
|
|
3139
3548
|
}
|
|
3140
3549
|
// transform the data into the format we are expecting
|
|
3141
3550
|
try {
|
|
3142
|
-
return { kind:
|
|
3551
|
+
return { kind: 'ok', data: response.data };
|
|
3143
3552
|
} catch {
|
|
3144
|
-
return { kind:
|
|
3553
|
+
return { kind: 'bad-data' };
|
|
3145
3554
|
}
|
|
3146
3555
|
}
|
|
3147
3556
|
|
|
3148
3557
|
async getAssetAutoDE(id: any) {
|
|
3149
3558
|
// make the api call
|
|
3150
|
-
const response: ApiResponse<any> = await this.apisauce.get(
|
|
3559
|
+
const response: ApiResponse<any> = await this.apisauce.get(
|
|
3560
|
+
`api/v2.0/autodev2/get_info_property?loanBriefId=${id}`
|
|
3561
|
+
);
|
|
3151
3562
|
// the typical ways to die when calling an api
|
|
3152
3563
|
if (!response.ok) {
|
|
3153
|
-
const problem = getGeneralApiProblem(response)
|
|
3154
|
-
if (problem) return problem
|
|
3564
|
+
const problem = getGeneralApiProblem(response);
|
|
3565
|
+
if (problem) return problem;
|
|
3155
3566
|
}
|
|
3156
3567
|
// transform the data into the format we are expecting
|
|
3157
3568
|
try {
|
|
3158
|
-
return { kind:
|
|
3569
|
+
return { kind: 'ok', data: response.data };
|
|
3159
3570
|
} catch {
|
|
3160
|
-
return { kind:
|
|
3571
|
+
return { kind: 'bad-data' };
|
|
3161
3572
|
}
|
|
3162
3573
|
}
|
|
3163
3574
|
|
|
3164
3575
|
async getAssetLoanBuyCar(id: any) {
|
|
3165
3576
|
// make the api call
|
|
3166
|
-
const response: ApiResponse<any> = await this.apisauce.get(
|
|
3577
|
+
const response: ApiResponse<any> = await this.apisauce.get(
|
|
3578
|
+
`api/v2.0/autodev2/get_info_property_vaymuaxe?loanBriefId=${id}`
|
|
3579
|
+
);
|
|
3167
3580
|
// the typical ways to die when calling an api
|
|
3168
3581
|
if (!response.ok) {
|
|
3169
|
-
const problem = getGeneralApiProblem(response)
|
|
3170
|
-
if (problem) return problem
|
|
3582
|
+
const problem = getGeneralApiProblem(response);
|
|
3583
|
+
if (problem) return problem;
|
|
3171
3584
|
}
|
|
3172
3585
|
// transform the data into the format we are expecting
|
|
3173
3586
|
try {
|
|
3174
|
-
return { kind:
|
|
3587
|
+
return { kind: 'ok', data: response.data };
|
|
3175
3588
|
} catch {
|
|
3176
|
-
return { kind:
|
|
3589
|
+
return { kind: 'bad-data' };
|
|
3177
3590
|
}
|
|
3178
3591
|
}
|
|
3179
3592
|
|
|
3180
3593
|
async updateAssetAutoDE(body: any) {
|
|
3181
3594
|
// make the api call
|
|
3182
|
-
const response: ApiResponse<any> = await this.apisauce.post(
|
|
3595
|
+
const response: ApiResponse<any> = await this.apisauce.post(
|
|
3596
|
+
`api/v2.0/autodev2/update_info_property`,
|
|
3597
|
+
body
|
|
3598
|
+
);
|
|
3183
3599
|
// the typical ways to die when calling an api
|
|
3184
3600
|
if (!response.ok) {
|
|
3185
|
-
const problem = getGeneralApiProblem(response)
|
|
3186
|
-
if (problem) return problem
|
|
3601
|
+
const problem = getGeneralApiProblem(response);
|
|
3602
|
+
if (problem) return problem;
|
|
3187
3603
|
}
|
|
3188
3604
|
// transform the data into the format we are expecting
|
|
3189
3605
|
try {
|
|
3190
|
-
return { kind:
|
|
3606
|
+
return { kind: 'ok', data: response.data };
|
|
3191
3607
|
} catch {
|
|
3192
|
-
return { kind:
|
|
3608
|
+
return { kind: 'bad-data' };
|
|
3193
3609
|
}
|
|
3194
3610
|
}
|
|
3195
3611
|
|
|
3196
3612
|
async updateAssetLoanBuyCar(body: any) {
|
|
3197
3613
|
// make the api call
|
|
3198
|
-
const response: ApiResponse<any> = await this.apisauce.post(
|
|
3614
|
+
const response: ApiResponse<any> = await this.apisauce.post(
|
|
3615
|
+
`api/v2.0/autodev2/update_info_property_vaymuaxe`,
|
|
3616
|
+
body
|
|
3617
|
+
);
|
|
3199
3618
|
// the typical ways to die when calling an api
|
|
3200
3619
|
if (!response.ok) {
|
|
3201
|
-
const problem = getGeneralApiProblem(response)
|
|
3202
|
-
if (problem) return problem
|
|
3620
|
+
const problem = getGeneralApiProblem(response);
|
|
3621
|
+
if (problem) return problem;
|
|
3203
3622
|
}
|
|
3204
3623
|
// transform the data into the format we are expecting
|
|
3205
3624
|
try {
|
|
3206
|
-
return { kind:
|
|
3625
|
+
return { kind: 'ok', data: response.data };
|
|
3207
3626
|
} catch {
|
|
3208
|
-
return { kind:
|
|
3627
|
+
return { kind: 'bad-data' };
|
|
3209
3628
|
}
|
|
3210
3629
|
}
|
|
3211
3630
|
|
|
3212
3631
|
async getInfoLoanAutoDEV2(id) {
|
|
3213
3632
|
// make the api call
|
|
3214
|
-
const response: ApiResponse<any> = await this.apisauce.get(
|
|
3633
|
+
const response: ApiResponse<any> = await this.apisauce.get(
|
|
3634
|
+
`api/v2.0/autodev2/get_info_loan?loanBriefId=${id}`
|
|
3635
|
+
);
|
|
3215
3636
|
// the typical ways to die when calling an api
|
|
3216
3637
|
if (!response.ok) {
|
|
3217
|
-
const problem = getGeneralApiProblem(response)
|
|
3218
|
-
if (problem) return problem
|
|
3638
|
+
const problem = getGeneralApiProblem(response);
|
|
3639
|
+
if (problem) return problem;
|
|
3219
3640
|
}
|
|
3220
3641
|
// transform the data into the format we are expecting
|
|
3221
3642
|
try {
|
|
3222
|
-
return { kind:
|
|
3643
|
+
return { kind: 'ok', data: response.data };
|
|
3223
3644
|
} catch {
|
|
3224
|
-
return { kind:
|
|
3645
|
+
return { kind: 'bad-data' };
|
|
3225
3646
|
}
|
|
3226
3647
|
}
|
|
3227
3648
|
|
|
3228
3649
|
async getSuggestProduct(id) {
|
|
3229
3650
|
// make the api call
|
|
3230
|
-
const response: ApiResponse<any> = await this.apisauce.get(
|
|
3651
|
+
const response: ApiResponse<any> = await this.apisauce.get(
|
|
3652
|
+
`api/v2.0/autodev2/get_product_suggerst?loanBriefId=${id}`
|
|
3653
|
+
);
|
|
3231
3654
|
// the typical ways to die when calling an api
|
|
3232
3655
|
if (!response.ok) {
|
|
3233
|
-
const problem = getGeneralApiProblem(response)
|
|
3234
|
-
if (problem) return problem
|
|
3656
|
+
const problem = getGeneralApiProblem(response);
|
|
3657
|
+
if (problem) return problem;
|
|
3235
3658
|
}
|
|
3236
3659
|
// transform the data into the format we are expecting
|
|
3237
3660
|
try {
|
|
3238
|
-
return { kind:
|
|
3661
|
+
return { kind: 'ok', data: response.data };
|
|
3239
3662
|
} catch {
|
|
3240
|
-
return { kind:
|
|
3663
|
+
return { kind: 'bad-data' };
|
|
3241
3664
|
}
|
|
3242
3665
|
}
|
|
3243
3666
|
|
|
3244
3667
|
async updateProductLoan(body) {
|
|
3245
3668
|
// make the api call
|
|
3246
|
-
const response: ApiResponse<any> = await this.apisauce.post(
|
|
3669
|
+
const response: ApiResponse<any> = await this.apisauce.post(
|
|
3670
|
+
`api/v2.0/autodev2/update_product`,
|
|
3671
|
+
body
|
|
3672
|
+
);
|
|
3247
3673
|
// the typical ways to die when calling an api
|
|
3248
3674
|
if (!response.ok) {
|
|
3249
|
-
const problem = getGeneralApiProblem(response)
|
|
3250
|
-
if (problem) return problem
|
|
3675
|
+
const problem = getGeneralApiProblem(response);
|
|
3676
|
+
if (problem) return problem;
|
|
3251
3677
|
}
|
|
3252
3678
|
// transform the data into the format we are expecting
|
|
3253
3679
|
try {
|
|
3254
|
-
return { kind:
|
|
3680
|
+
return { kind: 'ok', data: response.data };
|
|
3255
3681
|
} catch {
|
|
3256
|
-
return { kind:
|
|
3682
|
+
return { kind: 'bad-data' };
|
|
3257
3683
|
}
|
|
3258
3684
|
}
|
|
3259
3685
|
|
|
3260
3686
|
async updateInfoLoanTopupV2(body) {
|
|
3261
3687
|
// make the api call
|
|
3262
|
-
const response: ApiResponse<any> = await this.apisauce.post(
|
|
3688
|
+
const response: ApiResponse<any> = await this.apisauce.post(
|
|
3689
|
+
`api/v2.0/autodev2/update_info_customer_topup`,
|
|
3690
|
+
body
|
|
3691
|
+
);
|
|
3263
3692
|
// the typical ways to die when calling an api
|
|
3264
3693
|
if (!response.ok) {
|
|
3265
|
-
const problem = getGeneralApiProblem(response)
|
|
3266
|
-
if (problem) return problem
|
|
3694
|
+
const problem = getGeneralApiProblem(response);
|
|
3695
|
+
if (problem) return problem;
|
|
3267
3696
|
}
|
|
3268
3697
|
// transform the data into the format we are expecting
|
|
3269
3698
|
try {
|
|
3270
|
-
return { kind:
|
|
3699
|
+
return { kind: 'ok', data: response.data };
|
|
3271
3700
|
} catch {
|
|
3272
|
-
return { kind:
|
|
3701
|
+
return { kind: 'bad-data' };
|
|
3273
3702
|
}
|
|
3274
3703
|
}
|
|
3275
3704
|
|
|
3276
3705
|
async getLinkEsign(id) {
|
|
3277
3706
|
// make the api call
|
|
3278
|
-
const response: ApiResponse<any> = await this.apisauce.get(
|
|
3707
|
+
const response: ApiResponse<any> = await this.apisauce.get(
|
|
3708
|
+
`api/v1.0/esign/get_link_esign_viettel?loanBriefId=${id}`
|
|
3709
|
+
);
|
|
3279
3710
|
// the typical ways to die when calling an api
|
|
3280
3711
|
if (!response.ok) {
|
|
3281
|
-
const problem = getGeneralApiProblem(response)
|
|
3282
|
-
if (problem) return problem
|
|
3712
|
+
const problem = getGeneralApiProblem(response);
|
|
3713
|
+
if (problem) return problem;
|
|
3283
3714
|
}
|
|
3284
3715
|
// transform the data into the format we are expecting
|
|
3285
3716
|
try {
|
|
3286
|
-
return { kind:
|
|
3717
|
+
return { kind: 'ok', data: response.data };
|
|
3287
3718
|
} catch {
|
|
3288
|
-
return { kind:
|
|
3719
|
+
return { kind: 'bad-data' };
|
|
3289
3720
|
}
|
|
3290
3721
|
}
|
|
3291
3722
|
|
|
3292
3723
|
async getSuggestDigitalTopup(id) {
|
|
3293
3724
|
// make the api call
|
|
3294
|
-
const response: ApiResponse<any> = await this.apisauce.get(
|
|
3725
|
+
const response: ApiResponse<any> = await this.apisauce.get(
|
|
3726
|
+
`api/v2.0/autodev2/digital_topup_get_product_suggerst?loanBriefId=${id}`
|
|
3727
|
+
);
|
|
3295
3728
|
// the typical ways to die when calling an api
|
|
3296
3729
|
if (!response.ok) {
|
|
3297
|
-
const problem = getGeneralApiProblem(response)
|
|
3298
|
-
if (problem) return problem
|
|
3730
|
+
const problem = getGeneralApiProblem(response);
|
|
3731
|
+
if (problem) return problem;
|
|
3299
3732
|
}
|
|
3300
3733
|
// transform the data into the format we are expecting
|
|
3301
3734
|
try {
|
|
3302
|
-
return { kind:
|
|
3735
|
+
return { kind: 'ok', data: response.data };
|
|
3303
3736
|
} catch {
|
|
3304
|
-
return { kind:
|
|
3737
|
+
return { kind: 'bad-data' };
|
|
3305
3738
|
}
|
|
3306
3739
|
}
|
|
3307
3740
|
|
|
3308
3741
|
async updateDigitalProductLoan(body) {
|
|
3309
3742
|
// make the api call
|
|
3310
|
-
const response: ApiResponse<any> = await this.apisauce.post(
|
|
3743
|
+
const response: ApiResponse<any> = await this.apisauce.post(
|
|
3744
|
+
`api/v2.0/autodev2/digital_topup_update_product`,
|
|
3745
|
+
body
|
|
3746
|
+
);
|
|
3311
3747
|
// the typical ways to die when calling an api
|
|
3312
3748
|
if (!response.ok) {
|
|
3313
|
-
const problem = getGeneralApiProblem(response)
|
|
3314
|
-
if (problem) return problem
|
|
3749
|
+
const problem = getGeneralApiProblem(response);
|
|
3750
|
+
if (problem) return problem;
|
|
3315
3751
|
}
|
|
3316
3752
|
// transform the data into the format we are expecting
|
|
3317
3753
|
try {
|
|
3318
|
-
return { kind:
|
|
3754
|
+
return { kind: 'ok', data: response.data };
|
|
3319
3755
|
} catch {
|
|
3320
|
-
return { kind:
|
|
3756
|
+
return { kind: 'bad-data' };
|
|
3321
3757
|
}
|
|
3322
3758
|
}
|
|
3323
3759
|
|
|
3324
3760
|
async confirmLoanDigitalTopup(body) {
|
|
3325
3761
|
// make the api call
|
|
3326
|
-
const response: ApiResponse<any> = await this.apisauce.post(
|
|
3762
|
+
const response: ApiResponse<any> = await this.apisauce.post(
|
|
3763
|
+
`api/v2.0/autodev2/confirm_loan`,
|
|
3764
|
+
body
|
|
3765
|
+
);
|
|
3327
3766
|
// the typical ways to die when calling an api
|
|
3328
3767
|
if (!response.ok) {
|
|
3329
|
-
const problem = getGeneralApiProblem(response)
|
|
3330
|
-
if (problem) return problem
|
|
3768
|
+
const problem = getGeneralApiProblem(response);
|
|
3769
|
+
if (problem) return problem;
|
|
3331
3770
|
}
|
|
3332
3771
|
// transform the data into the format we are expecting
|
|
3333
3772
|
try {
|
|
3334
|
-
return { kind:
|
|
3773
|
+
return { kind: 'ok', data: response.data };
|
|
3335
3774
|
} catch {
|
|
3336
|
-
return { kind:
|
|
3775
|
+
return { kind: 'bad-data' };
|
|
3337
3776
|
}
|
|
3338
3777
|
}
|
|
3339
3778
|
|
|
3340
3779
|
async getMoneyCloseLoan(id) {
|
|
3341
3780
|
// make the api call
|
|
3342
|
-
const response: ApiResponse<any> = await this.apisauce.get(
|
|
3781
|
+
const response: ApiResponse<any> = await this.apisauce.get(
|
|
3782
|
+
`api/v2.0/loanbrief/get_money_close_loan?loanBriefId=${id}`
|
|
3783
|
+
);
|
|
3343
3784
|
// the typical ways to die when calling an api
|
|
3344
3785
|
if (!response.ok) {
|
|
3345
|
-
const problem = getGeneralApiProblem(response)
|
|
3346
|
-
if (problem) return problem
|
|
3786
|
+
const problem = getGeneralApiProblem(response);
|
|
3787
|
+
if (problem) return problem;
|
|
3347
3788
|
}
|
|
3348
3789
|
// transform the data into the format we are expecting
|
|
3349
3790
|
try {
|
|
3350
|
-
return { kind:
|
|
3791
|
+
return { kind: 'ok', data: response.data };
|
|
3351
3792
|
} catch {
|
|
3352
|
-
return { kind:
|
|
3793
|
+
return { kind: 'bad-data' };
|
|
3353
3794
|
}
|
|
3354
3795
|
}
|
|
3355
3796
|
|
|
3356
3797
|
async getInfoMotobikeLoan(id) {
|
|
3357
3798
|
// make the api call
|
|
3358
|
-
const response: ApiResponse<any> = await this.apisauce.get(
|
|
3799
|
+
const response: ApiResponse<any> = await this.apisauce.get(
|
|
3800
|
+
`api/v2.0/autodev2/get_info_customer_motobike?loanBriefId=${id}`
|
|
3801
|
+
);
|
|
3359
3802
|
// the typical ways to die when calling an api
|
|
3360
3803
|
if (!response.ok) {
|
|
3361
|
-
const problem = getGeneralApiProblem(response)
|
|
3362
|
-
if (problem) return problem
|
|
3804
|
+
const problem = getGeneralApiProblem(response);
|
|
3805
|
+
if (problem) return problem;
|
|
3363
3806
|
}
|
|
3364
3807
|
// transform the data into the format we are expecting
|
|
3365
3808
|
try {
|
|
3366
|
-
return { kind:
|
|
3809
|
+
return { kind: 'ok', data: response.data };
|
|
3367
3810
|
} catch {
|
|
3368
|
-
return { kind:
|
|
3811
|
+
return { kind: 'bad-data' };
|
|
3369
3812
|
}
|
|
3370
3813
|
}
|
|
3371
3814
|
|
|
3372
3815
|
async getInfoMotobikeLoan2(id) {
|
|
3373
3816
|
// make the api call
|
|
3374
|
-
const response: ApiResponse<any> = await this.apisauce.get(
|
|
3817
|
+
const response: ApiResponse<any> = await this.apisauce.get(
|
|
3818
|
+
`api/v2.0/autodev2/get_info_loan_motobike?loanBriefId=${id}`
|
|
3819
|
+
);
|
|
3375
3820
|
// the typical ways to die when calling an api
|
|
3376
3821
|
if (!response.ok) {
|
|
3377
|
-
const problem = getGeneralApiProblem(response)
|
|
3378
|
-
if (problem) return problem
|
|
3822
|
+
const problem = getGeneralApiProblem(response);
|
|
3823
|
+
if (problem) return problem;
|
|
3379
3824
|
}
|
|
3380
3825
|
// transform the data into the format we are expecting
|
|
3381
3826
|
try {
|
|
3382
|
-
return { kind:
|
|
3827
|
+
return { kind: 'ok', data: response.data };
|
|
3383
3828
|
} catch {
|
|
3384
|
-
return { kind:
|
|
3829
|
+
return { kind: 'bad-data' };
|
|
3385
3830
|
}
|
|
3386
3831
|
}
|
|
3387
3832
|
|
|
3388
3833
|
async updateInfoMotobikeLoan(body) {
|
|
3389
3834
|
// make the api call
|
|
3390
|
-
const response: ApiResponse<any> = await this.apisauce.post(
|
|
3835
|
+
const response: ApiResponse<any> = await this.apisauce.post(
|
|
3836
|
+
`api/v2.0/autodev2/update_info_customer_motobike`,
|
|
3837
|
+
body
|
|
3838
|
+
);
|
|
3391
3839
|
// the typical ways to die when calling an api
|
|
3392
3840
|
if (!response.ok) {
|
|
3393
|
-
const problem = getGeneralApiProblem(response)
|
|
3394
|
-
if (problem) return problem
|
|
3841
|
+
const problem = getGeneralApiProblem(response);
|
|
3842
|
+
if (problem) return problem;
|
|
3395
3843
|
}
|
|
3396
3844
|
// transform the data into the format we are expecting
|
|
3397
3845
|
try {
|
|
3398
|
-
return { kind:
|
|
3846
|
+
return { kind: 'ok', data: response.data };
|
|
3399
3847
|
} catch {
|
|
3400
|
-
return { kind:
|
|
3848
|
+
return { kind: 'bad-data' };
|
|
3401
3849
|
}
|
|
3402
3850
|
}
|
|
3403
3851
|
|
|
3404
3852
|
async updateInfoMotobikeLoan2(body) {
|
|
3405
3853
|
// make the api call
|
|
3406
|
-
const response: ApiResponse<any> = await this.apisauce.post(
|
|
3854
|
+
const response: ApiResponse<any> = await this.apisauce.post(
|
|
3855
|
+
`api/v2.0/autodev2/update_info_loan_motobike`,
|
|
3856
|
+
body
|
|
3857
|
+
);
|
|
3407
3858
|
// the typical ways to die when calling an api
|
|
3408
3859
|
if (!response.ok) {
|
|
3409
|
-
const problem = getGeneralApiProblem(response)
|
|
3410
|
-
if (problem) return problem
|
|
3860
|
+
const problem = getGeneralApiProblem(response);
|
|
3861
|
+
if (problem) return problem;
|
|
3411
3862
|
}
|
|
3412
3863
|
// transform the data into the format we are expecting
|
|
3413
3864
|
try {
|
|
3414
|
-
return { kind:
|
|
3865
|
+
return { kind: 'ok', data: response.data };
|
|
3415
3866
|
} catch {
|
|
3416
|
-
return { kind:
|
|
3867
|
+
return { kind: 'bad-data' };
|
|
3417
3868
|
}
|
|
3418
3869
|
}
|
|
3419
3870
|
|
|
3420
3871
|
async confirmF88(body) {
|
|
3421
3872
|
// make the api call
|
|
3422
|
-
const response: ApiResponse<any> = await this.apisauce.post(
|
|
3873
|
+
const response: ApiResponse<any> = await this.apisauce.post(
|
|
3874
|
+
`api/v2.0/autodev2/confirm_pipeline_f88`,
|
|
3875
|
+
body
|
|
3876
|
+
);
|
|
3877
|
+
// the typical ways to die when calling an api
|
|
3878
|
+
if (!response.ok) {
|
|
3879
|
+
const problem = getGeneralApiProblem(response);
|
|
3880
|
+
if (problem) return problem;
|
|
3881
|
+
}
|
|
3882
|
+
// transform the data into the format we are expecting
|
|
3883
|
+
try {
|
|
3884
|
+
return { kind: 'ok', data: response.data };
|
|
3885
|
+
} catch {
|
|
3886
|
+
return { kind: 'bad-data' };
|
|
3887
|
+
}
|
|
3888
|
+
}
|
|
3889
|
+
|
|
3890
|
+
async get_loan_disbursed() {
|
|
3891
|
+
// make the api call
|
|
3892
|
+
const response: ApiResponse<any> = await this.apisauce.get(
|
|
3893
|
+
`api/v2.0/loanbrief/list_loan_disbursed`
|
|
3894
|
+
);
|
|
3895
|
+
// the typical ways to die when calling an api
|
|
3896
|
+
if (!response.ok) {
|
|
3897
|
+
const problem = getGeneralApiProblem(response);
|
|
3898
|
+
if (problem) return problem;
|
|
3899
|
+
}
|
|
3900
|
+
// transform the data into the format we are expecting
|
|
3901
|
+
try {
|
|
3902
|
+
return { kind: 'ok', data: response.data };
|
|
3903
|
+
} catch {
|
|
3904
|
+
return { kind: 'bad-data' };
|
|
3905
|
+
}
|
|
3906
|
+
}
|
|
3907
|
+
|
|
3908
|
+
async confirm_final_settlement(body) {
|
|
3909
|
+
// make the api call
|
|
3910
|
+
const response: ApiResponse<any> = await this.apisauce.post(
|
|
3911
|
+
`api/v2.0/loanbrief/confirm_final_settlement`,
|
|
3912
|
+
body
|
|
3913
|
+
);
|
|
3423
3914
|
// the typical ways to die when calling an api
|
|
3424
3915
|
if (!response.ok) {
|
|
3425
|
-
const problem = getGeneralApiProblem(response)
|
|
3426
|
-
if (problem) return problem
|
|
3916
|
+
const problem = getGeneralApiProblem(response);
|
|
3917
|
+
if (problem) return problem;
|
|
3427
3918
|
}
|
|
3428
3919
|
// transform the data into the format we are expecting
|
|
3429
3920
|
try {
|
|
3430
|
-
return { kind:
|
|
3921
|
+
return { kind: 'ok', data: response.data };
|
|
3431
3922
|
} catch {
|
|
3432
|
-
return { kind:
|
|
3923
|
+
return { kind: 'bad-data' };
|
|
3433
3924
|
}
|
|
3434
3925
|
}
|
|
3435
3926
|
}
|