cardus 0.0.4 → 0.0.5

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
@@ -85,53 +85,48 @@ class IntegrationManager {
85
85
  }
86
86
  insertTempShipments(_a) {
87
87
  return __awaiter(this, arguments, void 0, function* ({ payload: { idUsuario, agencyId, addressId, warehouseId, group }, fetchAllOrders, crearBulto, modificarOrdenOriginal, }) {
88
- try {
89
- const estaAgrupado = Number(group === null || group === void 0 ? void 0 : group.grouped) === 1;
90
- const { integrationsService, addressesService } = this.services;
91
- // esto hay que pasarlo ya en los parametros
92
- const sellerAddress = warehouseId > 0
93
- ? yield addressesService.getWarehouseAddress(idUsuario)
94
- : yield addressesService.getAddress(addressId, idUsuario);
95
- const allShopifyOrders = yield fetchAllOrders();
96
- const filteredOrders = yield integrationsService.filterExternalDuplicatedOrders({
97
- idUsuario,
98
- orders: allShopifyOrders,
99
- type: this.type,
100
- });
101
- const insertOrdersResult = yield new this.executionManager({
102
- arrayParams: allShopifyOrders,
103
- executable: (order) => __awaiter(this, void 0, void 0, function* () {
104
- const parsedOrder = modificarOrdenOriginal({ originalOrder: order });
105
- const duplicatedTempShipment = yield integrationsService.checkDuplicateTempShipment(parsedOrder.codigoEnvioExterno, idUsuario);
106
- if (duplicatedTempShipment)
107
- return;
108
- return this.insertOrder({
109
- order: parsedOrder,
110
- agencyId,
111
- warehouseId,
112
- sellerAddress,
113
- idUsuario,
114
- group,
115
- });
116
- }),
117
- regularExecutionTime: 100, // ms
118
- initialBatchQuantity: 1, // de uno en uno
119
- }).upload();
120
- const successfullShipments = insertOrdersResult
121
- .filter(Boolean)
122
- .filter((each) => each.status === "fulfilled")
123
- .map((each) => each.value);
124
- yield this.insertQuantityRelatedLines({
125
- orders: successfullShipments,
126
- idUsuario,
127
- crearBulto,
128
- estaAgrupado,
129
- });
130
- return filteredOrders;
131
- }
132
- catch (e) {
133
- console.log(e);
134
- }
88
+ const estaAgrupado = Number(group === null || group === void 0 ? void 0 : group.grouped) === 1;
89
+ const { integrationsService, addressesService } = this.services;
90
+ // esto hay que pasarlo ya en los parametros
91
+ const sellerAddress = warehouseId > 0
92
+ ? yield addressesService.getWarehouseAddress(idUsuario)
93
+ : yield addressesService.getAddress(addressId, idUsuario);
94
+ const allShopifyOrders = yield fetchAllOrders();
95
+ const filteredOrders = yield integrationsService.filterExternalDuplicatedOrders({
96
+ idUsuario,
97
+ orders: allShopifyOrders,
98
+ type: this.type,
99
+ });
100
+ const insertOrdersResult = yield new this.executionManager({
101
+ arrayParams: allShopifyOrders,
102
+ executable: (order) => __awaiter(this, void 0, void 0, function* () {
103
+ const parsedOrder = modificarOrdenOriginal({ originalOrder: order });
104
+ const duplicatedTempShipment = yield integrationsService.checkDuplicateTempShipment(parsedOrder.codigoEnvioExterno, idUsuario);
105
+ if (duplicatedTempShipment)
106
+ return;
107
+ return this.insertOrder({
108
+ order: parsedOrder,
109
+ agencyId,
110
+ warehouseId,
111
+ sellerAddress,
112
+ idUsuario,
113
+ group,
114
+ });
115
+ }),
116
+ regularExecutionTime: 100, // ms
117
+ initialBatchQuantity: 1, // de uno en uno
118
+ }).upload();
119
+ const successfullShipments = insertOrdersResult
120
+ .filter(Boolean)
121
+ .filter((each) => each.status === "fulfilled")
122
+ .map((each) => each.value);
123
+ yield this.insertQuantityRelatedLines({
124
+ orders: successfullShipments,
125
+ idUsuario,
126
+ crearBulto,
127
+ estaAgrupado,
128
+ });
129
+ return filteredOrders;
135
130
  });
136
131
  }
137
132
  insertQuantityRelatedLines(_a) {
@@ -58,7 +58,7 @@ const cookTempShipment = (_a) => __awaiter(void 0, [_a], void 0, function* ({ or
58
58
  contacto_llegada: order.primerApellidoLLegada
59
59
  ? order.nombreLLegada + " " + order.primerApellidoLLegada
60
60
  : order.nombreLLegada,
61
- direccion: order.direccionLLegada2
61
+ direccion_llegada: order.direccionLLegada2
62
62
  ? order.direccionLLegada1 + " " + order.direccionLLegada2
63
63
  : order.direccionLLegada1,
64
64
  cod_pos_llegada: order.codigoPostalLLegada,
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "cardus",
3
- "version": "0.0.4",
3
+ "version": "0.0.5",
4
4
  "description": "an integration manager",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
7
7
  "scripts": {
8
8
  "build": "rm -rf dist && tsc --build",
9
- "prepublish": "npm run build",
9
+ "prepublishOnly": "npm run build",
10
10
  "test": "npm run test"
11
11
  },
12
12
  "author": "sergio ibanez",