sysone-api-mapper 1.0.97 → 1.0.98

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.97",
3
+ "version": "1.0.98",
4
4
  "description": "Paquete mapper para portal de productores",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
@@ -78,6 +78,13 @@ const getEndorsements_Request = (inputParams) => {
78
78
  }
79
79
 
80
80
  const getPolicies_CNP = async (response) => {
81
+ if (!response?.policies || response.policies.length === 0) {
82
+ return {
83
+ values: [],
84
+ total: 0
85
+ };
86
+ }
87
+
81
88
  const objectMapped = {
82
89
  values: response.policies.map((p) => ({
83
90
  number: p.number,
@@ -102,7 +109,7 @@ const getPolicies_CNP = async (response) => {
102
109
  code: "N/A",
103
110
  alias: "N/A",
104
111
  product: {
105
- code: p.section?.code.toString() || null,
112
+ code: p.section?.code?.toString() || null,
106
113
  name: p.section?.name || null,
107
114
  subsection: {
108
115
  name: "N/A",
@@ -118,8 +125,9 @@ const getPolicies_CNP = async (response) => {
118
125
  code: "N/A"
119
126
  }
120
127
  })),
121
- total: response.totalRecord || null,
128
+ total: response.totalRecord || 0,
122
129
  };
130
+
123
131
  return objectMapped;
124
132
  }
125
133