cardus 0.0.80 → 0.0.82

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/dist/index.js CHANGED
@@ -119,7 +119,7 @@ class IntegrationManager {
119
119
  });
120
120
  let direccionSalida = null;
121
121
  if (parsedOrder.direccionSalidaId) {
122
- direccionSalida = yield addressesService.getAddress(addressId, idUsuario);
122
+ direccionSalida = yield addressesService.getAddress(parsedOrder.direccionSalidaId, idUsuario);
123
123
  }
124
124
  const idEnvioTemporal = yield this.insertTempShipment({
125
125
  order: parsedOrder,
@@ -52,6 +52,30 @@ const cookTempShipment = (_a) => __awaiter(void 0, [_a], void 0, function* ({ or
52
52
  }
53
53
  return compradorLocation;
54
54
  });
55
+ const customEmailLlegada = (email) => {
56
+ if (!email)
57
+ return 'no informado';
58
+ const esEmailMiraklInvalido = email.startsWith('mirakl') && email.endsWith('@invalid.local');
59
+ if (esEmailMiraklInvalido) {
60
+ switch (process.env.PORTAL_ID) {
61
+ case '1':
62
+ return 'noinformado@genei.es';
63
+ case '2':
64
+ return 'noinformado@sendiroo.es';
65
+ case '3':
66
+ return 'noinformado@sendiroo.it';
67
+ case '4':
68
+ return 'noinformado@sendiroo.fr';
69
+ case '5':
70
+ return 'noinformado@sendiroo.pt';
71
+ default:
72
+ return 'noinformado@genei.es';
73
+ }
74
+ }
75
+ else {
76
+ return email;
77
+ }
78
+ };
55
79
  const setDatosComprador = (order) => __awaiter(void 0, void 0, void 0, function* () {
56
80
  var _b;
57
81
  return ({
@@ -67,7 +91,7 @@ const cookTempShipment = (_a) => __awaiter(void 0, [_a], void 0, function* ({ or
67
91
  cod_pos_llegada: order.codigoPostalLLegada,
68
92
  poblacion_llegada: order.ciudadLLegada,
69
93
  tlf_llegada: ((_b = order.telefonoLLegada) === null || _b === void 0 ? void 0 : _b.replace(/[^0-9+()]/g, '')) || 'no informado',
70
- mail_llegada: order.emailLLegada || 'no informado',
94
+ mail_llegada: customEmailLlegada(order.emailLLegada),
71
95
  dni_destinatario: (order === null || order === void 0 ? void 0 : order.numeroIdentificacionLLegada) || null,
72
96
  observaciones_llegada: order === null || order === void 0 ? void 0 : order.observacionesLLegada
73
97
  });
package/index.ts CHANGED
@@ -155,7 +155,7 @@ export class IntegrationManager {
155
155
  let direccionSalida = null;
156
156
  if (parsedOrder.direccionSalidaId) {
157
157
  direccionSalida = await addressesService.getAddress(
158
- addressId,
158
+ parsedOrder.direccionSalidaId,
159
159
  idUsuario
160
160
  );
161
161
  }
@@ -91,6 +91,32 @@ export const cookTempShipment = async ({
91
91
  return compradorLocation;
92
92
  };
93
93
 
94
+ const customEmailLlegada = (email: string | undefined): string => {
95
+ if (!email) return 'no informado';
96
+
97
+ const esEmailMiraklInvalido =
98
+ email.startsWith('mirakl') && email.endsWith('@invalid.local');
99
+
100
+ if (esEmailMiraklInvalido) {
101
+ switch (process.env.PORTAL_ID) {
102
+ case '1':
103
+ return 'noinformado@genei.es';
104
+ case '2':
105
+ return 'noinformado@sendiroo.es';
106
+ case '3':
107
+ return 'noinformado@sendiroo.it';
108
+ case '4':
109
+ return 'noinformado@sendiroo.fr';
110
+ case '5':
111
+ return 'noinformado@sendiroo.pt';
112
+ default:
113
+ return 'noinformado@genei.es';
114
+ }
115
+ } else {
116
+ return email;
117
+ }
118
+ };
119
+
94
120
  const setDatosComprador = async (order: ModifiedOrder) => ({
95
121
  nom_ape_llegada: order.primerApellidoLLegada
96
122
  ? order.nombreLLegada + ' ' + order.primerApellidoLLegada
@@ -111,7 +137,7 @@ export const cookTempShipment = async ({
111
137
  poblacion_llegada: order.ciudadLLegada,
112
138
  tlf_llegada:
113
139
  order.telefonoLLegada?.replace(/[^0-9+()]/g, '') || 'no informado',
114
- mail_llegada: order.emailLLegada || 'no informado',
140
+ mail_llegada: customEmailLlegada(order.emailLLegada),
115
141
  dni_destinatario: order?.numeroIdentificacionLLegada || null,
116
142
  observaciones_llegada: order?.observacionesLLegada
117
143
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cardus",
3
- "version": "0.0.80",
3
+ "version": "0.0.82",
4
4
  "description": "an integration manager",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",