cardus 0.0.60 → 0.0.62

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
@@ -193,6 +193,11 @@ class IntegrationManager {
193
193
  this.dataToInsert.contents.push(Object.assign(Object.assign({}, tempContent), { id_envio: tempShimpmentId }));
194
194
  });
195
195
  };
196
+ // Limpia los contenidos para eliminar valores no deseados
197
+ const cleanContentData = (contents) => {
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
+ return cleanContent;
200
+ };
196
201
  let userConfiguration = null;
197
202
  const userSavedData = (yield configurationService.getDefaultProformaConfiguration(idUsuario)) ||
198
203
  [];
@@ -204,6 +209,7 @@ class IntegrationManager {
204
209
  userConfiguration = userFakeData;
205
210
  }
206
211
  if (userConfiguration) {
212
+ userConfiguration = cleanContentData(userConfiguration);
207
213
  tempShimpmentIds.forEach((tempShimpmentId) => {
208
214
  if (userConfiguration) {
209
215
  insert(userConfiguration, tempShimpmentId);
@@ -30,7 +30,7 @@ const cookTempShipment = (_a) => __awaiter(void 0, [_a], void 0, function* ({ or
30
30
  pais_salida: sellerAddress.nombre_pais,
31
31
  tlf_salida: sellerAddress.telefono,
32
32
  observaciones_salida: sellerAddress.observaciones,
33
- contacto_salida: sellerAddress.nombre,
33
+ contacto_salida: (sellerAddress.nombre || '|').slice(0, 40),
34
34
  mail_salida: sellerAddress.mail
35
35
  });
36
36
  const setUbicacionComprador = (order) => __awaiter(void 0, void 0, void 0, function* () {
@@ -58,8 +58,8 @@ const cookTempShipment = (_a) => __awaiter(void 0, [_a], void 0, function* ({ or
58
58
  ? order.nombreLLegada + ' ' + order.primerApellidoLLegada
59
59
  : order.nombreLLegada,
60
60
  contacto_llegada: order.primerApellidoLLegada
61
- ? order.nombreLLegada + ' ' + order.primerApellidoLLegada
62
- : order.nombreLLegada,
61
+ ? (order.nombreLLegada + ' ' + order.primerApellidoLLegada || '|').slice(0, 40)
62
+ : (order.nombreLLegada || '|').slice(0, 40),
63
63
  direccion_llegada: order.direccionLLegada2
64
64
  ? order.direccionLLegada1 + ' ' + order.direccionLLegada2
65
65
  : order.direccionLLegada1,
package/index.ts CHANGED
@@ -265,6 +265,18 @@ export class IntegrationManager {
265
265
  });
266
266
  };
267
267
 
268
+ // Limpia los contenidos para eliminar valores no deseados
269
+ const cleanContentData = (contents: UserDefaultConfigurationContent[]) => {
270
+ const cleanContent = contents.map((content) => ({
271
+ ...content,
272
+ peso_bruto: content.peso_bruto < 0.1 ? 1 : content.peso_bruto,
273
+ peso_neto: content.peso_neto < 0.1 ? 1 : content.peso_neto,
274
+ valor: content.valor <= 0 ? 1 : content.valor
275
+ }));
276
+
277
+ return cleanContent;
278
+ };
279
+
268
280
  let userConfiguration: UserDefaultConfigurationContent[] | null = null;
269
281
  const userSavedData =
270
282
  (await configurationService.getDefaultProformaConfiguration(idUsuario)) ||
@@ -280,6 +292,7 @@ export class IntegrationManager {
280
292
  userConfiguration = userFakeData;
281
293
  }
282
294
  if (userConfiguration) {
295
+ userConfiguration = cleanContentData(userConfiguration);
283
296
  tempShimpmentIds.forEach((tempShimpmentId) => {
284
297
  if (userConfiguration) {
285
298
  insert(userConfiguration, tempShimpmentId);
@@ -50,7 +50,7 @@ export const cookTempShipment = async ({
50
50
  pais_salida: sellerAddress.nombre_pais,
51
51
  tlf_salida: sellerAddress.telefono,
52
52
  observaciones_salida: sellerAddress.observaciones,
53
- contacto_salida: sellerAddress.nombre,
53
+ contacto_salida: (sellerAddress.nombre || '|').slice(0, 40),
54
54
  mail_salida: sellerAddress.mail
55
55
  });
56
56
 
@@ -97,8 +97,11 @@ export const cookTempShipment = async ({
97
97
  : order.nombreLLegada,
98
98
 
99
99
  contacto_llegada: order.primerApellidoLLegada
100
- ? order.nombreLLegada + ' ' + order.primerApellidoLLegada
101
- : order.nombreLLegada,
100
+ ? (order.nombreLLegada + ' ' + order.primerApellidoLLegada || '|').slice(
101
+ 0,
102
+ 40
103
+ )
104
+ : (order.nombreLLegada || '|').slice(0, 40),
102
105
 
103
106
  direccion_llegada: order.direccionLLegada2
104
107
  ? order.direccionLLegada1 + ' ' + order.direccionLLegada2
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cardus",
3
- "version": "0.0.60",
3
+ "version": "0.0.62",
4
4
  "description": "an integration manager",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",