sysone-api-mapper 1.0.32 → 1.0.33

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.32",
3
+ "version": "1.0.33",
4
4
  "description": "Paquete mapper para portal de productores",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
@@ -3,7 +3,7 @@ import { getClaims_CNP } from "./modules/claim";
3
3
  import { getModules, getModules_Request } from "./modules/general";
4
4
  import { getCountries, getIdentificationTypes, getMaritalStatuses, 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
- import { getActivityList, getQuotationByCode, getQuotationByCode_Request, getQuotations_Request, getQuotationsList, quotationStandardPlanCreationMapped, quotationVariablePlanCreationMapped } from "./modules/quotation";
6
+ import { getActivityList, getPaymentFrecuencies, getProductsBySubsections, getQuotationByCode, getQuotationByCode_Request, getQuotations_Request, getQuotationsList, quotationStandardPlanCreationMapped, quotationVariablePlanCreationMapped } from "./modules/quotation";
7
7
 
8
8
  export const methods = {
9
9
  GET: "GET",
@@ -125,6 +125,64 @@ export const tenantsConfig = {
125
125
  responseMapper: (response) => response
126
126
  },
127
127
  },
128
+ GET_PRODUCTS_BY_SUBSECTIONS: {
129
+ default: {
130
+ url: 'product/v1/subsections/{0}/products',
131
+ method: methods.GET,
132
+ source: 'https://apidoc.sysone.com/product/v1/open-api.html#/paths/~1v1~1subsections~1%7Bcode%7D~1products/get',
133
+ requestMapper: (request) => ({ mappedParams: request }),
134
+ responseMapper: (response) => response,
135
+ },
136
+ cnp: {
137
+ url: 'party/v1/subsections/{0}/products',
138
+ method: methods.GET,
139
+ source: "https://developers-test.cnp.com.ar/api-details#api=party-api&operation=get-v1-subsections-code-products",
140
+ requestMapper: request => ({ mappedParams: request }),
141
+ responseMapper: (response) => getProductsBySubsections(response),
142
+ },
143
+ },
144
+ GET_MONETARY_GOALS: {
145
+ cnp: {
146
+ url: 'party/v1/monetary-goals',
147
+ method: methods.GET,
148
+ source: "https://developers-test.cnp.com.ar/api-details#api=party-api&operation=get-v1-monetary-goals",
149
+ requestMapper: request => ({ mappedParams: request }),
150
+ responseMapper: (response) => response,
151
+ },
152
+ },
153
+ GET_PAYMENT_FRECUENCIES: {
154
+ default: {
155
+ url: 'quotation/v1/payment-frequencies',
156
+ method: methods.GET,
157
+ requestMapper: (request) => ({ mappedParams: request }),
158
+ responseMapper: (response) => response,
159
+ },
160
+ cnp: {
161
+ url: 'party/v1/payment-frequencies',
162
+ method: methods.GET,
163
+ source: "https://developers-test.cnp.com.ar/api-details#api=party-api&operation=get-v1-payment-frequencies",
164
+ requestMapper: request => ({ mappedParams: request }),
165
+ responseMapper: (response) => getPaymentFrecuencies(response),
166
+ },
167
+ },
168
+ GET_SAVINGS_DISTRIBUTION: {
169
+ cnp: {
170
+ url: 'party/v1/products/{0}/savings-distribution',
171
+ method: methods.GET,
172
+ source: "https://developers-test.cnp.com.ar/api-details#api=party-api&operation=get-v1-products-code-savings-distribution-goalcode-goalcode-goalamount-goala",
173
+ requestMapper: request => ({ mappedParams: request }),
174
+ responseMapper: (response) => response,
175
+ },
176
+ },
177
+ GET_SAVINGS_DISTRIBUTION: {
178
+ cnp: {
179
+ url: 'party/v1/quotation-benefits',
180
+ method: methods.GET,
181
+ source: "https://developers-test.cnp.com.ar/api-details#api=party-api&operation=get-v1-quotation-benefits",
182
+ requestMapper: request => ({ mappedParams: request }),
183
+ responseMapper: (response) => response,
184
+ },
185
+ },
128
186
 
129
187
  //------------------------------------------------
130
188
  GET_CLAIMS: {
@@ -269,4 +269,27 @@ export const getActivityList = async (response) => {
269
269
  })),
270
270
  }
271
271
  return objectMapped;
272
+ }
273
+
274
+ export const getProductsBySubsections = async (response) => {
275
+ const objectMapped = {
276
+ values: response.products.map(a => ({
277
+ name: a.name,
278
+ code: a.code,
279
+ version: a.version,
280
+ subsection: a?.subsection || null
281
+ })),
282
+ }
283
+ return objectMapped;
284
+ }
285
+
286
+ export const getPaymentFrecuencies = async (response) => {
287
+ const objectMapped = {
288
+ frequencies: response.frequencies.map(a => ({
289
+ name: a.name,
290
+ code: a.code,
291
+ months: a.months
292
+ })),
293
+ }
294
+ return objectMapped;
272
295
  }