cardus 0.0.76 → 0.0.78

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
@@ -212,9 +212,16 @@ class IntegrationManager {
212
212
  [];
213
213
  if (integrationShipmentDetails) {
214
214
  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;
215
+ let taric = null;
216
+ try {
217
+ if (detail.bulto.nombre_producto) {
218
+ taric = yield llmAPIService.getTaricCode('chatgpt', detail.bulto.nombre_producto);
219
+ }
220
+ }
221
+ catch (e) {
222
+ if (e instanceof Error)
223
+ console.error(e.stack);
224
+ }
218
225
  return {
219
226
  id_envio: detail.id_envio,
220
227
  id_usuario: idUsuario,
@@ -53,6 +53,7 @@ const cookTempShipment = (_a) => __awaiter(void 0, [_a], void 0, function* ({ or
53
53
  return compradorLocation;
54
54
  });
55
55
  const setDatosComprador = (order) => __awaiter(void 0, void 0, void 0, function* () {
56
+ var _b;
56
57
  return ({
57
58
  nom_ape_llegada: order.primerApellidoLLegada
58
59
  ? order.nombreLLegada + ' ' + order.primerApellidoLLegada
@@ -65,7 +66,7 @@ const cookTempShipment = (_a) => __awaiter(void 0, [_a], void 0, function* ({ or
65
66
  : order.direccionLLegada1,
66
67
  cod_pos_llegada: order.codigoPostalLLegada,
67
68
  poblacion_llegada: order.ciudadLLegada,
68
- tlf_llegada: order.telefonoLLegada || 'no informado',
69
+ tlf_llegada: ((_b = order.telefonoLLegada) === null || _b === void 0 ? void 0 : _b.replace(/[^0-9+()]/g, '')) || 'no informado',
69
70
  mail_llegada: order.emailLLegada || 'no informado',
70
71
  dni_destinatario: (order === null || order === void 0 ? void 0 : order.numeroIdentificacionLLegada) || null,
71
72
  observaciones_llegada: order === null || order === void 0 ? void 0 : order.observacionesLLegada
package/index.ts CHANGED
@@ -298,12 +298,18 @@ export class IntegrationManager {
298
298
  if (integrationShipmentDetails) {
299
299
  const shipmentContentFromDetails = await Promise.all(
300
300
  integrationShipmentDetails.map(async (detail) => {
301
- const taric = detail.bulto.nombre_producto
302
- ? await llmAPIService.getTaricCode(
301
+ let taric = null;
302
+
303
+ try {
304
+ if (detail.bulto.nombre_producto) {
305
+ taric = await llmAPIService.getTaricCode(
303
306
  'chatgpt',
304
307
  detail.bulto.nombre_producto
305
- )
306
- : null;
308
+ );
309
+ }
310
+ } catch (e) {
311
+ if (e instanceof Error) console.error(e.stack);
312
+ }
307
313
 
308
314
  return {
309
315
  id_envio: detail.id_envio,
@@ -109,7 +109,8 @@ export const cookTempShipment = async ({
109
109
 
110
110
  cod_pos_llegada: order.codigoPostalLLegada,
111
111
  poblacion_llegada: order.ciudadLLegada,
112
- tlf_llegada: order.telefonoLLegada || 'no informado',
112
+ tlf_llegada:
113
+ order.telefonoLLegada?.replace(/[^0-9+()]/g, '') || 'no informado',
113
114
  mail_llegada: order.emailLLegada || 'no informado',
114
115
  dni_destinatario: order?.numeroIdentificacionLLegada || null,
115
116
  observaciones_llegada: order?.observacionesLLegada
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cardus",
3
- "version": "0.0.76",
3
+ "version": "0.0.78",
4
4
  "description": "an integration manager",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",