sysone-api-mapper 1.0.73 → 1.0.75

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,6 +1,6 @@
1
1
  {
2
2
  "name": "sysone-api-mapper",
3
- "version": "1.0.73",
3
+ "version": "1.0.75",
4
4
  "description": "Paquete mapper para portal de productores",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
@@ -34,7 +34,7 @@ import {
34
34
  quotationStandardPlanCreationMapped,
35
35
  quotationVariablePlanCreationMapped
36
36
  } from "./modules/quotation";
37
- import { getRequest_Params } from "./modules/request";
37
+ import { getRequest_Params, getRequestDetail } from "./modules/request";
38
38
 
39
39
  export const methods = {
40
40
  GET: "GET",
@@ -665,6 +665,20 @@ const requestModule = {
665
665
  }
666
666
  },
667
667
 
668
+ GET_REQUEST_DETAIL: {
669
+ default: {
670
+ url: '{0}/v1/requests/{1}',
671
+ method: methods.GET,
672
+ requestMapper: (request) => ({ mappedParams: request }),
673
+ responseMapper: (response) => response
674
+ },
675
+ cnp: {
676
+ url: '/request/v1/request/savings/{0}',
677
+ method: methods.GET,
678
+ requestMapper: request => ({ mappedParams: request }),
679
+ responseMapper: (response) => getRequestDetail(response)
680
+ }
681
+ },
668
682
 
669
683
  POST_SEND_REQUEST: {
670
684
  cnp: {
@@ -8,4 +8,53 @@ export const getRequest_Params = (i) => {
8
8
  from: i.creationDateFrom,
9
9
  to: i.creationDateTo
10
10
  }
11
+ }
12
+
13
+ const mappedCoverages = data.coverages.map(cov => ({
14
+ code: cov.code || null,
15
+ name: cov.name || null,
16
+ deductible: null,
17
+ economicValues: [],
18
+ coverageValues: cov.coverageValues.map(val => ({
19
+ value: val.value,
20
+ type: {
21
+ name: val.type.name,
22
+ code: val.type.code
23
+ }
24
+ }))
25
+ }))
26
+
27
+ export const getRequestDetail = (data) => {
28
+ const request = {
29
+ code: data.number,
30
+ commercialStructure: null,
31
+ creationDate: data.creationDate,
32
+ email: data.insured.email,
33
+ expirationDate: null,
34
+ holder: data.holder || null,
35
+ intermediary: null,
36
+ legalConstraint: null,
37
+ number: data.number || null,
38
+ paymentMethods: {
39
+ payment: data.payment
40
+ },
41
+ paymentFrequency: data.payment.period || null,
42
+ phone: data.insured.phoneNumber || null,
43
+ product: data.product || null,
44
+ productSegment: null,
45
+ quotationNumber: data.quotationNumber || null,
46
+ quotationCode: data.quotationNumber || null,
47
+ requiresBilling: null,
48
+ status: data.status || null,
49
+ validity: null,
50
+
51
+ values: {
52
+ risks: [{
53
+ coverages: mappedCoverages
54
+ }]
55
+ } || null,
56
+
57
+ vigencyDateFrom: null,
58
+ wordingPlan: null,
59
+ }
11
60
  }