sysone-api-mapper 1.0.101 → 1.0.102
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -423,7 +423,7 @@ const policyModule = {
|
|
|
423
423
|
url: 'policy/v1/policy-individual/{0}/{1}/detail',
|
|
424
424
|
method: methods.GET,
|
|
425
425
|
requestMapper: request => ({ mappedParams: getPolicyDetail_Request(request) }),
|
|
426
|
-
responseMapper: (response) => response.data
|
|
426
|
+
responseMapper: (response) => getPolicyDetail_CNP(response.data)
|
|
427
427
|
},
|
|
428
428
|
},
|
|
429
429
|
|
|
@@ -53,18 +53,15 @@ const getEndorsements_CNP = async (response) => {
|
|
|
53
53
|
const objectMapped = {
|
|
54
54
|
values:
|
|
55
55
|
response.endorsements.map((e) => ({
|
|
56
|
+
activeDate: e.dateFrom ? moment(e.dateFrom, 'DD/MM/YYYY').toISOString() : null,
|
|
56
57
|
number: e.number,
|
|
57
|
-
validityFrom: e.dateFrom ? moment(e.dateFrom, 'DD/MM/YYYY').toISOString() : null,
|
|
58
|
-
validityTo: e.dateTo ? moment(e.dateTo, 'DD/MM/YYYY').toISOString() : null,
|
|
59
|
-
activeDate: "N/A",
|
|
60
58
|
type: {
|
|
61
|
-
code:
|
|
59
|
+
code: e.detail,
|
|
62
60
|
name: e.detail,
|
|
63
|
-
group: {
|
|
64
|
-
code: "N/A",
|
|
65
|
-
name: "N/A"
|
|
66
|
-
}
|
|
61
|
+
group: {}
|
|
67
62
|
},
|
|
63
|
+
validityFrom: e.dateFrom ? moment(e.dateFrom, 'DD/MM/YYYY').toISOString() : null,
|
|
64
|
+
validityTo: e.dateTo ? moment(e.dateTo, 'DD/MM/YYYY').toISOString() : null,
|
|
68
65
|
}))
|
|
69
66
|
,
|
|
70
67
|
total: response.endorsements.length,
|
|
@@ -148,214 +145,96 @@ const getPolicies_CNP_Request = (inputParams) => {
|
|
|
148
145
|
}
|
|
149
146
|
|
|
150
147
|
|
|
151
|
-
const getPolicyDetail_CNP = async (
|
|
148
|
+
const getPolicyDetail_CNP = async (data) => {
|
|
152
149
|
const objectMapped = {
|
|
153
150
|
policyData: {
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
currency:
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
type: {
|
|
164
|
-
name: response?.currency?.name || null,
|
|
165
|
-
code: response?.currency?.code || null,
|
|
166
|
-
months: "N/A"
|
|
167
|
-
},
|
|
168
|
-
dateFrom: response?.vigencyDateFrom ? moment(response.vigencyDateFrom, 'YYYY/MM/DD').toISOString() : null,
|
|
169
|
-
dateTo: response?.vigencyDateTo ? moment(response.vigencyDateTo, 'YYYY/MM/DD').toISOString() : null,
|
|
151
|
+
alias: null,
|
|
152
|
+
creationDate: data.insured.policyDateFrom,
|
|
153
|
+
currency: data?.currency,
|
|
154
|
+
number: data.number,
|
|
155
|
+
process: data.status,
|
|
156
|
+
renewable: null,
|
|
157
|
+
validityy: {
|
|
158
|
+
dateFrom: data?.vigencyDateFrom,
|
|
159
|
+
dateTo: data?.vigencyDateTo,
|
|
170
160
|
},
|
|
171
|
-
creationDate: response?.issueDate ? moment(response.issueDate, 'YYYY/MM/DD').toISOString() : null,
|
|
172
|
-
renewable: true,
|
|
173
|
-
process: {
|
|
174
|
-
name: response?.status?.name || null,
|
|
175
|
-
code: "N/A"
|
|
176
|
-
}
|
|
177
161
|
},
|
|
178
162
|
roleData: {
|
|
179
163
|
holder: {
|
|
180
|
-
partyCode: response?.holder?.code || null,
|
|
181
|
-
name: response?.holder?.firstName && response?.holder?.lastName
|
|
182
|
-
? `${response.holder.firstName} ${response.holder.lastName}` : response?.holder?.name || null,
|
|
183
164
|
identification: {
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
code: response?.holder?.identification?.type?.code || null,
|
|
187
|
-
name: response?.holder?.identification?.type?.name || null,
|
|
188
|
-
}
|
|
165
|
+
type: data?.holder.identification.type,
|
|
166
|
+
value: data?.holder.identification?.number
|
|
189
167
|
},
|
|
168
|
+
name: data.holder.name,
|
|
169
|
+
partyCode: data.holder.code || data.holder.id,
|
|
170
|
+
partyType: null
|
|
190
171
|
},
|
|
191
172
|
contacts: [
|
|
192
173
|
{
|
|
193
|
-
partyCode: "N/A",
|
|
194
|
-
name: "N/A",
|
|
195
174
|
identification: {
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
name: "N/A",
|
|
199
|
-
code: "N/A"
|
|
200
|
-
}
|
|
175
|
+
type: data?.holder.identification.type,
|
|
176
|
+
value: data?.holder.identification?.number
|
|
201
177
|
},
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
partyCode: "N/A",
|
|
206
|
-
name: "N/A",
|
|
207
|
-
identification: {
|
|
208
|
-
value: "N/A",
|
|
209
|
-
type: {
|
|
210
|
-
name: "N/A",
|
|
211
|
-
code: "N/A"
|
|
212
|
-
}
|
|
178
|
+
name: data.holder.name,
|
|
179
|
+
partyCode: data.holder.code || data.holder.id,
|
|
180
|
+
partyType: null
|
|
213
181
|
},
|
|
214
|
-
|
|
182
|
+
]
|
|
215
183
|
},
|
|
216
184
|
collectionData: {
|
|
217
|
-
|
|
218
|
-
insuredDistribution: 0,
|
|
219
|
-
paymentFrequency: {
|
|
220
|
-
name: response?.paymentMethod?.periodicity?.name || null,
|
|
221
|
-
code: "N/A",
|
|
222
|
-
},
|
|
185
|
+
paymentFrequency: '',
|
|
223
186
|
paymentMethodData: {
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
name: response?.currency?.name || null
|
|
229
|
-
}
|
|
230
|
-
]
|
|
231
|
-
} : null,
|
|
232
|
-
bankAccountData: response?.paymentMethod?.name === "CBU" ? {
|
|
233
|
-
values: [
|
|
234
|
-
{
|
|
235
|
-
code: "BA-1",
|
|
236
|
-
number: "1",
|
|
237
|
-
cbu: response?.paymentMethod?.bankAccountNumber || null,
|
|
238
|
-
alias: "N/A",
|
|
239
|
-
currency: {
|
|
240
|
-
code: "N/A",
|
|
241
|
-
name: response?.currency?.name || null
|
|
242
|
-
},
|
|
243
|
-
bankBranch: {
|
|
244
|
-
name: "N/A",
|
|
245
|
-
code: "N/A",
|
|
246
|
-
bank: {
|
|
247
|
-
name: "N/A",
|
|
248
|
-
code: "N/A"
|
|
249
|
-
}
|
|
250
|
-
},
|
|
251
|
-
bankAccountType: {
|
|
252
|
-
name: "N/A",
|
|
253
|
-
code: "N/A"
|
|
254
|
-
}
|
|
255
|
-
}
|
|
256
|
-
]
|
|
257
|
-
} : null,
|
|
258
|
-
creditCardData: response?.paymentMethod?.name === "CREDIT" ? {
|
|
259
|
-
values: [
|
|
260
|
-
{
|
|
261
|
-
code: "N/A",
|
|
262
|
-
ownerName: "N/A",
|
|
263
|
-
cardType: {
|
|
264
|
-
name: "N/A",
|
|
265
|
-
code: "N/A"
|
|
266
|
-
},
|
|
267
|
-
cardProvider: {
|
|
268
|
-
name: "N/A",
|
|
269
|
-
code: "N/A"
|
|
270
|
-
},
|
|
271
|
-
number: "N/A",
|
|
272
|
-
securityCode: "N/A",
|
|
273
|
-
dateTo: "N/A"
|
|
274
|
-
}
|
|
275
|
-
]
|
|
276
|
-
} : null
|
|
187
|
+
simpleMethodData: {
|
|
188
|
+
number: data.paymentMethod.number,
|
|
189
|
+
type: data.paymentMethod.type,
|
|
190
|
+
}
|
|
277
191
|
},
|
|
192
|
+
paymentFrequency: data.paymentMethod.periodicity
|
|
278
193
|
},
|
|
279
194
|
commercialStructureData: {
|
|
280
|
-
data: {
|
|
281
|
-
name: "N/A",
|
|
282
|
-
code: "N/A",
|
|
283
|
-
version: 0,
|
|
284
|
-
description: "N/A",
|
|
285
|
-
status: {
|
|
286
|
-
name: "N/A",
|
|
287
|
-
code: "N/A"
|
|
288
|
-
}
|
|
289
|
-
},
|
|
195
|
+
data: {},
|
|
290
196
|
intermediaries: {
|
|
291
197
|
values: [
|
|
292
198
|
{
|
|
293
|
-
code:
|
|
294
|
-
name:
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
name: "N/A",
|
|
298
|
-
code: "N/A"
|
|
299
|
-
},
|
|
300
|
-
status: {
|
|
301
|
-
name: "N/A",
|
|
302
|
-
code: "N/A"
|
|
303
|
-
}
|
|
199
|
+
code: data.intermediary.id,
|
|
200
|
+
name: data.intermediary.name,
|
|
201
|
+
role: null,
|
|
202
|
+
status: null
|
|
304
203
|
}
|
|
305
204
|
]
|
|
306
205
|
}
|
|
307
206
|
},
|
|
308
207
|
productData: {
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
208
|
+
number: data.product.code || data.product.id,
|
|
209
|
+
name: data.product.name,
|
|
210
|
+
status: {},
|
|
312
211
|
subsection: {
|
|
313
|
-
name:
|
|
314
|
-
code:
|
|
315
|
-
section:
|
|
316
|
-
|
|
317
|
-
code: response?.section?.code || null,
|
|
318
|
-
}
|
|
319
|
-
},
|
|
320
|
-
status: {
|
|
321
|
-
name: response?.status?.name || null,
|
|
322
|
-
code: "N/A"
|
|
323
|
-
},
|
|
212
|
+
name: null,
|
|
213
|
+
code: null,
|
|
214
|
+
section: data.section
|
|
215
|
+
}
|
|
324
216
|
},
|
|
325
217
|
coverageData: {
|
|
326
|
-
coverages:
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
maxValue: "N/A",
|
|
347
|
-
minValue: "N/A",
|
|
348
|
-
}
|
|
349
|
-
],
|
|
350
|
-
mortalityTable: {
|
|
351
|
-
name: "N/A",
|
|
352
|
-
code: "N/A",
|
|
353
|
-
},
|
|
354
|
-
ageType: {
|
|
355
|
-
name: "N/A",
|
|
356
|
-
code: "N/A",
|
|
357
|
-
},
|
|
358
|
-
})) || []
|
|
218
|
+
coverages: data?.insured?.coverages.map(cv =>
|
|
219
|
+
({
|
|
220
|
+
ageType: null,
|
|
221
|
+
deductible: null,
|
|
222
|
+
coverage: {
|
|
223
|
+
calculatorType: null,
|
|
224
|
+
code: null,
|
|
225
|
+
name: cv.name,
|
|
226
|
+
type: cv.type
|
|
227
|
+
},
|
|
228
|
+
values: [{
|
|
229
|
+
minValue: cv.amount,
|
|
230
|
+
maxValue: cv.amount,
|
|
231
|
+
type: {
|
|
232
|
+
code: "INSURED_AMOUNT",
|
|
233
|
+
name: "Suma aseguradas"
|
|
234
|
+
}
|
|
235
|
+
}]
|
|
236
|
+
|
|
237
|
+
})),
|
|
359
238
|
},
|
|
360
239
|
expenseData: {
|
|
361
240
|
values: []
|
|
@@ -371,25 +250,19 @@ const getPolicyDetail_CNP = async (response) => {
|
|
|
371
250
|
comments: "N/A",
|
|
372
251
|
},
|
|
373
252
|
endorsementData: {
|
|
374
|
-
number:
|
|
375
|
-
validityFrom: "N/A",
|
|
376
|
-
validityTo: "N/A",
|
|
377
|
-
type: {
|
|
378
|
-
name: "N/A",
|
|
379
|
-
code: "N/A",
|
|
380
|
-
}
|
|
253
|
+
number: data?.endorsementNumber
|
|
381
254
|
},
|
|
382
255
|
insurableData: {
|
|
383
256
|
minimumQuantityInsured: 0,
|
|
384
|
-
estimatedDeadline:
|
|
257
|
+
estimatedDeadline: data?.insured?.entranceDate || null,
|
|
385
258
|
minimumAge: 0,
|
|
386
259
|
maximumAge: 0,
|
|
387
260
|
maximumQuantityInsuredByEvent: 0,
|
|
388
261
|
maximumAmountToIndemnify: "N/A",
|
|
389
|
-
insurables:
|
|
262
|
+
insurables: data?.insured ? [{
|
|
390
263
|
type: {
|
|
391
|
-
name:
|
|
392
|
-
code:
|
|
264
|
+
name: data?.insured?.type?.name || null,
|
|
265
|
+
code: data?.insured?.type?.code || null,
|
|
393
266
|
},
|
|
394
267
|
wording: "N/A",
|
|
395
268
|
minimumEntryAge: 0,
|