sysone-api-mapper 1.0.121 → 1.0.123

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.121",
3
+ "version": "1.0.123",
4
4
  "description": "Paquete mapper para portal de productores",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
@@ -9,7 +9,8 @@ import {
9
9
  getIdentificationTypes,
10
10
  getMaritalStatuses,
11
11
  getProductsBySubsections_Request,
12
- getProvinces
12
+ getProvinces,
13
+ partySearchParams
13
14
  } from "./modules/party";
14
15
  import {
15
16
  getEndorsements_CNP,
@@ -30,6 +31,7 @@ import {
30
31
  import {
31
32
  getActivityList,
32
33
  getPaymentFrecuencies,
34
+ getProductParameters,
33
35
  getProductsBySubsections,
34
36
  getQuotationByCode,
35
37
  getQuotationByCode_Request,
@@ -337,6 +339,23 @@ const partyModule = {
337
339
  },
338
340
  },
339
341
 
342
+ GET_PARTIES: {
343
+ default: {
344
+ url: 'party/v1/individuals',
345
+ method: methods.GET,
346
+ source: "https://apidoc.sysone.com/party/v1/open-api.html#/paths/~1v1~1individuals/get",
347
+ requestMapper: (request) => ({ mappedParams: request }),
348
+ responseMapper: (response) => response.data,
349
+ },
350
+ cnp: {
351
+ url: 'party/v1/parties',
352
+ method: methods.GET,
353
+ source: "https://developers-test.cnp.com.ar/api-details#api=party-api&operation=get-v1-parties",
354
+ requestMapper: request => ({ mappedParams: partySearchParams(request) }),
355
+ responseMapper: (response) => response.data,
356
+ },
357
+ },
358
+
340
359
  POST_AGE: {
341
360
  default: {
342
361
  url: '',
@@ -407,7 +426,7 @@ const productModule = {
407
426
  url: `party/v1/products/{0}`,
408
427
  method: methods.GET,
409
428
  requestMapper: request => ({ mappedParams: request }),
410
- responseMapper: (response) => response.data,
429
+ responseMapper: (response) => getProductParameters(response.data),
411
430
  }
412
431
  },
413
432
 
@@ -62,7 +62,13 @@ export const getProductsBySubsections_Request = (params) => {
62
62
  }
63
63
  }
64
64
 
65
-
65
+ export const partySearchParams = (params) => {
66
+ return {
67
+ firstName: params.firstName || null,
68
+ lastName: params.lastName || null,
69
+ identification: params.identificationValue || null,
70
+ }
71
+ }
66
72
 
67
73
  export const getCoverages = (p) => {
68
74
  const objectMapped = {
@@ -136,9 +136,9 @@ const getPolicies_CNP_Request = (inputParams) => {
136
136
  pageSize: inputParams.pageSize || 10,
137
137
  allPolicies: null,
138
138
  policyNumber: inputParams.number,
139
- holderName: inputParams["name[firstName]"],
139
+ holderName: inputParams.holderName,
140
140
  holderIdentification: inputParams.holderIdentification,
141
- insuredName: inputParams.insuredName,
141
+ insuredName: inputParams["name[firstName]"],
142
142
  insuredIdentification: inputParams.insuredIdentification,
143
143
  requestNumber: inputParams.requestNumber,
144
144
  }
@@ -442,6 +442,20 @@ export const getProductsBySubsections = async (response) => {
442
442
  return objectMapped;
443
443
  };
444
444
 
445
+ export const getProductParameters = async (item) => {
446
+
447
+ const objectMapped = {
448
+ name: item.name,
449
+ code: item.code,
450
+ version: item.version,
451
+ subsection: item?.subsection || null,
452
+ fieldExclusions: item?.exclusions || null,
453
+ fields: item?.fields || null
454
+ }
455
+ return objectMapped;
456
+ }
457
+
458
+
445
459
  export const getPaymentFrecuencies = async (response) => {
446
460
  const objectMapped = {
447
461
  frequencies: response.frequencies.map(a => ({