sysone-api-mapper 1.0.38 → 1.0.39
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
|
|
1
|
+
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
|
package/package.json
CHANGED
package/src/mapper/Mapper.js
CHANGED
|
@@ -38,7 +38,6 @@ const configs = {
|
|
|
38
38
|
headers: {
|
|
39
39
|
["X-Channel"]: API_MAPPER.cnp.headers["X-Chanel"],
|
|
40
40
|
["X-Agent"]: API_MAPPER.cnp.headers["X-Agent"],
|
|
41
|
-
["X-Client"]: API_MAPPER.cnp.headers["X-Client"],
|
|
42
41
|
["Ocp-Apim-Subscription-Key"]: API_MAPPER.cnp.headers["Ocp-Apim-Subscription-Key"],
|
|
43
42
|
["X-Origin"]: "sysone-api-mapper"
|
|
44
43
|
},
|
|
@@ -75,6 +74,11 @@ export const apiMapper = async (
|
|
|
75
74
|
...additionalHeaders,
|
|
76
75
|
}
|
|
77
76
|
}
|
|
77
|
+
|
|
78
|
+
// Validar que se haya proporcionado X-Client
|
|
79
|
+
if (!config.headers["X-Client"]) {
|
|
80
|
+
throw new Error("Header X-Client es requerido para requests CNP");
|
|
81
|
+
}
|
|
78
82
|
} else {
|
|
79
83
|
// Para cualquier otro tenant, usar config default pero sobreescribir X-Tenant y X-User
|
|
80
84
|
config = {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// import { methods } from "./mapper";
|
|
2
2
|
import { getClaims_CNP } from "./modules/claim";
|
|
3
3
|
import { getModules, getModules_Request } from "./modules/general";
|
|
4
|
-
import { getCountries, getIdentificationTypes, getMaritalStatuses, getProductsBySubsections_Request, getProvinces } from "./modules/party";
|
|
4
|
+
import { getCountries, getGenders, getIdentificationTypes, getMaritalStatuses, getProductsBySubsections_Request, getProvinces } from "./modules/party";
|
|
5
5
|
import { getEndorsements_CNP, getEndorsements_Request, getInsureds_CNP, getInsureds_CNP_Request, getPolicies_CNP, getPolicies_CNP_Request, getPolicyCollectiveDetail_CNP, getPolicyCollectiveDetail_Request, getPolicyDetail_CNP, getPolicyIndividualDetail_Request, postInsureds_CNP } from "./modules/policy";
|
|
6
6
|
import { getActivityList, getPaymentFrecuencies, getProductsBySubsections, getQuotationByCode, getQuotationByCode_Request, getQuotations_Request, getQuotationsList, quotationStandardPlanCreationMapped, quotationVariablePlanCreationMapped } from "./modules/quotation";
|
|
7
7
|
|
|
@@ -48,6 +48,21 @@ export const tenantsConfig = {
|
|
|
48
48
|
responseMapper: (response) => response,
|
|
49
49
|
},
|
|
50
50
|
},
|
|
51
|
+
GET_GENDERS: {
|
|
52
|
+
default: {
|
|
53
|
+
url: 'party/v1/genders',
|
|
54
|
+
method: methods.GET,
|
|
55
|
+
source: 'https://apidoc.sysone.com/party/v1/open-api.html#/paths/~1v1~1genders/get',
|
|
56
|
+
requestMapper: (request) => ({ mappedParams: request }),
|
|
57
|
+
responseMapper: (response) => response,
|
|
58
|
+
},
|
|
59
|
+
cnp: {
|
|
60
|
+
url: 'party/v1/genders',
|
|
61
|
+
method: methods.GET,
|
|
62
|
+
requestMapper: request => ({ mappedParams: request }),
|
|
63
|
+
responseMapper: (response) => getGenders(response),
|
|
64
|
+
},
|
|
65
|
+
},
|
|
51
66
|
GET_COVERAGES: {
|
|
52
67
|
cnp: {
|
|
53
68
|
url: 'party/v1/products/{0}/coverages',
|
|
@@ -346,6 +361,7 @@ export const tenantsConfig = {
|
|
|
346
361
|
responseMapper: (response) => getPolicyDetail_CNP(response),
|
|
347
362
|
},
|
|
348
363
|
},
|
|
364
|
+
//--------------------------------------- QUOTATION ------------------------------------------------------
|
|
349
365
|
GET_QUOTATION_BY_CODE: {
|
|
350
366
|
default: {
|
|
351
367
|
url: 'quotation/v1/quotations/{0}',
|
|
@@ -371,14 +387,12 @@ export const tenantsConfig = {
|
|
|
371
387
|
responseMapper: (response) => response
|
|
372
388
|
},
|
|
373
389
|
cnp: {
|
|
374
|
-
url: 'quotation/v1/
|
|
390
|
+
url: 'quotation/v1/quotations',
|
|
375
391
|
method: methods.GET,
|
|
376
|
-
source: 'https://developers-test.cnp.com.ar/api-details#api=quotation-api&operation=get-v1-quotation-variable-plan',
|
|
377
392
|
requestMapper: request => ({ mappedParams: getQuotations_Request(request) }),
|
|
378
393
|
responseMapper: (response) => getQuotationsList(response)
|
|
379
394
|
}
|
|
380
395
|
},
|
|
381
|
-
GET_PAYMENT_METHODS: {},
|
|
382
396
|
|
|
383
397
|
//------------- POST -----------------------------
|
|
384
398
|
POST_INSURED_UPDATE: {
|
|
@@ -453,6 +467,14 @@ export const tenantsConfig = {
|
|
|
453
467
|
responseMapper: (response) => response,
|
|
454
468
|
}
|
|
455
469
|
},
|
|
470
|
+
POST_CALCULATE_LS: {
|
|
471
|
+
cnp: {
|
|
472
|
+
url: 'quotation/v1/quotations/calculate',
|
|
473
|
+
method: methods.POST,
|
|
474
|
+
requestMapper: (params) => ({ mappedBody: params }),
|
|
475
|
+
responseMapper: (response) => response,
|
|
476
|
+
}
|
|
477
|
+
},
|
|
456
478
|
|
|
457
479
|
//------------- PUT ------------------------------
|
|
458
480
|
CREATE_INSURED: {
|
|
@@ -46,6 +46,16 @@ export const getMaritalStatuses = async (response) => {
|
|
|
46
46
|
return objectMapped;
|
|
47
47
|
}
|
|
48
48
|
|
|
49
|
+
export const getGenders = async (response) => {
|
|
50
|
+
const objectMapped = {
|
|
51
|
+
values: response.genders.map(a => ({
|
|
52
|
+
name: a.name,
|
|
53
|
+
code: a.code,
|
|
54
|
+
})),
|
|
55
|
+
}
|
|
56
|
+
return objectMapped;
|
|
57
|
+
}
|
|
58
|
+
|
|
49
59
|
export const getProductsBySubsections_Request = (params) => {
|
|
50
60
|
return {
|
|
51
61
|
subsectionCode: null
|
|
@@ -3,34 +3,34 @@ import { mapPaymentFrequency, mapProductCode } from "../../helpers/mappingHelper
|
|
|
3
3
|
export const getQuotationsList = async (response) => {
|
|
4
4
|
const objectMapped = {
|
|
5
5
|
quotations: response.quotations.map(q => ({
|
|
6
|
-
code:
|
|
7
|
-
creationDate:
|
|
8
|
-
email:
|
|
9
|
-
expirationDate:
|
|
10
|
-
number: q.
|
|
6
|
+
code: q.code || null,
|
|
7
|
+
creationDate: q.creationDate || null,
|
|
8
|
+
email: q.email || null,
|
|
9
|
+
expirationDate: q.expirationDate || null,
|
|
10
|
+
number: q.number || null,
|
|
11
11
|
paymentFrequency: {
|
|
12
|
-
name:
|
|
13
|
-
code:
|
|
12
|
+
name: q.paymentFrequency.name || null,
|
|
13
|
+
code: q.paymentFrequency.code || null,
|
|
14
14
|
},
|
|
15
15
|
product: {
|
|
16
|
-
code: q.
|
|
17
|
-
name:
|
|
16
|
+
code: q.product?.code.toString() || null,
|
|
17
|
+
name: q.product?.name,
|
|
18
18
|
subsection: {
|
|
19
|
-
code:
|
|
20
|
-
name:
|
|
19
|
+
code: q.product?.subsection?.code || null,
|
|
20
|
+
name: q.product?.subsection?.name || null,
|
|
21
21
|
section: {
|
|
22
|
-
code: q.
|
|
23
|
-
name:
|
|
22
|
+
code: q.product?.subsection?.section?.code || null,
|
|
23
|
+
name: q.product?.subsection?.section?.name || null,
|
|
24
24
|
}
|
|
25
25
|
},
|
|
26
|
-
version: 0,
|
|
26
|
+
version: q.product?.version || 0,
|
|
27
27
|
},
|
|
28
28
|
status: {
|
|
29
|
-
code:
|
|
30
|
-
name:
|
|
29
|
+
code: q.status.code || null,
|
|
30
|
+
name: q.status.name || null,
|
|
31
31
|
},
|
|
32
32
|
})),
|
|
33
|
-
total:
|
|
33
|
+
total: response.total || null,
|
|
34
34
|
};
|
|
35
35
|
return objectMapped;
|
|
36
36
|
};
|