cardus 0.0.77 → 0.0.79

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
@@ -117,11 +117,15 @@ class IntegrationManager {
117
117
  const parsedOrder = yield modificarOrdenOriginal({
118
118
  originalOrder: order
119
119
  });
120
+ let direccionSalida = null;
121
+ if (parsedOrder.direccionSalidaId) {
122
+ direccionSalida = yield addressesService.getAddress(addressId, idUsuario);
123
+ }
120
124
  const idEnvioTemporal = yield this.insertTempShipment({
121
125
  order: parsedOrder,
122
126
  agencyId,
123
127
  warehouseId,
124
- sellerAddress,
128
+ sellerAddress: direccionSalida !== null && direccionSalida !== void 0 ? direccionSalida : sellerAddress,
125
129
  idUsuario,
126
130
  isPriority: isPriorityByDefault
127
131
  });
@@ -212,9 +216,16 @@ class IntegrationManager {
212
216
  [];
213
217
  if (integrationShipmentDetails) {
214
218
  const shipmentContentFromDetails = yield Promise.all(integrationShipmentDetails.map((detail) => __awaiter(this, void 0, void 0, function* () {
215
- const taric = detail.bulto.nombre_producto
216
- ? yield llmAPIService.getTaricCode('chatgpt', detail.bulto.nombre_producto)
217
- : null;
219
+ let taric = null;
220
+ try {
221
+ if (detail.bulto.nombre_producto) {
222
+ taric = yield llmAPIService.getTaricCode('chatgpt', detail.bulto.nombre_producto);
223
+ }
224
+ }
225
+ catch (e) {
226
+ if (e instanceof Error)
227
+ console.error(e.stack);
228
+ }
218
229
  return {
219
230
  id_envio: detail.id_envio,
220
231
  id_usuario: idUsuario,
package/index.ts CHANGED
@@ -152,12 +152,19 @@ export class IntegrationManager {
152
152
  const parsedOrder = await modificarOrdenOriginal({
153
153
  originalOrder: order
154
154
  });
155
+ let direccionSalida = null;
156
+ if (parsedOrder.direccionSalidaId) {
157
+ direccionSalida = await addressesService.getAddress(
158
+ addressId,
159
+ idUsuario
160
+ );
161
+ }
155
162
 
156
163
  const idEnvioTemporal = await this.insertTempShipment({
157
164
  order: parsedOrder,
158
165
  agencyId,
159
166
  warehouseId,
160
- sellerAddress,
167
+ sellerAddress: direccionSalida ?? sellerAddress,
161
168
  idUsuario,
162
169
  isPriority: isPriorityByDefault
163
170
  });
@@ -298,12 +305,18 @@ export class IntegrationManager {
298
305
  if (integrationShipmentDetails) {
299
306
  const shipmentContentFromDetails = await Promise.all(
300
307
  integrationShipmentDetails.map(async (detail) => {
301
- const taric = detail.bulto.nombre_producto
302
- ? await llmAPIService.getTaricCode(
308
+ let taric = null;
309
+
310
+ try {
311
+ if (detail.bulto.nombre_producto) {
312
+ taric = await llmAPIService.getTaricCode(
303
313
  'chatgpt',
304
314
  detail.bulto.nombre_producto
305
- )
306
- : null;
315
+ );
316
+ }
317
+ } catch (e) {
318
+ if (e instanceof Error) console.error(e.stack);
319
+ }
307
320
 
308
321
  return {
309
322
  id_envio: detail.id_envio,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cardus",
3
- "version": "0.0.77",
3
+ "version": "0.0.79",
4
4
  "description": "an integration manager",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
package/types/index.ts CHANGED
@@ -126,6 +126,7 @@ export type ModifiedOrder = {
126
126
  numeroIdentificacionLLegada?: string | null;
127
127
  observacionesLLegada?: string;
128
128
  observaciones?: string;
129
+ direccionSalidaId?: number | null;
129
130
  };
130
131
 
131
132
  export interface ModifiedOrderExtended extends ModifiedOrder {