sysone-api-mapper 1.0.126 → 1.0.127
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
|
@@ -10,6 +10,7 @@ import {
|
|
|
10
10
|
getMaritalStatuses,
|
|
11
11
|
getProductsBySubsections_Request,
|
|
12
12
|
getProvinces,
|
|
13
|
+
partySearch,
|
|
13
14
|
partySearchParams
|
|
14
15
|
} from "./modules/party";
|
|
15
16
|
import {
|
|
@@ -352,7 +353,7 @@ const partyModule = {
|
|
|
352
353
|
method: methods.GET,
|
|
353
354
|
source: "https://developers-test.cnp.com.ar/api-details#api=party-api&operation=get-v1-parties",
|
|
354
355
|
requestMapper: request => ({ mappedParams: partySearchParams(request) }),
|
|
355
|
-
responseMapper: (response) => response.data,
|
|
356
|
+
responseMapper: (response) => partySearch(response.data),
|
|
356
357
|
},
|
|
357
358
|
},
|
|
358
359
|
|
|
@@ -70,6 +70,40 @@ export const partySearchParams = (params) => {
|
|
|
70
70
|
}
|
|
71
71
|
}
|
|
72
72
|
|
|
73
|
+
export const partySearch = (res) => {
|
|
74
|
+
const objectMapped = {
|
|
75
|
+
values: res?.parties?.map(party => {
|
|
76
|
+
|
|
77
|
+
// Separación por doble espacio
|
|
78
|
+
const [lastNamePart, firstNamePart] = party?.fullName?.split(" ") || [];
|
|
79
|
+
|
|
80
|
+
return {
|
|
81
|
+
activeDate: party?.activeDate || null,
|
|
82
|
+
code: party?.code || null,
|
|
83
|
+
firstName: firstNamePart || null,
|
|
84
|
+
lastName: lastNamePart || null,
|
|
85
|
+
identifications: {
|
|
86
|
+
values: [
|
|
87
|
+
{
|
|
88
|
+
default: true,
|
|
89
|
+
type: {
|
|
90
|
+
code: "",
|
|
91
|
+
name: "",
|
|
92
|
+
},
|
|
93
|
+
value: party?.identification?.value || null,
|
|
94
|
+
}
|
|
95
|
+
]
|
|
96
|
+
},
|
|
97
|
+
birthDate: party?.birthDate,
|
|
98
|
+
insuredCode: party?.insuredCode
|
|
99
|
+
};
|
|
100
|
+
})
|
|
101
|
+
};
|
|
102
|
+
|
|
103
|
+
return objectMapped;
|
|
104
|
+
};
|
|
105
|
+
|
|
106
|
+
|
|
73
107
|
export const getCoverages = (p) => {
|
|
74
108
|
const objectMapped = {
|
|
75
109
|
coverages: p.coverages?.map(c => ({
|