sysone-api-mapper 1.0.133 → 1.0.135
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
|
@@ -1,48 +1,48 @@
|
|
|
1
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
|
-
|
|
2
|
+
"name": "sysone-api-mapper",
|
|
3
|
+
"version": "1.0.135",
|
|
4
|
+
"description": "Paquete mapper para portal de productores",
|
|
5
|
+
"main": "src/index.js",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"start": "node src/server.js",
|
|
8
|
+
"dev": "nodemon src/server.js",
|
|
9
|
+
"build": "webpack --config config/webpack.dev.js",
|
|
10
|
+
"test": "echo \"Error: no test specified\" && exit 1"
|
|
11
|
+
},
|
|
12
|
+
"keywords": [],
|
|
13
|
+
"author": "",
|
|
14
|
+
"license": "ISC",
|
|
15
|
+
"dependencies": {
|
|
16
|
+
"@babel/core": "^7.21.0",
|
|
17
|
+
"@babel/plugin-proposal-class-properties": "^7.18.6",
|
|
18
|
+
"@babel/preset-env": "^7.20.2",
|
|
19
|
+
"@babel/preset-react": "^7.18.6",
|
|
20
|
+
"antd": "^4.21.4",
|
|
21
|
+
"axios": "^1.6.0",
|
|
22
|
+
"babel-loader": "^9.1.2",
|
|
23
|
+
"cors": "^2.8.5",
|
|
24
|
+
"dayjs": "^1.11.19",
|
|
25
|
+
"dotenv": "^16.0.3",
|
|
26
|
+
"express": "^4.21.2",
|
|
27
|
+
"os-browserify": "^0.3.0",
|
|
28
|
+
"path-browserify": "^1.0.1",
|
|
29
|
+
"process": "^0.11.10",
|
|
30
|
+
"react": "^17.0.2",
|
|
31
|
+
"react-dom": "^17.0.2",
|
|
32
|
+
"webpack": "^5.57.1",
|
|
33
|
+
"webpack-cli": "^5.0.1",
|
|
34
|
+
"webpack-node-externals": "^3.0.0"
|
|
35
|
+
},
|
|
36
|
+
"devDependencies": {
|
|
37
|
+
"dotenv-webpack": "^8.1.0",
|
|
38
|
+
"jest": "^29.7.0",
|
|
39
|
+
"nodemon": "^2.0.22",
|
|
40
|
+
"os-browserify": "^0.3.0",
|
|
41
|
+
"path-browserify": "^1.0.1"
|
|
42
|
+
},
|
|
43
|
+
"repository": {
|
|
44
|
+
"type": "git",
|
|
45
|
+
"url": "git+https://gitlab.sysone.com/sysone-cloud-ready/sales-platform/api-mapper/-/tree/develop?ref_type=heads"
|
|
46
|
+
},
|
|
47
|
+
"private": false
|
|
48
48
|
}
|
|
@@ -342,7 +342,7 @@ const partyModule = {
|
|
|
342
342
|
|
|
343
343
|
GET_PARTIES: {
|
|
344
344
|
default: {
|
|
345
|
-
url: 'party/v1/
|
|
345
|
+
url: 'party/v1/{0}',
|
|
346
346
|
method: methods.GET,
|
|
347
347
|
source: "https://apidoc.sysone.com/party/v1/open-api.html#/paths/~1v1~1individuals/get",
|
|
348
348
|
requestMapper: (request) => ({ mappedParams: request }),
|
|
@@ -64,7 +64,7 @@ export const getProductsBySubsections_Request = (params) => {
|
|
|
64
64
|
|
|
65
65
|
export const partySearchParams = (params) => {
|
|
66
66
|
return {
|
|
67
|
-
firstName: params.firstName || null,
|
|
67
|
+
firstName: params.firstName || params.name || null,
|
|
68
68
|
lastName: params.lastName || null,
|
|
69
69
|
identification: params.identificationValue || null,
|
|
70
70
|
}
|
|
@@ -1,4 +1,29 @@
|
|
|
1
|
-
import
|
|
1
|
+
import dayjs from 'dayjs';
|
|
2
|
+
import customParseFormat from 'dayjs/plugin/customParseFormat';
|
|
3
|
+
|
|
4
|
+
dayjs.extend(customParseFormat);
|
|
5
|
+
|
|
6
|
+
const parseSafeDate = (dateString) => {
|
|
7
|
+
if (!dateString) return null;
|
|
8
|
+
|
|
9
|
+
try {
|
|
10
|
+
// Parsear explícitamente con el formato DD/MM/YYYY
|
|
11
|
+
// El tercer parámetro 'true' activa el modo strict
|
|
12
|
+
const parsed = dayjs(dateString, 'DD/MM/YYYY', true);
|
|
13
|
+
|
|
14
|
+
// Verificar si la fecha es válida
|
|
15
|
+
if (!parsed.isValid()) {
|
|
16
|
+
console.warn(`Invalid date format: ${dateString}`);
|
|
17
|
+
return null;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
return parsed.toISOString();
|
|
21
|
+
} catch (error) {
|
|
22
|
+
console.error(`Error parsing date: ${dateString}`, error);
|
|
23
|
+
return null;
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
|
|
2
27
|
|
|
3
28
|
const getInsureds_CNP = async (response) => {
|
|
4
29
|
const objectMapped = {
|
|
@@ -53,15 +78,15 @@ const getEndorsements_CNP = async (response) => {
|
|
|
53
78
|
const objectMapped = {
|
|
54
79
|
values:
|
|
55
80
|
response.endorsements.map((e) => ({
|
|
56
|
-
activeDate: e.dateFrom ?
|
|
81
|
+
activeDate: e.dateFrom ? parseSafeDate(e.dateFrom) : null,
|
|
57
82
|
number: e.number,
|
|
58
83
|
type: {
|
|
59
84
|
code: e.detail,
|
|
60
85
|
name: e.detail,
|
|
61
86
|
group: {}
|
|
62
87
|
},
|
|
63
|
-
validityFrom: e.dateFrom ?
|
|
64
|
-
validityTo: e.dateTo ?
|
|
88
|
+
validityFrom: e.dateFrom ? parseSafeDate(e.dateFrom) : null,
|
|
89
|
+
validityTo: e.dateTo ? parseSafeDate(e.dateTo) : null,
|
|
65
90
|
}))
|
|
66
91
|
,
|
|
67
92
|
total: response.endorsements.length,
|
|
@@ -85,9 +110,9 @@ const getPolicies_CNP = async (response) => {
|
|
|
85
110
|
const objectMapped = {
|
|
86
111
|
values: response.policies.map((p) => ({
|
|
87
112
|
number: p.number,
|
|
88
|
-
validityFrom:
|
|
113
|
+
validityFrom: parseSafeDate(p.issueDate),
|
|
89
114
|
validityTo: "N/A",
|
|
90
|
-
ingress:
|
|
115
|
+
ingress: parseSafeDate(p.issueDate),
|
|
91
116
|
holder: {
|
|
92
117
|
name: p.holder?.name || p.holder?.firstName,
|
|
93
118
|
identifications: {
|
|
@@ -314,10 +339,10 @@ const getPolicyCollectiveDetail_CNP = async (response) => {
|
|
|
314
339
|
code: response?.currency?.code || null,
|
|
315
340
|
months: "N/A"
|
|
316
341
|
},
|
|
317
|
-
dateFrom: response?.vigencyDateFrom ?
|
|
318
|
-
dateTo: response?.vigencyDateTo ?
|
|
342
|
+
dateFrom: response?.vigencyDateFrom ? parseSafeDate(response.vigencyDateFrom) : null,
|
|
343
|
+
dateTo: response?.vigencyDateTo ? parseSafeDate(response.vigencyDateTo) : null,
|
|
319
344
|
},
|
|
320
|
-
creationDate: response?.issueDate ?
|
|
345
|
+
creationDate: response?.issueDate ? parseSafeDate(response.issueDate) : null,
|
|
321
346
|
renewable: true,
|
|
322
347
|
process: {
|
|
323
348
|
name: response?.status?.name || null,
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { mapPaymentFrequency, mapProductCode } from "../../helpers/mappingHelpers";
|
|
2
|
-
import
|
|
2
|
+
import dayjs from 'dayjs';
|
|
3
3
|
|
|
4
4
|
const normalizeDateToYYYYMMDD = (date) => {
|
|
5
5
|
if (!date) return null;
|
|
6
6
|
|
|
7
7
|
const formats = ['DD/MM/YYYY', 'YYYY/MM/DD'];
|
|
8
|
-
const parsed =
|
|
8
|
+
const parsed = dayjs(date, formats, true);
|
|
9
9
|
|
|
10
10
|
return parsed.isValid()
|
|
11
11
|
? parsed.format('YYYY/MM/DD')
|