cardus 0.0.42 → 0.0.44

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
@@ -65,7 +65,8 @@ class IntegrationManager {
65
65
  : null,
66
66
  marketplaceId: order.marketplaceId,
67
67
  id_documento_holded: order.idDocumentoHolded,
68
- tipo_documento_holded: order.tipoDocumentoHolded || ''
68
+ tipo_documento_holded: order.tipoDocumentoHolded || '',
69
+ agencia_envio_integracion: order.agenciaEnvioIntegracion || ''
69
70
  });
70
71
  };
71
72
  this.insertTempShipmentLines = (_c) => __awaiter(this, [_c], void 0, function* ({ idEnvioTemporal, group }) {
@@ -204,13 +205,15 @@ class IntegrationManager {
204
205
  insertQuantityRelatedLines(_a) {
205
206
  return __awaiter(this, arguments, void 0, function* ({ orders, idUsuario, crearBulto, estaAgrupado }) {
206
207
  const createBultoFromLine = (_b) => __awaiter(this, [_b], void 0, function* ({ line, idEnvioTemporal }) {
207
- const { bulto, cantidad = 0 } = yield crearBulto({
208
+ const result = yield crearBulto({
208
209
  lineItems: { idEnvioTemporal, line },
209
210
  idUsuario
210
211
  });
211
- if (cantidad === 0)
212
- return null;
213
- return { bulto, cantidad, idEnvioTemporal };
212
+ const { bulto, cantidad } = result;
213
+ if (cantidad && bulto) {
214
+ return { bulto, cantidad, idEnvioTemporal };
215
+ }
216
+ return null;
214
217
  });
215
218
  const obtenerBultosYCantidades = [];
216
219
  orders.forEach(({ idEnvioTemporal, lineas }) => {
package/index.ts CHANGED
@@ -326,7 +326,8 @@ export class IntegrationManager {
326
326
  : null,
327
327
  marketplaceId: order.marketplaceId,
328
328
  id_documento_holded: order.idDocumentoHolded,
329
- tipo_documento_holded: order.tipoDocumentoHolded || ''
329
+ tipo_documento_holded: order.tipoDocumentoHolded || '',
330
+ agencia_envio_integracion: order.agenciaEnvioIntegracion || ''
330
331
  });
331
332
  };
332
333
 
@@ -376,12 +377,16 @@ export class IntegrationManager {
376
377
  line: InsertContentShipmentLine;
377
378
  idEnvioTemporal: number;
378
379
  }): Promise<BultoYCantidad | null> => {
379
- const { bulto, cantidad = 0 } = await crearBulto({
380
+ const result = await crearBulto({
380
381
  lineItems: { idEnvioTemporal, line },
381
382
  idUsuario
382
383
  });
383
- if (cantidad === 0) return null;
384
- return { bulto, cantidad, idEnvioTemporal };
384
+ const { bulto, cantidad } = result;
385
+
386
+ if (cantidad && bulto) {
387
+ return { bulto, cantidad, idEnvioTemporal };
388
+ }
389
+ return null;
385
390
  };
386
391
 
387
392
  const obtenerBultosYCantidades: Array<Promise<BultoYCantidad | null>> = [];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cardus",
3
- "version": "0.0.42",
3
+ "version": "0.0.44",
4
4
  "description": "an integration manager",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
package/types/index.ts CHANGED
@@ -97,6 +97,7 @@ export type ModifiedOrder = {
97
97
  tipoDocumentoHolded?: string;
98
98
  isPriority: 0 | 1;
99
99
  idCarrier?: number | null;
100
+ agenciaEnvioIntegracion: string | null;
100
101
  };
101
102
 
102
103
  export interface ModifiedOrderExtended extends ModifiedOrder {
@@ -108,7 +109,7 @@ type FetchAllOrders = () => Promise<OriginalOrder[]>;
108
109
  export type CrearBulto = (params: {
109
110
  lineItems: { idEnvioTemporal: number; line: AnyObject };
110
111
  idUsuario: number;
111
- }) => Promise<Bulto>;
112
+ }) => Promise<Bulto | { bulto: null; cantidad: 0 }>;
112
113
 
113
114
  type ModificarOrdenOriginal = (param: {
114
115
  originalOrder: OriginalOrder;
@@ -166,6 +167,7 @@ export type IntegrationsService = {
166
167
  marketplaceId?: string | null;
167
168
  id_documento_holded?: string;
168
169
  tipo_documento_holded?: string;
170
+ agencia_envio_integracion: string | null;
169
171
  }) => number | false;
170
172
 
171
173
  insertTempShipmentLines: (params: {
@@ -353,4 +355,5 @@ type InsertContentShipmentExternal = {
353
355
  marketplaceId?: string | null;
354
356
  id_documento_holded?: string;
355
357
  tipo_documento_holded?: string;
358
+ agencia_envio_integracion: string | null;
356
359
  };