sysone-api-mapper 1.0.147 → 1.0.149
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/{axiosInstance.js → dist/axiosInstance.js} +5 -7
- package/dist/index.d.ts +2 -2
- package/{index.ts → dist/index.js} +7 -20
- package/dist/services.js +92 -0
- package/dist/servicesData.js +996 -0
- package/dist/src/adapters/createApiAdapter.js +8 -0
- package/{src → dist/src}/adapters/financeAdapter.js +4 -5
- package/{src → dist/src}/adapters/locationAdapter.js +5 -6
- package/{src → dist/src}/adapters/partyAdapter.js +7 -8
- package/{src → dist/src}/components/notificationToast.js +35 -37
- package/dist/src/contexts/actionsContext.js +43 -0
- package/{src → dist/src}/contexts/apiContext.js +8 -9
- package/dist/src/contexts/translationContext.js +19 -0
- package/dist/src/mapper/Mapper.js +98 -0
- package/{src → dist/src}/mapper/endpointsConfig.js +821 -915
- package/{src → dist/src}/mapper/helpers/mappingHelpers.js +24 -26
- package/{src → dist/src}/mapper/modules/billing/index.js +128 -131
- package/{src → dist/src}/mapper/modules/claim/index.js +15 -17
- package/{src → dist/src}/mapper/modules/general/index.js +6 -7
- package/{src → dist/src}/mapper/modules/party/index.js +119 -128
- package/dist/src/mapper/modules/policy/index.js +573 -0
- package/dist/src/mapper/modules/quotation/index.js +477 -0
- package/{src → dist/src}/mapper/modules/request/index.js +60 -67
- package/dist/src/public/index.js +7 -0
- package/{src → dist/src}/server.js +18 -23
- package/package.json +4 -4
- package/.babelrc +0 -4
- package/.gitlab-ci.yml +0 -42
- package/config/dist/index.js +0 -307
- package/config/dist/index.js.LICENSE.txt +0 -1
- package/config/dist/index.ts +0 -319
- package/config/webpack.dev.js +0 -63
- package/config/webpack.prod.js +0 -63
- package/index.d.ts +0 -5
- package/services.js +0 -105
- package/servicesData.js +0 -1013
- package/src/adapters/createApiAdapter.ts +0 -29
- package/src/contexts/actionsContext.js +0 -54
- package/src/contexts/translationContext.js +0 -29
- package/src/mapper/Mapper.js +0 -141
- package/src/mapper/modules/policy/index.js +0 -613
- package/src/mapper/modules/quotation/index.js +0 -480
- package/src/public/index.html +0 -15
- package/src/public/index.js +0 -9
- package/test/script.js +0 -0
- package/tsconfig.json +0 -9
|
@@ -0,0 +1,477 @@
|
|
|
1
|
+
import { mapPaymentFrequency, mapProductCode } from "../../helpers/mappingHelpers";
|
|
2
|
+
import dayjs from 'dayjs';
|
|
3
|
+
const normalizeDateToYYYYMMDD = (date) => {
|
|
4
|
+
if (!date)
|
|
5
|
+
return null;
|
|
6
|
+
const formats = ['DD/MM/YYYY', 'YYYY/MM/DD'];
|
|
7
|
+
const parsed = dayjs(date, formats, true);
|
|
8
|
+
return parsed.isValid()
|
|
9
|
+
? parsed.format('YYYY/MM/DD')
|
|
10
|
+
: null;
|
|
11
|
+
};
|
|
12
|
+
export const getQuotationsList = async (response) => {
|
|
13
|
+
const quotations = Array.isArray(response === null || response === void 0 ? void 0 : response.quotations)
|
|
14
|
+
? response.quotations.map(q => {
|
|
15
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t;
|
|
16
|
+
return ({
|
|
17
|
+
code: q.code || null,
|
|
18
|
+
email: q.email || null,
|
|
19
|
+
creationDate: normalizeDateToYYYYMMDD(q.creationDate),
|
|
20
|
+
expirationDate: normalizeDateToYYYYMMDD(q.expirationDate),
|
|
21
|
+
number: q.number || null,
|
|
22
|
+
paymentFrequency: {
|
|
23
|
+
name: ((_a = q.paymentFrequency) === null || _a === void 0 ? void 0 : _a.name) || null,
|
|
24
|
+
code: ((_b = q.paymentFrequency) === null || _b === void 0 ? void 0 : _b.code) || null,
|
|
25
|
+
},
|
|
26
|
+
product: {
|
|
27
|
+
code: ((_d = (_c = q.product) === null || _c === void 0 ? void 0 : _c.code) === null || _d === void 0 ? void 0 : _d.toString()) || null,
|
|
28
|
+
name: ((_e = q.product) === null || _e === void 0 ? void 0 : _e.name) || null,
|
|
29
|
+
subsection: {
|
|
30
|
+
code: ((_g = (_f = q.product) === null || _f === void 0 ? void 0 : _f.subsection) === null || _g === void 0 ? void 0 : _g.code) || null,
|
|
31
|
+
name: ((_j = (_h = q.product) === null || _h === void 0 ? void 0 : _h.subsection) === null || _j === void 0 ? void 0 : _j.name) || null,
|
|
32
|
+
section: {
|
|
33
|
+
code: ((_m = (_l = (_k = q.product) === null || _k === void 0 ? void 0 : _k.subsection) === null || _l === void 0 ? void 0 : _l.section) === null || _m === void 0 ? void 0 : _m.code) || null,
|
|
34
|
+
name: ((_q = (_p = (_o = q.product) === null || _o === void 0 ? void 0 : _o.subsection) === null || _p === void 0 ? void 0 : _p.section) === null || _q === void 0 ? void 0 : _q.name) || null,
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
version: ((_r = q.product) === null || _r === void 0 ? void 0 : _r.version) || 0,
|
|
38
|
+
},
|
|
39
|
+
status: {
|
|
40
|
+
code: ((_s = q.status) === null || _s === void 0 ? void 0 : _s.code) || null,
|
|
41
|
+
name: ((_t = q.status) === null || _t === void 0 ? void 0 : _t.name) || null,
|
|
42
|
+
},
|
|
43
|
+
});
|
|
44
|
+
})
|
|
45
|
+
: [];
|
|
46
|
+
const total = (response === null || response === void 0 ? void 0 : response.total) ? response.total : 0;
|
|
47
|
+
return {
|
|
48
|
+
quotations,
|
|
49
|
+
total,
|
|
50
|
+
};
|
|
51
|
+
};
|
|
52
|
+
export const getQuotationDetail = async (res) => {
|
|
53
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0;
|
|
54
|
+
const quotation = {
|
|
55
|
+
areaCode: (res === null || res === void 0 ? void 0 : res.areaCode) || null,
|
|
56
|
+
code: (res === null || res === void 0 ? void 0 : res.code) || null,
|
|
57
|
+
commercialStructure: {
|
|
58
|
+
data: {
|
|
59
|
+
code: null,
|
|
60
|
+
description: null,
|
|
61
|
+
name: null,
|
|
62
|
+
status: {
|
|
63
|
+
code: null,
|
|
64
|
+
name: null
|
|
65
|
+
},
|
|
66
|
+
version: 0
|
|
67
|
+
},
|
|
68
|
+
intermediaries: {
|
|
69
|
+
values: []
|
|
70
|
+
}
|
|
71
|
+
},
|
|
72
|
+
creationDate: (res === null || res === void 0 ? void 0 : res.creationDate) || null,
|
|
73
|
+
email: (res === null || res === void 0 ? void 0 : res.email) || null,
|
|
74
|
+
intermediary: {
|
|
75
|
+
code: ((_a = res === null || res === void 0 ? void 0 : res.intermediary) === null || _a === void 0 ? void 0 : _a.code) || null,
|
|
76
|
+
group: {
|
|
77
|
+
code: null,
|
|
78
|
+
name: null
|
|
79
|
+
},
|
|
80
|
+
licence: ((_b = res === null || res === void 0 ? void 0 : res.intermediary) === null || _b === void 0 ? void 0 : _b.licence) || null,
|
|
81
|
+
name: ((_c = res === null || res === void 0 ? void 0 : res.intermediary) === null || _c === void 0 ? void 0 : _c.name) || null,
|
|
82
|
+
roles: [
|
|
83
|
+
{
|
|
84
|
+
code: null,
|
|
85
|
+
name: null
|
|
86
|
+
}
|
|
87
|
+
],
|
|
88
|
+
status: {
|
|
89
|
+
code: null,
|
|
90
|
+
name: null
|
|
91
|
+
}
|
|
92
|
+
},
|
|
93
|
+
number: (res === null || res === void 0 ? void 0 : res.number) || null,
|
|
94
|
+
paymentFrequency: {
|
|
95
|
+
code: ((_d = res === null || res === void 0 ? void 0 : res.paymentFrequency) === null || _d === void 0 ? void 0 : _d.code) || null,
|
|
96
|
+
months: ((_e = res === null || res === void 0 ? void 0 : res.paymentFrequency) === null || _e === void 0 ? void 0 : _e.months) || null,
|
|
97
|
+
name: ((_f = res === null || res === void 0 ? void 0 : res.paymentFrequency) === null || _f === void 0 ? void 0 : _f.name) || null
|
|
98
|
+
},
|
|
99
|
+
phone: (res === null || res === void 0 ? void 0 : res.phone) || null,
|
|
100
|
+
product: {
|
|
101
|
+
code: ((_g = res === null || res === void 0 ? void 0 : res.product) === null || _g === void 0 ? void 0 : _g.code) || null,
|
|
102
|
+
currency: {
|
|
103
|
+
code: null,
|
|
104
|
+
mnemonic: null,
|
|
105
|
+
name: null,
|
|
106
|
+
symbol: null
|
|
107
|
+
},
|
|
108
|
+
name: ((_h = res === null || res === void 0 ? void 0 : res.product) === null || _h === void 0 ? void 0 : _h.name) || null,
|
|
109
|
+
status: {
|
|
110
|
+
code: null,
|
|
111
|
+
name: null
|
|
112
|
+
},
|
|
113
|
+
subsection: {
|
|
114
|
+
code: ((_k = (_j = res === null || res === void 0 ? void 0 : res.product) === null || _j === void 0 ? void 0 : _j.subsection) === null || _k === void 0 ? void 0 : _k.code) || null,
|
|
115
|
+
name: ((_m = (_l = res === null || res === void 0 ? void 0 : res.product) === null || _l === void 0 ? void 0 : _l.subsection) === null || _m === void 0 ? void 0 : _m.name) || null,
|
|
116
|
+
section: {
|
|
117
|
+
category: null,
|
|
118
|
+
code: ((_q = (_p = (_o = res === null || res === void 0 ? void 0 : res.product) === null || _o === void 0 ? void 0 : _o.subsection) === null || _p === void 0 ? void 0 : _p.section) === null || _q === void 0 ? void 0 : _q.code) || null,
|
|
119
|
+
name: ((_t = (_s = (_r = res === null || res === void 0 ? void 0 : res.product) === null || _r === void 0 ? void 0 : _r.subsection) === null || _s === void 0 ? void 0 : _s.section) === null || _t === void 0 ? void 0 : _t.name) || null,
|
|
120
|
+
type: null
|
|
121
|
+
}
|
|
122
|
+
},
|
|
123
|
+
version: ((_u = res === null || res === void 0 ? void 0 : res.product) === null || _u === void 0 ? void 0 : _u.version) || 0
|
|
124
|
+
},
|
|
125
|
+
productSegment: null,
|
|
126
|
+
status: {
|
|
127
|
+
code: ((_v = res === null || res === void 0 ? void 0 : res.status) === null || _v === void 0 ? void 0 : _v.code) || null,
|
|
128
|
+
name: ((_w = res === null || res === void 0 ? void 0 : res.status) === null || _w === void 0 ? void 0 : _w.name) || null
|
|
129
|
+
},
|
|
130
|
+
validity: {
|
|
131
|
+
code: null,
|
|
132
|
+
months: 0,
|
|
133
|
+
name: null
|
|
134
|
+
},
|
|
135
|
+
values: {
|
|
136
|
+
commercialAgreement: {
|
|
137
|
+
code: null,
|
|
138
|
+
intermediaries: []
|
|
139
|
+
},
|
|
140
|
+
expenses: [],
|
|
141
|
+
groupedEconomicValues: ((_y = (_x = res === null || res === void 0 ? void 0 : res.values) === null || _x === void 0 ? void 0 : _x.groupedEconomicValues) === null || _y === void 0 ? void 0 : _y.map((e) => {
|
|
142
|
+
var _a, _b;
|
|
143
|
+
return ({
|
|
144
|
+
type: {
|
|
145
|
+
code: ((_a = e === null || e === void 0 ? void 0 : e.type) === null || _a === void 0 ? void 0 : _a.code) || null,
|
|
146
|
+
name: ((_b = e === null || e === void 0 ? void 0 : e.type) === null || _b === void 0 ? void 0 : _b.name) || null
|
|
147
|
+
},
|
|
148
|
+
value: (e === null || e === void 0 ? void 0 : e.value) || null
|
|
149
|
+
});
|
|
150
|
+
})) || [],
|
|
151
|
+
risks: ((_0 = (_z = res === null || res === void 0 ? void 0 : res.values) === null || _z === void 0 ? void 0 : _z.risks) === null || _0 === void 0 ? void 0 : _0.map((risk) => {
|
|
152
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1;
|
|
153
|
+
return ({
|
|
154
|
+
adherents: [],
|
|
155
|
+
code: (risk === null || risk === void 0 ? void 0 : risk.code) || null,
|
|
156
|
+
coverages: ((_a = risk === null || risk === void 0 ? void 0 : risk.coverages) === null || _a === void 0 ? void 0 : _a.map((cv) => {
|
|
157
|
+
var _a;
|
|
158
|
+
return ({
|
|
159
|
+
code: (cv === null || cv === void 0 ? void 0 : cv.code) || null,
|
|
160
|
+
coverageValues: ((_a = cv === null || cv === void 0 ? void 0 : cv.coverageValues) === null || _a === void 0 ? void 0 : _a.map((c) => {
|
|
161
|
+
var _a, _b;
|
|
162
|
+
return ({
|
|
163
|
+
type: {
|
|
164
|
+
code: ((_a = c === null || c === void 0 ? void 0 : c.type) === null || _a === void 0 ? void 0 : _a.code) || null,
|
|
165
|
+
name: ((_b = c === null || c === void 0 ? void 0 : c.type) === null || _b === void 0 ? void 0 : _b.name) || null
|
|
166
|
+
},
|
|
167
|
+
value: (c === null || c === void 0 ? void 0 : c.value) || null
|
|
168
|
+
});
|
|
169
|
+
})) || [],
|
|
170
|
+
deductible: null,
|
|
171
|
+
economicValues: [
|
|
172
|
+
{
|
|
173
|
+
type: {
|
|
174
|
+
code: null,
|
|
175
|
+
name: null
|
|
176
|
+
},
|
|
177
|
+
value: 0
|
|
178
|
+
}
|
|
179
|
+
],
|
|
180
|
+
name: (cv === null || cv === void 0 ? void 0 : cv.description) || null,
|
|
181
|
+
description: (cv === null || cv === void 0 ? void 0 : cv.name) || null
|
|
182
|
+
});
|
|
183
|
+
})) || [],
|
|
184
|
+
data: {
|
|
185
|
+
city: {
|
|
186
|
+
code: ((_c = (_b = risk === null || risk === void 0 ? void 0 : risk.data) === null || _b === void 0 ? void 0 : _b.city) === null || _c === void 0 ? void 0 : _c.code) || null,
|
|
187
|
+
name: ((_e = (_d = risk === null || risk === void 0 ? void 0 : risk.data) === null || _d === void 0 ? void 0 : _d.city) === null || _e === void 0 ? void 0 : _e.name) || null,
|
|
188
|
+
province: ((_g = (_f = risk === null || risk === void 0 ? void 0 : risk.data) === null || _f === void 0 ? void 0 : _f.city) === null || _g === void 0 ? void 0 : _g.province) || null
|
|
189
|
+
},
|
|
190
|
+
gender: {
|
|
191
|
+
code: ((_j = (_h = risk === null || risk === void 0 ? void 0 : risk.data) === null || _h === void 0 ? void 0 : _h.gender) === null || _j === void 0 ? void 0 : _j.code) || null,
|
|
192
|
+
name: ((_l = (_k = risk === null || risk === void 0 ? void 0 : risk.data) === null || _k === void 0 ? void 0 : _k.gender) === null || _l === void 0 ? void 0 : _l.name) || null
|
|
193
|
+
},
|
|
194
|
+
birthdate: ((_m = risk === null || risk === void 0 ? void 0 : risk.data) === null || _m === void 0 ? void 0 : _m.birthdate) || null,
|
|
195
|
+
savings: ((_o = risk === null || risk === void 0 ? void 0 : risk.data) === null || _o === void 0 ? void 0 : _o.savings) || null,
|
|
196
|
+
identification: (_q = (_p = risk === null || risk === void 0 ? void 0 : risk.data) === null || _p === void 0 ? void 0 : _p.identification) !== null && _q !== void 0 ? _q : null,
|
|
197
|
+
firstName: (_s = (_r = risk === null || risk === void 0 ? void 0 : risk.data) === null || _r === void 0 ? void 0 : _r.firstName) !== null && _s !== void 0 ? _s : null,
|
|
198
|
+
lastName: (_u = (_t = risk === null || risk === void 0 ? void 0 : risk.data) === null || _t === void 0 ? void 0 : _t.lastName) !== null && _u !== void 0 ? _u : null,
|
|
199
|
+
spouse: (_w = (_v = risk === null || risk === void 0 ? void 0 : risk.data) === null || _v === void 0 ? void 0 : _v.spouse) !== null && _w !== void 0 ? _w : null,
|
|
200
|
+
values: ((_x = risk === null || risk === void 0 ? void 0 : risk.data) === null || _x === void 0 ? void 0 : _x.values) || null,
|
|
201
|
+
activity: ((_y = risk === null || risk === void 0 ? void 0 : risk.data) === null || _y === void 0 ? void 0 : _y.activity) || null,
|
|
202
|
+
bloodPressure: ((_z = risk === null || risk === void 0 ? void 0 : risk.data) === null || _z === void 0 ? void 0 : _z.bloodPressure) || null,
|
|
203
|
+
height: ((_0 = risk === null || risk === void 0 ? void 0 : risk.data) === null || _0 === void 0 ? void 0 : _0.height) || null,
|
|
204
|
+
weight: ((_1 = risk === null || risk === void 0 ? void 0 : risk.data) === null || _1 === void 0 ? void 0 : _1.weight) || null,
|
|
205
|
+
},
|
|
206
|
+
groupedEconomicValues: []
|
|
207
|
+
});
|
|
208
|
+
})) || []
|
|
209
|
+
}
|
|
210
|
+
};
|
|
211
|
+
return quotation;
|
|
212
|
+
};
|
|
213
|
+
export const getQuotationByCode = async (response) => {
|
|
214
|
+
var _a, _b, _c;
|
|
215
|
+
const objectMapped = {
|
|
216
|
+
code: ((_a = response.quotationNumber) === null || _a === void 0 ? void 0 : _a.toString()) || null,
|
|
217
|
+
number: response.activityCode || 0,
|
|
218
|
+
creationDate: response.vigencyDateFrom || null,
|
|
219
|
+
expirationDate: response.vigencyDateTo || null,
|
|
220
|
+
validity: {
|
|
221
|
+
code: "N/A",
|
|
222
|
+
name: "N/A",
|
|
223
|
+
months: "N/A"
|
|
224
|
+
},
|
|
225
|
+
status: {
|
|
226
|
+
code: "N/A",
|
|
227
|
+
name: "N/A"
|
|
228
|
+
},
|
|
229
|
+
paymentFrequency: {
|
|
230
|
+
name: "N/A",
|
|
231
|
+
code: "N/A",
|
|
232
|
+
months: 0
|
|
233
|
+
},
|
|
234
|
+
email: "N/A",
|
|
235
|
+
phone: "N/A",
|
|
236
|
+
intermediary: {
|
|
237
|
+
code: "N/A",
|
|
238
|
+
name: "N/A",
|
|
239
|
+
roles: {},
|
|
240
|
+
},
|
|
241
|
+
commercialStructure: {
|
|
242
|
+
data: {
|
|
243
|
+
name: "N/A",
|
|
244
|
+
code: "N/A",
|
|
245
|
+
version: 0,
|
|
246
|
+
description: "N/A",
|
|
247
|
+
status: {
|
|
248
|
+
name: "N/A",
|
|
249
|
+
code: "N/A"
|
|
250
|
+
}
|
|
251
|
+
},
|
|
252
|
+
intermediaries: {
|
|
253
|
+
values: [
|
|
254
|
+
{
|
|
255
|
+
code: "N/A",
|
|
256
|
+
name: "N/A",
|
|
257
|
+
licence: "N/A",
|
|
258
|
+
role: {
|
|
259
|
+
name: "N/A",
|
|
260
|
+
code: "N/A"
|
|
261
|
+
},
|
|
262
|
+
status: {
|
|
263
|
+
name: "N/A",
|
|
264
|
+
code: "N/A"
|
|
265
|
+
},
|
|
266
|
+
group: {
|
|
267
|
+
name: "N/A",
|
|
268
|
+
code: "N/A"
|
|
269
|
+
},
|
|
270
|
+
}
|
|
271
|
+
]
|
|
272
|
+
}
|
|
273
|
+
},
|
|
274
|
+
product: {
|
|
275
|
+
name: "N/A",
|
|
276
|
+
code: ((_b = response === null || response === void 0 ? void 0 : response.productCode) === null || _b === void 0 ? void 0 : _b.toString()) || null,
|
|
277
|
+
version: 0,
|
|
278
|
+
subsection: {
|
|
279
|
+
name: "N/A",
|
|
280
|
+
code: "N/A",
|
|
281
|
+
section: {
|
|
282
|
+
name: "N/A",
|
|
283
|
+
code: ((_c = response === null || response === void 0 ? void 0 : response.sectionCode) === null || _c === void 0 ? void 0 : _c.toString()) || null,
|
|
284
|
+
type: {
|
|
285
|
+
name: "N/A",
|
|
286
|
+
code: "N/A"
|
|
287
|
+
},
|
|
288
|
+
category: {
|
|
289
|
+
name: "N/A",
|
|
290
|
+
code: "N/A"
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
},
|
|
294
|
+
status: {
|
|
295
|
+
code: "N/A",
|
|
296
|
+
name: "N/A"
|
|
297
|
+
},
|
|
298
|
+
currency: {
|
|
299
|
+
name: "N/A",
|
|
300
|
+
code: "N/A",
|
|
301
|
+
mnemonic: "N/A",
|
|
302
|
+
symbol: "N/A"
|
|
303
|
+
}
|
|
304
|
+
},
|
|
305
|
+
productSegment: {
|
|
306
|
+
coverages: [],
|
|
307
|
+
expenses: [],
|
|
308
|
+
name: "N/A",
|
|
309
|
+
code: "N/A",
|
|
310
|
+
version: 0,
|
|
311
|
+
description: "N/A"
|
|
312
|
+
},
|
|
313
|
+
values: {
|
|
314
|
+
risks: [
|
|
315
|
+
{
|
|
316
|
+
code: "N/A",
|
|
317
|
+
coverages: [
|
|
318
|
+
{
|
|
319
|
+
code: "N/A",
|
|
320
|
+
name: "N/A",
|
|
321
|
+
deductible: {
|
|
322
|
+
name: "N/A",
|
|
323
|
+
code: "N/A",
|
|
324
|
+
value: 0,
|
|
325
|
+
appliedValue: 0
|
|
326
|
+
},
|
|
327
|
+
economicValues: [
|
|
328
|
+
{
|
|
329
|
+
type: {
|
|
330
|
+
name: "N/A",
|
|
331
|
+
code: "N/A"
|
|
332
|
+
},
|
|
333
|
+
value: 0
|
|
334
|
+
}
|
|
335
|
+
],
|
|
336
|
+
coverageValues: [
|
|
337
|
+
{
|
|
338
|
+
type: {
|
|
339
|
+
name: "N/A",
|
|
340
|
+
code: "N/A"
|
|
341
|
+
},
|
|
342
|
+
value: 0
|
|
343
|
+
}
|
|
344
|
+
]
|
|
345
|
+
}
|
|
346
|
+
],
|
|
347
|
+
data: {},
|
|
348
|
+
adherents: [
|
|
349
|
+
{
|
|
350
|
+
code: "N/A",
|
|
351
|
+
coverages: [
|
|
352
|
+
{
|
|
353
|
+
code: "N/A",
|
|
354
|
+
name: "N/A",
|
|
355
|
+
deductible: {
|
|
356
|
+
name: "N/A",
|
|
357
|
+
code: "N/A",
|
|
358
|
+
value: 0,
|
|
359
|
+
appliedValue: 0
|
|
360
|
+
},
|
|
361
|
+
economicValues: [{
|
|
362
|
+
type: "N/A",
|
|
363
|
+
code: "N/A"
|
|
364
|
+
}],
|
|
365
|
+
coverageValues: [{
|
|
366
|
+
type: {
|
|
367
|
+
name: "N/A",
|
|
368
|
+
code: "N/A"
|
|
369
|
+
},
|
|
370
|
+
value: 0
|
|
371
|
+
}]
|
|
372
|
+
}
|
|
373
|
+
],
|
|
374
|
+
data: {}
|
|
375
|
+
}
|
|
376
|
+
]
|
|
377
|
+
}
|
|
378
|
+
],
|
|
379
|
+
expenses: [
|
|
380
|
+
{
|
|
381
|
+
type: {
|
|
382
|
+
name: "N/A",
|
|
383
|
+
code: "N/A"
|
|
384
|
+
},
|
|
385
|
+
value: 0
|
|
386
|
+
}
|
|
387
|
+
],
|
|
388
|
+
groupedEconomicValues: [
|
|
389
|
+
{
|
|
390
|
+
type: {
|
|
391
|
+
name: "N/A",
|
|
392
|
+
code: "N/A"
|
|
393
|
+
},
|
|
394
|
+
value: 0
|
|
395
|
+
}
|
|
396
|
+
],
|
|
397
|
+
commercialAgreement: {}
|
|
398
|
+
}
|
|
399
|
+
};
|
|
400
|
+
return objectMapped;
|
|
401
|
+
};
|
|
402
|
+
export const getQuotationByCode_Request = (inputParams) => {
|
|
403
|
+
return {};
|
|
404
|
+
};
|
|
405
|
+
export const getQuotations_Request = (inputParams) => {
|
|
406
|
+
return {
|
|
407
|
+
number: inputParams.quotationNumber || undefined,
|
|
408
|
+
from: inputParams.dateFrom || undefined,
|
|
409
|
+
to: inputParams.dateTo || undefined,
|
|
410
|
+
};
|
|
411
|
+
};
|
|
412
|
+
export const quotationStandardPlanCreationMapped = (params) => {
|
|
413
|
+
if (!params)
|
|
414
|
+
return null;
|
|
415
|
+
return {
|
|
416
|
+
sectionCode: 17, // no recibe se asigna 17 por defecto
|
|
417
|
+
paymentTypeCode: mapPaymentFrequency(params.paymentFrequencyCode),
|
|
418
|
+
productCode: mapProductCode(params.productCode),
|
|
419
|
+
provinceCode: 1, // no recibe provincia, se asigna 1 por defecto
|
|
420
|
+
};
|
|
421
|
+
};
|
|
422
|
+
export const quotationVariablePlanCreationMapped = (params) => {
|
|
423
|
+
var _a, _b, _c, _d;
|
|
424
|
+
if (!params)
|
|
425
|
+
return null;
|
|
426
|
+
return {
|
|
427
|
+
sectionCode: 17, // no recibe se asigna 17 por defecto
|
|
428
|
+
paymentTypeCode: mapPaymentFrequency(params.paymentFrequencyCode),
|
|
429
|
+
productCode: mapProductCode(params.productCode),
|
|
430
|
+
provinceCode: 1, // no recibe provincia, se asigna 1 por defecto
|
|
431
|
+
birthdate: (_a = params.risks[0]) === null || _a === void 0 ? void 0 : _a.birthDate,
|
|
432
|
+
insuredAmount: ((_d = (_c = (_b = params.risks[0]) === null || _b === void 0 ? void 0 : _b.coverages[0]) === null || _c === void 0 ? void 0 : _c.values.find(v => v.code === "INSURED_AMOUNT")) === null || _d === void 0 ? void 0 : _d.value) || 0,
|
|
433
|
+
};
|
|
434
|
+
};
|
|
435
|
+
export const getActivityList = async (response) => {
|
|
436
|
+
const objectMapped = {
|
|
437
|
+
values: response.activities.map(a => ({
|
|
438
|
+
code: a.code,
|
|
439
|
+
name: a.name,
|
|
440
|
+
})),
|
|
441
|
+
};
|
|
442
|
+
return objectMapped;
|
|
443
|
+
};
|
|
444
|
+
export const getProductsBySubsections = async (response) => {
|
|
445
|
+
const objectMapped = {
|
|
446
|
+
values: response.products.map(item => ({
|
|
447
|
+
name: item.name,
|
|
448
|
+
code: item.code,
|
|
449
|
+
version: item.version,
|
|
450
|
+
subsection: (item === null || item === void 0 ? void 0 : item.subsection) || null,
|
|
451
|
+
fieldExclusions: (item === null || item === void 0 ? void 0 : item.exclusions) || null,
|
|
452
|
+
fields: (item === null || item === void 0 ? void 0 : item.fieldValues) || (item === null || item === void 0 ? void 0 : item.fields) || null
|
|
453
|
+
})),
|
|
454
|
+
};
|
|
455
|
+
return objectMapped;
|
|
456
|
+
};
|
|
457
|
+
export const getProductParameters = async (item) => {
|
|
458
|
+
const objectMapped = {
|
|
459
|
+
name: item.name,
|
|
460
|
+
code: item.code,
|
|
461
|
+
version: item.version,
|
|
462
|
+
subsection: (item === null || item === void 0 ? void 0 : item.subsection) || null,
|
|
463
|
+
fieldExclusions: (item === null || item === void 0 ? void 0 : item.exclusions) || null,
|
|
464
|
+
fields: (item === null || item === void 0 ? void 0 : item.fields) || null
|
|
465
|
+
};
|
|
466
|
+
return objectMapped;
|
|
467
|
+
};
|
|
468
|
+
export const getPaymentFrecuencies = async (response) => {
|
|
469
|
+
const objectMapped = {
|
|
470
|
+
frequencies: response.frequencies.map(a => ({
|
|
471
|
+
name: a.name,
|
|
472
|
+
code: a.code,
|
|
473
|
+
months: a.months
|
|
474
|
+
})),
|
|
475
|
+
};
|
|
476
|
+
return objectMapped;
|
|
477
|
+
};
|
|
@@ -1,67 +1,60 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
holderSoi: data.holderSoi,
|
|
62
|
-
insured: data.insured || null,
|
|
63
|
-
questionnaires: data.questionnaires || null,
|
|
64
|
-
spouse: data.spouse || null,
|
|
65
|
-
}
|
|
66
|
-
return request;
|
|
67
|
-
}
|
|
1
|
+
export const getRequest_Params = (i) => {
|
|
2
|
+
return {
|
|
3
|
+
number: i.quotationNumber,
|
|
4
|
+
statusCode: i.status,
|
|
5
|
+
productCode: i.productCode,
|
|
6
|
+
from: i.creationDateFrom,
|
|
7
|
+
to: i.creationDateTo
|
|
8
|
+
};
|
|
9
|
+
};
|
|
10
|
+
export const getRequestDetail = (data) => {
|
|
11
|
+
const mappedCoverages = data.coverages.map(cov => ({
|
|
12
|
+
code: cov.code || null,
|
|
13
|
+
name: cov.name || null,
|
|
14
|
+
deductible: null,
|
|
15
|
+
economicValues: [],
|
|
16
|
+
coverageValues: cov.coverageValues.map(val => ({
|
|
17
|
+
value: val.value,
|
|
18
|
+
type: {
|
|
19
|
+
name: val.type.name,
|
|
20
|
+
code: val.type.code
|
|
21
|
+
}
|
|
22
|
+
}))
|
|
23
|
+
}));
|
|
24
|
+
const request = {
|
|
25
|
+
code: data.number,
|
|
26
|
+
commercialStructure: null,
|
|
27
|
+
creationDate: data.creationDate,
|
|
28
|
+
email: data.insured.email,
|
|
29
|
+
expirationDate: (data === null || data === void 0 ? void 0 : data.expirationDate) || null,
|
|
30
|
+
holder: data.holder || null,
|
|
31
|
+
intermediary: null,
|
|
32
|
+
legalConstraint: null,
|
|
33
|
+
number: data.number || null,
|
|
34
|
+
paymentMethods: {
|
|
35
|
+
payment: data.payment
|
|
36
|
+
},
|
|
37
|
+
paymentFrequency: data.payment.period || null,
|
|
38
|
+
phone: data.insured.phoneNumber || null,
|
|
39
|
+
product: data.product || null,
|
|
40
|
+
productSegment: null,
|
|
41
|
+
quotationNumber: data.quotationNumber || null,
|
|
42
|
+
quotationCode: data.quotationNumber || null,
|
|
43
|
+
requiresBilling: null,
|
|
44
|
+
status: data.status || null,
|
|
45
|
+
validity: null,
|
|
46
|
+
values: {
|
|
47
|
+
risks: [{
|
|
48
|
+
coverages: mappedCoverages
|
|
49
|
+
}]
|
|
50
|
+
} || null,
|
|
51
|
+
vigencyDateFrom: null,
|
|
52
|
+
wordingPlan: null,
|
|
53
|
+
holderPep: data.holderPep,
|
|
54
|
+
holderSoi: data.holderSoi,
|
|
55
|
+
insured: data.insured || null,
|
|
56
|
+
questionnaires: data.questionnaires || null,
|
|
57
|
+
spouse: data.spouse || null,
|
|
58
|
+
};
|
|
59
|
+
return request;
|
|
60
|
+
};
|
|
@@ -1,23 +1,18 @@
|
|
|
1
|
-
|
|
2
|
-
const
|
|
3
|
-
require("
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
const
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
app.
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
})
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
// Iniciar el servidor
|
|
21
|
-
app.listen(port, () => {
|
|
22
|
-
console.log(`Server is running on http://localhost:${port}`);
|
|
23
|
-
});
|
|
1
|
+
"use strict";
|
|
2
|
+
const express = require("express");
|
|
3
|
+
const cors = require("cors");
|
|
4
|
+
require("dotenv").config();
|
|
5
|
+
const path = require("path");
|
|
6
|
+
const app = express();
|
|
7
|
+
const port = process.env.PORT || 3000;
|
|
8
|
+
// Middleware
|
|
9
|
+
app.use(cors());
|
|
10
|
+
app.use(express.json());
|
|
11
|
+
// Ruta raíz
|
|
12
|
+
app.get("*", (req, res) => {
|
|
13
|
+
res.sendFile(path.join(__dirname, "public", "index.html"));
|
|
14
|
+
});
|
|
15
|
+
// Iniciar el servidor
|
|
16
|
+
app.listen(port, () => {
|
|
17
|
+
console.log(`Server is running on http://localhost:${port}`);
|
|
18
|
+
});
|
package/package.json
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "sysone-api-mapper",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.149",
|
|
4
4
|
"description": "Paquete mapper para portal de productores",
|
|
5
|
-
"main": "dist/index.
|
|
5
|
+
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
7
|
+
"files": ["dist"],
|
|
7
8
|
"scripts": {
|
|
8
9
|
"start": "node src/server.js",
|
|
9
10
|
"dev": "nodemon src/server.js",
|
|
10
|
-
"build": "
|
|
11
|
-
"build:types": "tsc --emitDeclarationOnly",
|
|
11
|
+
"build": "tsc",
|
|
12
12
|
"test": "echo \"Error: no test specified\" && exit 1"
|
|
13
13
|
},
|
|
14
14
|
"keywords": [],
|