cardus 0.0.47 → 0.0.49

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
@@ -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.shipmentType,
146
+ integrationId: this.integrationType,
145
147
  tempShipmentData: parsedOrder
146
148
  }),
147
149
  warehouseId,
@@ -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);
@@ -101,7 +101,7 @@ const cookTempShipment = (_a) => __awaiter(void 0, [_a], void 0, function* ({ or
101
101
  });
102
102
  const setBultos = (order) => ({
103
103
  num_bultos: warehouseId ? 0 : order.lineas.length,
104
- tipo_envio: shipmentType,
104
+ tipo_envio: integrationType,
105
105
  codigo_envio_externo: order.codigoEnvioExterno,
106
106
  id_almacen: warehouseId,
107
107
  agencia_envio_integracion: order.agenciaEnvioIntegracion
@@ -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.shipmentType,
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,
@@ -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;
@@ -148,7 +151,7 @@ export const cookTempShipment = async ({
148
151
 
149
152
  const setBultos = (order: ModifiedOrder) => ({
150
153
  num_bultos: warehouseId ? 0 : order.lineas.length,
151
- tipo_envio: shipmentType,
154
+ tipo_envio: integrationType,
152
155
  codigo_envio_externo: order.codigoEnvioExterno,
153
156
  id_almacen: warehouseId,
154
157
  agencia_envio_integracion: order.agenciaEnvioIntegracion
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cardus",
3
- "version": "0.0.47",
3
+ "version": "0.0.49",
4
4
  "description": "an integration manager",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
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: {