cardus 0.0.64 → 0.0.66

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
@@ -198,21 +198,41 @@ class IntegrationManager {
198
198
  const cleanContent = contents.map((content) => (Object.assign(Object.assign({}, content), { peso_bruto: content.peso_bruto < 0.1 ? 1 : content.peso_bruto, peso_neto: content.peso_neto < 0.1 ? 1 : content.peso_neto, valor: content.valor <= 0 ? 1 : content.valor })));
199
199
  return cleanContent;
200
200
  };
201
- let userConfiguration = null;
201
+ const integrationShipmentDetails = this.dataToInsert.details;
202
+ let shipmentContent = null;
202
203
  const userSavedData = (yield configurationService.getDefaultProformaConfiguration(idUsuario)) ||
203
204
  [];
204
- if (userSavedData.length > 0) {
205
- userConfiguration = userSavedData;
205
+ if (integrationShipmentDetails) {
206
+ const shipmentContentFromDetails = integrationShipmentDetails.map((detail) => {
207
+ return {
208
+ id_usuario: idUsuario,
209
+ contenido: detail.bulto.nombre_producto,
210
+ valor: 5, // usar random entre 1 y 5
211
+ dni: user.dni,
212
+ taric: 'aaaaaa', // Sacar con función de IA que lo calcula a través de nombre del peoducto
213
+ eori_importacion: '', // Sacar de la tabla usuario
214
+ eori_exportacion: '', // Sacar de la tabla usuario
215
+ peso_bruto: detail.bulto.peso,
216
+ peso_neto: detail.bulto.peso,
217
+ origen: 1, // Sacar del país de origen de la orden pendiente. Nombre de país en inglés.
218
+ cantidad: detail.cantidad,
219
+ reason_export: '1'
220
+ };
221
+ });
222
+ shipmentContent = shipmentContentFromDetails;
223
+ }
224
+ else if (userSavedData.length > 0) {
225
+ shipmentContent = userSavedData;
206
226
  }
207
227
  else {
208
228
  const userFakeData = configurationService.getFakeDefaultProformaConfiguration(idUsuario, user.dni);
209
- userConfiguration = userFakeData;
229
+ shipmentContent = userFakeData;
210
230
  }
211
- if (userConfiguration) {
212
- userConfiguration = cleanContentData(userConfiguration);
231
+ if (shipmentContent) {
232
+ shipmentContent = cleanContentData(shipmentContent);
213
233
  tempShimpmentIds.forEach((tempShimpmentId) => {
214
- if (userConfiguration) {
215
- insert(userConfiguration, tempShimpmentId);
234
+ if (shipmentContent) {
235
+ insert(shipmentContent, tempShimpmentId);
216
236
  }
217
237
  });
218
238
  }
@@ -67,7 +67,8 @@ const cookTempShipment = (_a) => __awaiter(void 0, [_a], void 0, function* ({ or
67
67
  poblacion_llegada: order.ciudadLLegada,
68
68
  tlf_llegada: order.telefonoLLegada || 'no informado',
69
69
  mail_llegada: order.emailLLegada || 'no informado',
70
- dni_destinatario: (order === null || order === void 0 ? void 0 : order.numeroIdentificacionLLegada) || null
70
+ dni_destinatario: (order === null || order === void 0 ? void 0 : order.numeroIdentificacionLLegada) || null,
71
+ observaciones_llegada: order === null || order === void 0 ? void 0 : order.observacionesLLegada
71
72
  });
72
73
  });
73
74
  const setReembolso = (order) => {
package/index.ts CHANGED
@@ -277,25 +277,47 @@ export class IntegrationManager {
277
277
  return cleanContent;
278
278
  };
279
279
 
280
- let userConfiguration: UserDefaultConfigurationContent[] | null = null;
280
+ const integrationShipmentDetails = this.dataToInsert.details;
281
+ let shipmentContent: UserDefaultConfigurationContent[] | null = null;
281
282
  const userSavedData =
282
283
  (await configurationService.getDefaultProformaConfiguration(idUsuario)) ||
283
284
  [];
284
- if (userSavedData.length > 0) {
285
- userConfiguration = userSavedData;
285
+
286
+ if (integrationShipmentDetails) {
287
+ const shipmentContentFromDetails: UserDefaultConfigurationContent[] =
288
+ integrationShipmentDetails.map((detail) => {
289
+ return {
290
+ id_usuario: idUsuario,
291
+ contenido: detail.bulto.nombre_producto,
292
+ valor: 5, // usar random entre 1 y 5
293
+ dni: user.dni,
294
+ taric: 'aaaaaa', // Sacar con función de IA que lo calcula a través de nombre del peoducto
295
+ eori_importacion: '', // Sacar de la tabla usuario
296
+ eori_exportacion: '', // Sacar de la tabla usuario
297
+ peso_bruto: detail.bulto.peso,
298
+ peso_neto: detail.bulto.peso,
299
+ origen: 1, // Sacar del país de origen de la orden pendiente. Nombre de país en inglés.
300
+ cantidad: detail.cantidad,
301
+ reason_export: '1'
302
+ } as UserDefaultConfigurationContent;
303
+ });
304
+ shipmentContent = shipmentContentFromDetails;
305
+ } else if (userSavedData.length > 0) {
306
+ shipmentContent = userSavedData;
286
307
  } else {
287
308
  const userFakeData =
288
309
  configurationService.getFakeDefaultProformaConfiguration(
289
310
  idUsuario,
290
311
  user.dni
291
312
  );
292
- userConfiguration = userFakeData;
313
+ shipmentContent = userFakeData;
293
314
  }
294
- if (userConfiguration) {
295
- userConfiguration = cleanContentData(userConfiguration);
315
+
316
+ if (shipmentContent) {
317
+ shipmentContent = cleanContentData(shipmentContent);
296
318
  tempShimpmentIds.forEach((tempShimpmentId) => {
297
- if (userConfiguration) {
298
- insert(userConfiguration, tempShimpmentId);
319
+ if (shipmentContent) {
320
+ insert(shipmentContent, tempShimpmentId);
299
321
  }
300
322
  });
301
323
  }
@@ -111,7 +111,8 @@ export const cookTempShipment = async ({
111
111
  poblacion_llegada: order.ciudadLLegada,
112
112
  tlf_llegada: order.telefonoLLegada || 'no informado',
113
113
  mail_llegada: order.emailLLegada || 'no informado',
114
- dni_destinatario: order?.numeroIdentificacionLLegada || null
114
+ dni_destinatario: order?.numeroIdentificacionLLegada || null,
115
+ observaciones_llegada: order?.observacionesLLegada
115
116
  });
116
117
 
117
118
  const setReembolso = (order: ModifiedOrder) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cardus",
3
- "version": "0.0.64",
3
+ "version": "0.0.66",
4
4
  "description": "an integration manager",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
package/types/index.ts CHANGED
@@ -121,6 +121,7 @@ export type ModifiedOrder = {
121
121
  referenciaCliente?: string;
122
122
  etiquetaExtraInfo?: string;
123
123
  numeroIdentificacionLLegada?: string | null;
124
+ observacionesLLegada?: string;
124
125
  };
125
126
 
126
127
  export interface ModifiedOrderExtended extends ModifiedOrder {