cardus 0.0.41 → 0.0.42
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 +15 -15
- package/index.ts +20 -18
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -15,12 +15,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
15
15
|
exports.IntegrationManager = void 0;
|
|
16
16
|
const moment_1 = __importDefault(require("moment"));
|
|
17
17
|
const insertTempShipment_1 = require("./insertTempShipment");
|
|
18
|
-
const dataToInsert = {
|
|
19
|
-
lines: [],
|
|
20
|
-
contents: [],
|
|
21
|
-
details: [],
|
|
22
|
-
externals: []
|
|
23
|
-
};
|
|
24
18
|
class IntegrationManager {
|
|
25
19
|
constructor(params) {
|
|
26
20
|
this.insertOrder = (_a) => __awaiter(this, [_a], void 0, function* ({ order, agencyId, warehouseId, sellerAddress, idUsuario, group, isPriority }) {
|
|
@@ -59,7 +53,7 @@ class IntegrationManager {
|
|
|
59
53
|
return yield this.services.integrationsService.insertTempShipment(tempShipmentData, false);
|
|
60
54
|
});
|
|
61
55
|
this.insertExternalShipment = ({ idUsuario, order, idEnvioTemporal }) => {
|
|
62
|
-
dataToInsert.externals.push({
|
|
56
|
+
this.dataToInsert.externals.push({
|
|
63
57
|
id_envio_temporal_usuario: idEnvioTemporal,
|
|
64
58
|
codigo_envio_externo: order.codigoEnvioExterno,
|
|
65
59
|
id_usuario: idUsuario,
|
|
@@ -77,7 +71,7 @@ class IntegrationManager {
|
|
|
77
71
|
this.insertTempShipmentLines = (_c) => __awaiter(this, [_c], void 0, function* ({ idEnvioTemporal, group }) {
|
|
78
72
|
const grouped = group.grouped === 1 || group.grouped === '1';
|
|
79
73
|
if (grouped) {
|
|
80
|
-
dataToInsert.lines.push({
|
|
74
|
+
this.dataToInsert.lines.push({
|
|
81
75
|
id_envio: idEnvioTemporal,
|
|
82
76
|
bulto: {
|
|
83
77
|
peso: group.weight,
|
|
@@ -96,6 +90,12 @@ class IntegrationManager {
|
|
|
96
90
|
usersService: params.usersService,
|
|
97
91
|
customizationService: params.customizationService
|
|
98
92
|
};
|
|
93
|
+
this.dataToInsert = {
|
|
94
|
+
lines: [],
|
|
95
|
+
contents: [],
|
|
96
|
+
details: [],
|
|
97
|
+
externals: []
|
|
98
|
+
};
|
|
99
99
|
this.shipmentType = params.shipmentType;
|
|
100
100
|
this.type = params.type;
|
|
101
101
|
this.executionManager = params.executionManager;
|
|
@@ -168,10 +168,10 @@ class IntegrationManager {
|
|
|
168
168
|
user,
|
|
169
169
|
tempShimpmentIds: successfullShipments.map((successfullShipment) => successfullShipment.idEnvioTemporal)
|
|
170
170
|
});
|
|
171
|
-
yield integrationsService.insertTempShipmentMultipleLines(dataToInsert.lines);
|
|
172
|
-
yield integrationsService.insertTempShipmentMultipleDetails(dataToInsert.details);
|
|
173
|
-
yield integrationsService.insertTempShipmentMultipleContents(dataToInsert.contents);
|
|
174
|
-
yield integrationsService.insertTempShipmentMultipleExternals(dataToInsert.externals);
|
|
171
|
+
yield integrationsService.insertTempShipmentMultipleLines(this.dataToInsert.lines);
|
|
172
|
+
yield integrationsService.insertTempShipmentMultipleDetails(this.dataToInsert.details);
|
|
173
|
+
yield integrationsService.insertTempShipmentMultipleContents(this.dataToInsert.contents);
|
|
174
|
+
yield integrationsService.insertTempShipmentMultipleExternals(this.dataToInsert.externals);
|
|
175
175
|
return { filteredOrders, insertedTempShipments: successfullShipments };
|
|
176
176
|
});
|
|
177
177
|
}
|
|
@@ -181,7 +181,7 @@ class IntegrationManager {
|
|
|
181
181
|
const { configurationService } = this.services;
|
|
182
182
|
const insert = (data, tempShimpmentId) => {
|
|
183
183
|
data.forEach((tempContent) => {
|
|
184
|
-
dataToInsert.contents.push(Object.assign(Object.assign({}, tempContent), { id_envio: tempShimpmentId }));
|
|
184
|
+
this.dataToInsert.contents.push(Object.assign(Object.assign({}, tempContent), { id_envio: tempShimpmentId }));
|
|
185
185
|
});
|
|
186
186
|
};
|
|
187
187
|
let userConfiguration = null;
|
|
@@ -231,12 +231,12 @@ class IntegrationManager {
|
|
|
231
231
|
const arrayFake = Array.from({ length: Number(cantidad) });
|
|
232
232
|
arrayFake.forEach(() => {
|
|
233
233
|
if (!estaAgrupado) {
|
|
234
|
-
dataToInsert.lines.push({
|
|
234
|
+
this.dataToInsert.lines.push({
|
|
235
235
|
id_envio: idEnvioTemporal,
|
|
236
236
|
bulto
|
|
237
237
|
});
|
|
238
238
|
}
|
|
239
|
-
dataToInsert.details.push({
|
|
239
|
+
this.dataToInsert.details.push({
|
|
240
240
|
id_envio: idEnvioTemporal,
|
|
241
241
|
bulto
|
|
242
242
|
});
|
package/index.ts
CHANGED
|
@@ -23,18 +23,11 @@ import {
|
|
|
23
23
|
GetAgencyIdForTempShipment,
|
|
24
24
|
IsPriority,
|
|
25
25
|
CustomizationService,
|
|
26
|
-
DataToInsert,
|
|
27
26
|
InsertContentShipmentLine,
|
|
28
|
-
Bulto
|
|
27
|
+
Bulto,
|
|
28
|
+
DataToInsert
|
|
29
29
|
} from './types';
|
|
30
30
|
|
|
31
|
-
const dataToInsert: DataToInsert = {
|
|
32
|
-
lines: [],
|
|
33
|
-
contents: [],
|
|
34
|
-
details: [],
|
|
35
|
-
externals: []
|
|
36
|
-
};
|
|
37
|
-
|
|
38
31
|
interface Services {
|
|
39
32
|
integrationsService: IntegrationsService;
|
|
40
33
|
addressesService: AddressesService;
|
|
@@ -52,6 +45,8 @@ export class IntegrationManager {
|
|
|
52
45
|
shipmentType: ShipmentType;
|
|
53
46
|
getAgencyIdForTempShipment: GetAgencyIdForTempShipment;
|
|
54
47
|
|
|
48
|
+
dataToInsert: DataToInsert;
|
|
49
|
+
|
|
55
50
|
constructor(params: {
|
|
56
51
|
integrationsService: IntegrationsService;
|
|
57
52
|
addressesService: AddressesService;
|
|
@@ -74,6 +69,13 @@ export class IntegrationManager {
|
|
|
74
69
|
customizationService: params.customizationService
|
|
75
70
|
};
|
|
76
71
|
|
|
72
|
+
this.dataToInsert = {
|
|
73
|
+
lines: [],
|
|
74
|
+
contents: [],
|
|
75
|
+
details: [],
|
|
76
|
+
externals: []
|
|
77
|
+
};
|
|
78
|
+
|
|
77
79
|
this.shipmentType = params.shipmentType;
|
|
78
80
|
this.type = params.type;
|
|
79
81
|
this.executionManager = params.executionManager;
|
|
@@ -172,16 +174,16 @@ export class IntegrationManager {
|
|
|
172
174
|
)
|
|
173
175
|
});
|
|
174
176
|
await integrationsService.insertTempShipmentMultipleLines(
|
|
175
|
-
dataToInsert.lines
|
|
177
|
+
this.dataToInsert.lines
|
|
176
178
|
);
|
|
177
179
|
await integrationsService.insertTempShipmentMultipleDetails(
|
|
178
|
-
dataToInsert.details
|
|
180
|
+
this.dataToInsert.details
|
|
179
181
|
);
|
|
180
182
|
await integrationsService.insertTempShipmentMultipleContents(
|
|
181
|
-
dataToInsert.contents
|
|
183
|
+
this.dataToInsert.contents
|
|
182
184
|
);
|
|
183
185
|
await integrationsService.insertTempShipmentMultipleExternals(
|
|
184
|
-
dataToInsert.externals
|
|
186
|
+
this.dataToInsert.externals
|
|
185
187
|
);
|
|
186
188
|
|
|
187
189
|
return { filteredOrders, insertedTempShipments: successfullShipments };
|
|
@@ -202,7 +204,7 @@ export class IntegrationManager {
|
|
|
202
204
|
tempShimpmentId: number
|
|
203
205
|
) => {
|
|
204
206
|
data.forEach((tempContent) => {
|
|
205
|
-
dataToInsert.contents.push({
|
|
207
|
+
this.dataToInsert.contents.push({
|
|
206
208
|
...tempContent,
|
|
207
209
|
id_envio: tempShimpmentId
|
|
208
210
|
});
|
|
@@ -312,7 +314,7 @@ export class IntegrationManager {
|
|
|
312
314
|
order: ModifiedOrder;
|
|
313
315
|
idEnvioTemporal: number;
|
|
314
316
|
}): undefined => {
|
|
315
|
-
dataToInsert.externals.push({
|
|
317
|
+
this.dataToInsert.externals.push({
|
|
316
318
|
id_envio_temporal_usuario: idEnvioTemporal,
|
|
317
319
|
codigo_envio_externo: order.codigoEnvioExterno,
|
|
318
320
|
id_usuario: idUsuario,
|
|
@@ -338,7 +340,7 @@ export class IntegrationManager {
|
|
|
338
340
|
const grouped = group.grouped === 1 || group.grouped === '1';
|
|
339
341
|
|
|
340
342
|
if (grouped) {
|
|
341
|
-
dataToInsert.lines.push({
|
|
343
|
+
this.dataToInsert.lines.push({
|
|
342
344
|
id_envio: idEnvioTemporal,
|
|
343
345
|
bulto: {
|
|
344
346
|
peso: group.weight,
|
|
@@ -403,12 +405,12 @@ export class IntegrationManager {
|
|
|
403
405
|
|
|
404
406
|
arrayFake.forEach(() => {
|
|
405
407
|
if (!estaAgrupado) {
|
|
406
|
-
dataToInsert.lines.push({
|
|
408
|
+
this.dataToInsert.lines.push({
|
|
407
409
|
id_envio: idEnvioTemporal,
|
|
408
410
|
bulto
|
|
409
411
|
});
|
|
410
412
|
}
|
|
411
|
-
dataToInsert.details.push({
|
|
413
|
+
this.dataToInsert.details.push({
|
|
412
414
|
id_envio: idEnvioTemporal,
|
|
413
415
|
bulto
|
|
414
416
|
});
|