cardus 0.0.9 → 0.0.11

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
@@ -92,19 +92,19 @@ class IntegrationManager {
92
92
  const sellerAddress = warehouseId > 0
93
93
  ? yield addressesService.getWarehouseAddress(idUsuario)
94
94
  : yield addressesService.getAddress(addressId, idUsuario);
95
- const allShopifyOrders = yield fetchAllOrders();
95
+ const allOrders = yield fetchAllOrders();
96
96
  const filteredOrders = yield integrationsService.filterExternalDuplicatedOrders({
97
97
  idUsuario,
98
- orders: allShopifyOrders,
98
+ orders: allOrders,
99
99
  type: this.type
100
100
  });
101
101
  const insertOrdersResult = yield new this.executionManager({
102
- arrayParams: allShopifyOrders,
102
+ arrayParams: allOrders,
103
103
  executable: (order) => __awaiter(this, void 0, void 0, function* () {
104
- const parsedOrder = modificarOrdenOriginal({ originalOrder: order });
104
+ const parsedOrder = yield modificarOrdenOriginal({ originalOrder: order });
105
105
  const duplicatedTempShipment = yield integrationsService.checkDuplicateTempShipment(parsedOrder.codigoEnvioExterno, idUsuario);
106
106
  if (duplicatedTempShipment)
107
- return;
107
+ throw new Error('Envio Duplicado');
108
108
  return this.insertOrder({
109
109
  order: parsedOrder,
110
110
  agencyId,
package/index.ts CHANGED
@@ -64,25 +64,27 @@ export class IntegrationManager {
64
64
  ? await addressesService.getWarehouseAddress(idUsuario)
65
65
  : await addressesService.getAddress(addressId, idUsuario);
66
66
 
67
- const allShopifyOrders = await fetchAllOrders();
67
+ const allOrders = await fetchAllOrders();
68
68
 
69
69
  const filteredOrders =
70
70
  await integrationsService.filterExternalDuplicatedOrders({
71
71
  idUsuario,
72
- orders: allShopifyOrders,
72
+ orders: allOrders,
73
73
  type: this.type
74
74
  });
75
75
 
76
76
  const insertOrdersResult = await new this.executionManager({
77
- arrayParams: allShopifyOrders,
77
+ arrayParams: allOrders,
78
78
  executable: async (order: OriginalOrder) => {
79
- const parsedOrder = modificarOrdenOriginal({ originalOrder: order });
79
+ const parsedOrder = await modificarOrdenOriginal({
80
+ originalOrder: order
81
+ });
80
82
  const duplicatedTempShipment =
81
83
  await integrationsService.checkDuplicateTempShipment(
82
84
  parsedOrder.codigoEnvioExterno,
83
85
  idUsuario
84
86
  );
85
- if (duplicatedTempShipment) return;
87
+ if (duplicatedTempShipment) throw new Error('Envio Duplicado');
86
88
 
87
89
  return this.insertOrder({
88
90
  order: parsedOrder,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cardus",
3
- "version": "0.0.9",
3
+ "version": "0.0.11",
4
4
  "description": "an integration manager",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
package/types/index.ts CHANGED
@@ -102,7 +102,7 @@ export type CrearBulto = (params: {
102
102
  }) => Promise<Bulto>;
103
103
  type ModificarOrdenOriginal = (param: {
104
104
  originalOrder: OriginalOrder;
105
- }) => ModifiedOrder;
105
+ }) => Promise<ModifiedOrder>;
106
106
 
107
107
  type GroupNotGrouped = {
108
108
  grouped?: 0 | '0';