sysone-api-mapper 1.0.131 → 1.0.133
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.
|
|
3
|
+
"version": "1.0.133",
|
|
4
4
|
"description": "Paquete mapper para portal de productores",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -23,6 +23,7 @@
|
|
|
23
23
|
"cors": "^2.8.5",
|
|
24
24
|
"dotenv": "^16.0.3",
|
|
25
25
|
"express": "^4.21.2",
|
|
26
|
+
"moment": "^2.30.1",
|
|
26
27
|
"os-browserify": "^0.3.0",
|
|
27
28
|
"path-browserify": "^1.0.1",
|
|
28
29
|
"process": "^0.11.10",
|
|
@@ -486,7 +486,7 @@ const policyModule = {
|
|
|
486
486
|
|
|
487
487
|
GET_INSUREDS: {
|
|
488
488
|
default: {
|
|
489
|
-
url: '
|
|
489
|
+
url: '{0}/v1/policies/{1}/insureds',
|
|
490
490
|
method: methods.GET,
|
|
491
491
|
source: 'https://apidoc.sysone.com/policy-life/v1/open-api.html#/paths/~1v1~1policies~1%7Bcode%7D~1insureds/get',
|
|
492
492
|
requestMapper: (request) => ({ mappedParams: request }),
|
|
@@ -1,12 +1,24 @@
|
|
|
1
1
|
import { mapPaymentFrequency, mapProductCode } from "../../helpers/mappingHelpers";
|
|
2
|
+
import moment from 'moment';
|
|
3
|
+
|
|
4
|
+
const normalizeDateToYYYYMMDD = (date) => {
|
|
5
|
+
if (!date) return null;
|
|
6
|
+
|
|
7
|
+
const formats = ['DD/MM/YYYY', 'YYYY/MM/DD'];
|
|
8
|
+
const parsed = moment(date, formats, true);
|
|
9
|
+
|
|
10
|
+
return parsed.isValid()
|
|
11
|
+
? parsed.format('YYYY/MM/DD')
|
|
12
|
+
: null;
|
|
13
|
+
};
|
|
2
14
|
|
|
3
15
|
export const getQuotationsList = async (response) => {
|
|
4
16
|
const quotations = Array.isArray(response?.quotations)
|
|
5
17
|
? response.quotations.map(q => ({
|
|
6
18
|
code: q.code || null,
|
|
7
|
-
creationDate: q.creationDate || null,
|
|
8
19
|
email: q.email || null,
|
|
9
|
-
|
|
20
|
+
creationDate: normalizeDateToYYYYMMDD(q.creationDate),
|
|
21
|
+
expirationDate: normalizeDateToYYYYMMDD(q.expirationDate),
|
|
10
22
|
number: q.number || null,
|
|
11
23
|
paymentFrequency: {
|
|
12
24
|
name: q.paymentFrequency?.name || null,
|