cardus 0.0.3 → 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 +42 -47
- package/dist/insertTempShipment/index.js +1 -1
- package/insertTempShipment/index.ts +1 -1
- package/package.json +2 -1
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
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
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
|
-
|
|
61
|
+
direccion_llegada: order.direccionLLegada2
|
|
62
62
|
? order.direccionLLegada1 + " " + order.direccionLLegada2
|
|
63
63
|
: order.direccionLLegada1,
|
|
64
64
|
cod_pos_llegada: order.codigoPostalLLegada,
|
|
@@ -85,7 +85,7 @@ export const cookTempShipment = async ({
|
|
|
85
85
|
contacto_llegada: order.primerApellidoLLegada
|
|
86
86
|
? order.nombreLLegada + " " + order.primerApellidoLLegada
|
|
87
87
|
: order.nombreLLegada,
|
|
88
|
-
|
|
88
|
+
direccion_llegada: order.direccionLLegada2
|
|
89
89
|
? order.direccionLLegada1 + " " + order.direccionLLegada2
|
|
90
90
|
: order.direccionLLegada1,
|
|
91
91
|
cod_pos_llegada: order.codigoPostalLLegada,
|
package/package.json
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cardus",
|
|
3
|
-
"version": "0.0.
|
|
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
|
+
"prepublishOnly": "npm run build",
|
|
9
10
|
"test": "npm run test"
|
|
10
11
|
},
|
|
11
12
|
"author": "sergio ibanez",
|