sysone-api-mapper 1.0.115 → 1.0.117

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.115",
3
+ "version": "1.0.117",
4
4
  "description": "Paquete mapper para portal de productores",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
@@ -1,5 +1,5 @@
1
1
  // Import modules organized by functionality
2
- import { getBillingsParams, getBillingsResponse } from "./modules/billing";
2
+ import { getBillingsParams, getBillingsResponse, getBillingTypeResponse } from "./modules/billing";
3
3
  import { getClaims_CNP } from "./modules/claim";
4
4
  import { getModules, getModules_Request } from "./modules/general";
5
5
  import {
@@ -104,7 +104,12 @@ const billingModule = {
104
104
  requestMapper: (request) => ({ mappedParams: request }),
105
105
  responseMapper: (response) => response.data,
106
106
  },
107
- cnp: null
107
+ cnp: {
108
+ url: 'party/v1/genders',
109
+ method: methods.GET,
110
+ requestMapper: request => ({ mappedParams: request }),
111
+ responseMapper: (response) => getBillingTypeResponse(response.data),
112
+ },
108
113
  },
109
114
  };
110
115
 
@@ -3,14 +3,14 @@ export const getBillingsParams = (i) => {
3
3
  }
4
4
 
5
5
  export const getBillingsResponse = (data) => {
6
- const values = data.paymentsEndorsement.map((endorsement, index) => {
6
+ const values = data.paymentsEndorsement.flatMap((endorsement, index) => {
7
7
 
8
8
  return endorsement.payments.map((payment, pIndex) => ({
9
9
  id: `${index + 1}-${pIndex + 1}`, // No tiene ID propio, uso el index + 1
10
10
  code: `${index + 1}-${pIndex + 1}`, // No tiene código propio, uso el index + 1
11
11
  billingNumber: payment.installmentNumber,
12
12
  billingDate: payment.paymentDate,
13
- billingExpirationDate: payment.expirationDate ?? payment.expiration,
13
+ billingExpirationDate: payment.expiration ?? payment.expirationDate,
14
14
  totalAmount: payment.amount,
15
15
  remainingAmount: payment.debt,
16
16
  paymentStatus: {
@@ -23,10 +23,13 @@ export const getBillingsResponse = (data) => {
23
23
  billingValuesGrouping: [
24
24
  {
25
25
  type: { name: "Prima", code: "PRIME" },
26
- value: payment.amount // ----- SOLO LLEGA LA PRIMA ??? NO HAY PREMIO, GASTOS, IMPUESTOS, OTROS ?
26
+ value: payment.amount // ----- SOLO LLEGA LA PRIMA
27
27
  }
28
28
  ],
29
- type: {}, // ----- NO HAY TIPO DE FACTURACION
29
+ type: {
30
+ name: "Factura",
31
+ code: "INVOICE",
32
+ },
30
33
  subtype: {},
31
34
  exchangeRate: null,
32
35
  billingDateFrom: "N/A",
@@ -41,3 +44,15 @@ export const getBillingsResponse = (data) => {
41
44
  };
42
45
  };
43
46
 
47
+
48
+ export const getBillingTypeResponse = () => {
49
+ return {
50
+ types: [
51
+ {
52
+ name: "Factura",
53
+ code: "INVOICE",
54
+ operator: null
55
+ },
56
+ ]
57
+ }
58
+ }