cardus 0.0.114 → 0.0.116

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
@@ -195,7 +195,7 @@ class IntegrationManager {
195
195
  // mete los contents
196
196
  yield this.insertUserDefaultConfigurationContent({
197
197
  user,
198
- countryName: country.nombre_pais_en,
198
+ countryName: country.nombre_pais,
199
199
  shipmentDetails
200
200
  });
201
201
  return Object.assign(parsedOrder, { idEnvioTemporal, agencyId });
@@ -226,7 +226,7 @@ class IntegrationManager {
226
226
  insertUserDefaultConfigurationContent(_a) {
227
227
  return __awaiter(this, arguments, void 0, function* ({ user, countryName, shipmentDetails }) {
228
228
  const idUsuario = user.id_usuario;
229
- const { configurationService, llmAPIService } = this.services;
229
+ const { configurationService, llmAPIService, countriesService } = this.services;
230
230
  const insert = (data) => {
231
231
  data.forEach((tempContent) => {
232
232
  if (tempContent.contenido) {
@@ -256,6 +256,7 @@ class IntegrationManager {
256
256
  if (e instanceof Error)
257
257
  console.error(e.stack);
258
258
  }
259
+ const { nombre_pais } = yield countriesService.getCountryFromCountryCode(detail.bulto.origen);
259
260
  return {
260
261
  id_envio: detail.id_envio,
261
262
  id_usuario: idUsuario,
@@ -269,7 +270,7 @@ class IntegrationManager {
269
270
  eori_exportacion: user.eori_export,
270
271
  peso_bruto: detail.bulto.peso,
271
272
  peso_neto: detail.bulto.peso,
272
- origen: countryName,
273
+ origen: nombre_pais || countryName,
273
274
  cantidad: detail.cantidad,
274
275
  reason_export: '1'
275
276
  };
package/index.ts CHANGED
@@ -313,7 +313,7 @@ export class IntegrationManager {
313
313
  // mete los contents
314
314
  await this.insertUserDefaultConfigurationContent({
315
315
  user,
316
- countryName: country.nombre_pais_en,
316
+ countryName: country.nombre_pais,
317
317
  shipmentDetails
318
318
  });
319
319
 
@@ -367,7 +367,8 @@ export class IntegrationManager {
367
367
  shipmentDetails: InsertContentShipmentDetail[];
368
368
  }) {
369
369
  const idUsuario = user.id_usuario as number;
370
- const { configurationService, llmAPIService } = this.services;
370
+ const { configurationService, llmAPIService, countriesService } =
371
+ this.services;
371
372
 
372
373
  const insert = (data: UserDefaultConfigurationContent[]) => {
373
374
  data.forEach((tempContent) => {
@@ -413,6 +414,11 @@ export class IntegrationManager {
413
414
  if (e instanceof Error) console.error(e.stack);
414
415
  }
415
416
 
417
+ const { nombre_pais } =
418
+ await countriesService.getCountryFromCountryCode(
419
+ detail.bulto.origen
420
+ );
421
+
416
422
  return {
417
423
  id_envio: detail.id_envio,
418
424
  id_usuario: idUsuario,
@@ -426,7 +432,7 @@ export class IntegrationManager {
426
432
  eori_exportacion: user.eori_export,
427
433
  peso_bruto: detail.bulto.peso,
428
434
  peso_neto: detail.bulto.peso,
429
- origen: countryName,
435
+ origen: nombre_pais || countryName,
430
436
  cantidad: detail.cantidad,
431
437
  reason_export: '1'
432
438
  } as UserDefaultConfigurationContent;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cardus",
3
- "version": "0.0.114",
3
+ "version": "0.0.116",
4
4
  "description": "an integration manager",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
package/types/index.ts CHANGED
@@ -99,6 +99,7 @@ export type Bulto = {
99
99
  valor?: number;
100
100
  precio_producto: string | null;
101
101
  hs_code: string | null;
102
+ origen: string;
102
103
  };
103
104
  cantidad: number;
104
105
  };