cardus 0.0.24 → 0.0.26
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 +11 -3
- package/index.ts +15 -4
- package/package.json +2 -2
- package/types/index.ts +15 -8
package/dist/index.js
CHANGED
|
@@ -58,10 +58,12 @@ class IntegrationManager {
|
|
|
58
58
|
fecha_hora_creacion: (0, moment_1.default)().format('YYYY-MM-DD HH:mm:ss'),
|
|
59
59
|
servicio: this.type,
|
|
60
60
|
id_interno_shopify: order.idInternoShopify,
|
|
61
|
-
fecha_creacion_externa: (0, moment_1.default)(order === null || order === void 0 ? void 0 : order.fechaCreacionExterna).isValid()
|
|
61
|
+
fecha_creacion_externa: (0, moment_1.default)(order === null || order === void 0 ? void 0 : order.fechaCreacionExterna).isValid()
|
|
62
|
+
? (0, moment_1.default)(order.fechaCreacionExterna).format('YYYY-MM-DD HH:mm:ss')
|
|
63
|
+
: null,
|
|
62
64
|
marketplaceId: order.marketplaceId,
|
|
63
65
|
id_documento_holded: order.idDocumentoHolded,
|
|
64
|
-
tipo_documento_holded: order.tipoDocumentoHolded || ''
|
|
66
|
+
tipo_documento_holded: order.tipoDocumentoHolded || ''
|
|
65
67
|
});
|
|
66
68
|
return idEnvioExterno;
|
|
67
69
|
});
|
|
@@ -89,6 +91,7 @@ class IntegrationManager {
|
|
|
89
91
|
this.type = params.type;
|
|
90
92
|
this.executionManager = params.executionManager;
|
|
91
93
|
this.findNextPickupDate = params.findNextPickupDate;
|
|
94
|
+
this.getAgencyIdForTempShipment = params.getAgencyIdForTempShipment;
|
|
92
95
|
}
|
|
93
96
|
insertTempShipments(_a) {
|
|
94
97
|
return __awaiter(this, arguments, void 0, function* ({ payload: { idUsuario, agencyId, addressId, warehouseId, group }, fetchAllOrders, crearBulto, modificarOrdenOriginal }) {
|
|
@@ -115,7 +118,12 @@ class IntegrationManager {
|
|
|
115
118
|
throw new Error('Envio Duplicado');
|
|
116
119
|
return this.insertOrder({
|
|
117
120
|
order: parsedOrder,
|
|
118
|
-
agencyId
|
|
121
|
+
agencyId: yield this.getAgencyIdForTempShipment({
|
|
122
|
+
defaultAgencyId: agencyId,
|
|
123
|
+
userId: idUsuario,
|
|
124
|
+
integrationId: this.shipmentType,
|
|
125
|
+
tempShipmentData: parsedOrder
|
|
126
|
+
}),
|
|
119
127
|
warehouseId,
|
|
120
128
|
sellerAddress,
|
|
121
129
|
idUsuario,
|
package/index.ts
CHANGED
|
@@ -19,7 +19,8 @@ import {
|
|
|
19
19
|
OriginalOrder,
|
|
20
20
|
ModifiedOrder,
|
|
21
21
|
ShipmentType,
|
|
22
|
-
UserDefaultConfigurationContent
|
|
22
|
+
UserDefaultConfigurationContent,
|
|
23
|
+
GetAgencyIdForTempShipment
|
|
23
24
|
} from './types';
|
|
24
25
|
|
|
25
26
|
interface Services {
|
|
@@ -36,6 +37,7 @@ export class IntegrationManager {
|
|
|
36
37
|
executionManager: ExecutionManager;
|
|
37
38
|
findNextPickupDate: FindNextPickupDate;
|
|
38
39
|
shipmentType: ShipmentType;
|
|
40
|
+
getAgencyIdForTempShipment: GetAgencyIdForTempShipment;
|
|
39
41
|
|
|
40
42
|
constructor(params: {
|
|
41
43
|
integrationsService: IntegrationsService;
|
|
@@ -47,6 +49,7 @@ export class IntegrationManager {
|
|
|
47
49
|
shipmentType: ShipmentType;
|
|
48
50
|
executionManager: ExecutionManager;
|
|
49
51
|
findNextPickupDate: FindNextPickupDate;
|
|
52
|
+
getAgencyIdForTempShipment: GetAgencyIdForTempShipment;
|
|
50
53
|
}) {
|
|
51
54
|
this.services = {
|
|
52
55
|
integrationsService: params.integrationsService,
|
|
@@ -60,6 +63,7 @@ export class IntegrationManager {
|
|
|
60
63
|
this.type = params.type;
|
|
61
64
|
this.executionManager = params.executionManager;
|
|
62
65
|
this.findNextPickupDate = params.findNextPickupDate;
|
|
66
|
+
this.getAgencyIdForTempShipment = params.getAgencyIdForTempShipment;
|
|
63
67
|
}
|
|
64
68
|
|
|
65
69
|
async insertTempShipments({
|
|
@@ -100,7 +104,12 @@ export class IntegrationManager {
|
|
|
100
104
|
|
|
101
105
|
return this.insertOrder({
|
|
102
106
|
order: parsedOrder,
|
|
103
|
-
agencyId
|
|
107
|
+
agencyId: await this.getAgencyIdForTempShipment({
|
|
108
|
+
defaultAgencyId: agencyId,
|
|
109
|
+
userId: idUsuario,
|
|
110
|
+
integrationId: this.shipmentType,
|
|
111
|
+
tempShipmentData: parsedOrder
|
|
112
|
+
}),
|
|
104
113
|
warehouseId,
|
|
105
114
|
sellerAddress,
|
|
106
115
|
idUsuario,
|
|
@@ -267,10 +276,12 @@ export class IntegrationManager {
|
|
|
267
276
|
fecha_hora_creacion: moment().format('YYYY-MM-DD HH:mm:ss'),
|
|
268
277
|
servicio: this.type,
|
|
269
278
|
id_interno_shopify: order.idInternoShopify,
|
|
270
|
-
fecha_creacion_externa: moment(order?.fechaCreacionExterna).isValid()
|
|
279
|
+
fecha_creacion_externa: moment(order?.fechaCreacionExterna).isValid()
|
|
280
|
+
? moment(order.fechaCreacionExterna).format('YYYY-MM-DD HH:mm:ss')
|
|
281
|
+
: null,
|
|
271
282
|
marketplaceId: order.marketplaceId,
|
|
272
283
|
id_documento_holded: order.idDocumentoHolded,
|
|
273
|
-
tipo_documento_holded: order.tipoDocumentoHolded || ''
|
|
284
|
+
tipo_documento_holded: order.tipoDocumentoHolded || ''
|
|
274
285
|
});
|
|
275
286
|
|
|
276
287
|
return idEnvioExterno;
|
package/package.json
CHANGED
package/types/index.ts
CHANGED
|
@@ -91,9 +91,9 @@ export type ModifiedOrder = {
|
|
|
91
91
|
idInternoShopify?: string;
|
|
92
92
|
precio: number | null;
|
|
93
93
|
fechaCreacionExterna?: string | null;
|
|
94
|
-
marketplaceId?: string | null
|
|
95
|
-
idDocumentoHolded?: string
|
|
96
|
-
tipoDocumentoHolded?: string
|
|
94
|
+
marketplaceId?: string | null;
|
|
95
|
+
idDocumentoHolded?: string;
|
|
96
|
+
tipoDocumentoHolded?: string;
|
|
97
97
|
};
|
|
98
98
|
|
|
99
99
|
export interface ModifiedOrderExtended extends ModifiedOrder {
|
|
@@ -160,10 +160,10 @@ export type IntegrationsService = {
|
|
|
160
160
|
fecha_hora_creacion: string;
|
|
161
161
|
servicio: Type;
|
|
162
162
|
id_interno_shopify?: string;
|
|
163
|
-
fecha_creacion_externa: string | null
|
|
164
|
-
marketplaceId?: string | null
|
|
165
|
-
id_documento_holded?: string
|
|
166
|
-
tipo_documento_holded?: string
|
|
163
|
+
fecha_creacion_externa: string | null;
|
|
164
|
+
marketplaceId?: string | null;
|
|
165
|
+
id_documento_holded?: string;
|
|
166
|
+
tipo_documento_holded?: string;
|
|
167
167
|
}) => number | false;
|
|
168
168
|
|
|
169
169
|
insertTempShipmentLines: (params: {
|
|
@@ -281,7 +281,14 @@ type ExecutionManagerUploadReturn = {
|
|
|
281
281
|
value: any;
|
|
282
282
|
};
|
|
283
283
|
|
|
284
|
+
export type GetAgencyIdForTempShipment = (params: {
|
|
285
|
+
defaultAgencyId: number;
|
|
286
|
+
userId: number;
|
|
287
|
+
integrationId: number;
|
|
288
|
+
tempShipmentData: ModifiedOrder;
|
|
289
|
+
}) => Promise<number>;
|
|
290
|
+
|
|
284
291
|
export type ExecutionManager = {
|
|
285
292
|
upload(): ExecutionManagerUploadReturn[];
|
|
286
|
-
new(params: ExecutionManagerConstructorParams): ExecutionManager;
|
|
293
|
+
new (params: ExecutionManagerConstructorParams): ExecutionManager;
|
|
287
294
|
};
|