cardus 0.0.46 → 0.0.48
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 +8 -5
- package/dist/insertTempShipment/index.js +1 -1
- package/dist/types/index.js +15 -0
- package/index.ts +12 -5
- package/insertTempShipment/index.ts +3 -0
- package/package.json +1 -1
- package/types/index.ts +19 -0
package/dist/index.js
CHANGED
|
@@ -41,6 +41,7 @@ class IntegrationManager {
|
|
|
41
41
|
this.insertTempShipment = (_b) => __awaiter(this, [_b], void 0, function* ({ order, agencyId, warehouseId, sellerAddress, idUsuario, isPriority }) {
|
|
42
42
|
const tempShipmentData = yield (0, insertTempShipment_1.cookTempShipment)({
|
|
43
43
|
order,
|
|
44
|
+
integrationType: this.integrationType,
|
|
44
45
|
shipmentType: this.shipmentType,
|
|
45
46
|
agencyId,
|
|
46
47
|
warehouseId,
|
|
@@ -96,6 +97,7 @@ class IntegrationManager {
|
|
|
96
97
|
details: [],
|
|
97
98
|
externals: []
|
|
98
99
|
};
|
|
100
|
+
this.integrationType = params.integrationType;
|
|
99
101
|
this.shipmentType = params.shipmentType;
|
|
100
102
|
this.type = params.type;
|
|
101
103
|
this.executionManager = params.executionManager;
|
|
@@ -141,7 +143,7 @@ class IntegrationManager {
|
|
|
141
143
|
agencyId: yield this.getAgencyIdForTempShipment({
|
|
142
144
|
defaultAgencyId: agencyId,
|
|
143
145
|
userId: idUsuario,
|
|
144
|
-
integrationId: this.
|
|
146
|
+
integrationId: this.integrationType,
|
|
145
147
|
tempShipmentData: parsedOrder
|
|
146
148
|
}),
|
|
147
149
|
warehouseId,
|
|
@@ -231,6 +233,11 @@ class IntegrationManager {
|
|
|
231
233
|
const { bulto, cantidad, idEnvioTemporal } = each;
|
|
232
234
|
try {
|
|
233
235
|
const arrayFake = Array.from({ length: Number(cantidad) });
|
|
236
|
+
this.dataToInsert.details.push({
|
|
237
|
+
id_envio: idEnvioTemporal,
|
|
238
|
+
bulto,
|
|
239
|
+
cantidad
|
|
240
|
+
});
|
|
234
241
|
arrayFake.forEach(() => {
|
|
235
242
|
if (!estaAgrupado) {
|
|
236
243
|
this.dataToInsert.lines.push({
|
|
@@ -238,10 +245,6 @@ class IntegrationManager {
|
|
|
238
245
|
bulto
|
|
239
246
|
});
|
|
240
247
|
}
|
|
241
|
-
this.dataToInsert.details.push({
|
|
242
|
-
id_envio: idEnvioTemporal,
|
|
243
|
-
bulto
|
|
244
|
-
});
|
|
245
248
|
});
|
|
246
249
|
}
|
|
247
250
|
catch (e) {
|
|
@@ -14,7 +14,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
15
|
exports.cookTempShipment = void 0;
|
|
16
16
|
const moment_1 = __importDefault(require("moment"));
|
|
17
|
-
const cookTempShipment = (_a) => __awaiter(void 0, [_a], void 0, function* ({ order, shipmentType, agencyId, warehouseId, sellerAddress, idUsuario, findNextPickupDate, countriesService, isPriority }) {
|
|
17
|
+
const cookTempShipment = (_a) => __awaiter(void 0, [_a], void 0, function* ({ order, integrationType, shipmentType, agencyId, warehouseId, sellerAddress, idUsuario, findNextPickupDate, countriesService, isPriority }) {
|
|
18
18
|
let zonaLLegada = {};
|
|
19
19
|
if (order.codigoPaisLLegada)
|
|
20
20
|
zonaLLegada = yield countriesService.getCountryFromCountryCode(order.codigoPaisLLegada);
|
package/dist/types/index.js
CHANGED
|
@@ -24,3 +24,18 @@ const shipmentTypes = {
|
|
|
24
24
|
ETSY: 121,
|
|
25
25
|
NORMAL_V2: 122
|
|
26
26
|
};
|
|
27
|
+
const integrationTypes = {
|
|
28
|
+
EXCEL: 1,
|
|
29
|
+
WORDPRESS: 2,
|
|
30
|
+
PRESTASHOP: 3,
|
|
31
|
+
EBAY: 4,
|
|
32
|
+
ALIEXPRESS: 5,
|
|
33
|
+
AMAZON: 6,
|
|
34
|
+
SHOPIFY: 7,
|
|
35
|
+
ECWID: 8,
|
|
36
|
+
HOLDED: 11,
|
|
37
|
+
JOOM: 12,
|
|
38
|
+
ETSY: 13,
|
|
39
|
+
ODOO: 14,
|
|
40
|
+
APIV2: 15
|
|
41
|
+
};
|
package/index.ts
CHANGED
|
@@ -19,6 +19,7 @@ import {
|
|
|
19
19
|
OriginalOrder,
|
|
20
20
|
ModifiedOrder,
|
|
21
21
|
ShipmentType,
|
|
22
|
+
IntegrationType,
|
|
22
23
|
UserDefaultConfigurationContent,
|
|
23
24
|
GetAgencyIdForTempShipment,
|
|
24
25
|
IsPriority,
|
|
@@ -42,6 +43,7 @@ export class IntegrationManager {
|
|
|
42
43
|
type: Type;
|
|
43
44
|
executionManager: ExecutionManager;
|
|
44
45
|
findNextPickupDate: FindNextPickupDate;
|
|
46
|
+
integrationType: IntegrationType;
|
|
45
47
|
shipmentType: ShipmentType;
|
|
46
48
|
getAgencyIdForTempShipment: GetAgencyIdForTempShipment;
|
|
47
49
|
|
|
@@ -55,6 +57,7 @@ export class IntegrationManager {
|
|
|
55
57
|
usersService: UsersService;
|
|
56
58
|
customizationService: CustomizationService;
|
|
57
59
|
type: Type;
|
|
60
|
+
integrationType: IntegrationType;
|
|
58
61
|
shipmentType: ShipmentType;
|
|
59
62
|
executionManager: ExecutionManager;
|
|
60
63
|
findNextPickupDate: FindNextPickupDate;
|
|
@@ -76,6 +79,7 @@ export class IntegrationManager {
|
|
|
76
79
|
externals: []
|
|
77
80
|
};
|
|
78
81
|
|
|
82
|
+
this.integrationType = params.integrationType;
|
|
79
83
|
this.shipmentType = params.shipmentType;
|
|
80
84
|
this.type = params.type;
|
|
81
85
|
this.executionManager = params.executionManager;
|
|
@@ -141,7 +145,7 @@ export class IntegrationManager {
|
|
|
141
145
|
agencyId: await this.getAgencyIdForTempShipment({
|
|
142
146
|
defaultAgencyId: agencyId,
|
|
143
147
|
userId: idUsuario,
|
|
144
|
-
integrationId: this.
|
|
148
|
+
integrationId: this.integrationType,
|
|
145
149
|
tempShipmentData: parsedOrder
|
|
146
150
|
}),
|
|
147
151
|
warehouseId,
|
|
@@ -289,6 +293,7 @@ export class IntegrationManager {
|
|
|
289
293
|
}) => {
|
|
290
294
|
const tempShipmentData = await cookTempShipment({
|
|
291
295
|
order,
|
|
296
|
+
integrationType: this.integrationType,
|
|
292
297
|
shipmentType: this.shipmentType,
|
|
293
298
|
agencyId,
|
|
294
299
|
warehouseId,
|
|
@@ -407,6 +412,12 @@ export class IntegrationManager {
|
|
|
407
412
|
try {
|
|
408
413
|
const arrayFake = Array.from({ length: Number(cantidad) });
|
|
409
414
|
|
|
415
|
+
this.dataToInsert.details.push({
|
|
416
|
+
id_envio: idEnvioTemporal,
|
|
417
|
+
bulto,
|
|
418
|
+
cantidad
|
|
419
|
+
});
|
|
420
|
+
|
|
410
421
|
arrayFake.forEach(() => {
|
|
411
422
|
if (!estaAgrupado) {
|
|
412
423
|
this.dataToInsert.lines.push({
|
|
@@ -414,10 +425,6 @@ export class IntegrationManager {
|
|
|
414
425
|
bulto
|
|
415
426
|
});
|
|
416
427
|
}
|
|
417
|
-
this.dataToInsert.details.push({
|
|
418
|
-
id_envio: idEnvioTemporal,
|
|
419
|
-
bulto
|
|
420
|
-
});
|
|
421
428
|
});
|
|
422
429
|
} catch (e) {
|
|
423
430
|
console.log(e);
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import moment from 'moment';
|
|
2
2
|
import {
|
|
3
|
+
IntegrationType,
|
|
3
4
|
ShipmentType,
|
|
4
5
|
Shipment,
|
|
5
6
|
ModifiedOrder,
|
|
@@ -13,6 +14,7 @@ type ZonaLLegada = { nombre_pais: string; id_pais: number };
|
|
|
13
14
|
|
|
14
15
|
export const cookTempShipment = async ({
|
|
15
16
|
order,
|
|
17
|
+
integrationType,
|
|
16
18
|
shipmentType,
|
|
17
19
|
agencyId,
|
|
18
20
|
warehouseId,
|
|
@@ -23,6 +25,7 @@ export const cookTempShipment = async ({
|
|
|
23
25
|
isPriority
|
|
24
26
|
}: {
|
|
25
27
|
order: ModifiedOrder;
|
|
28
|
+
integrationType: IntegrationType;
|
|
26
29
|
shipmentType: ShipmentType;
|
|
27
30
|
agencyId: number;
|
|
28
31
|
warehouseId: number;
|
package/package.json
CHANGED
package/types/index.ts
CHANGED
|
@@ -61,7 +61,25 @@ const shipmentTypes = {
|
|
|
61
61
|
NORMAL_V2: 122
|
|
62
62
|
};
|
|
63
63
|
|
|
64
|
+
const integrationTypes = {
|
|
65
|
+
EXCEL: 1,
|
|
66
|
+
WORDPRESS: 2,
|
|
67
|
+
PRESTASHOP: 3,
|
|
68
|
+
EBAY: 4,
|
|
69
|
+
ALIEXPRESS: 5,
|
|
70
|
+
AMAZON: 6,
|
|
71
|
+
SHOPIFY: 7,
|
|
72
|
+
ECWID: 8,
|
|
73
|
+
HOLDED: 11,
|
|
74
|
+
JOOM: 12,
|
|
75
|
+
ETSY: 13,
|
|
76
|
+
ODOO: 14,
|
|
77
|
+
APIV2: 15
|
|
78
|
+
};
|
|
79
|
+
|
|
64
80
|
export type ShipmentType = (typeof shipmentTypes)[keyof typeof shipmentTypes];
|
|
81
|
+
export type IntegrationType =
|
|
82
|
+
(typeof integrationTypes)[keyof typeof integrationTypes];
|
|
65
83
|
export type Bulto = {
|
|
66
84
|
id_envio: number;
|
|
67
85
|
bulto: {
|
|
@@ -342,6 +360,7 @@ type InsertContentShipmentData = UserDefaultConfigurationContent & {
|
|
|
342
360
|
type InsertContentShipmentDetail = {
|
|
343
361
|
id_envio: number;
|
|
344
362
|
bulto: Bulto['bulto'];
|
|
363
|
+
cantidad: number;
|
|
345
364
|
};
|
|
346
365
|
|
|
347
366
|
type InsertContentShipmentExternal = {
|