@things-factory/operato-mms 4.3.669 → 4.3.671

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.
Files changed (77) hide show
  1. package/package.json +33 -33
  2. package/dist-server/controllers/index.js +0 -1
  3. package/dist-server/controllers/index.js.map +0 -1
  4. package/dist-server/entities/index.js +0 -5
  5. package/dist-server/entities/index.js.map +0 -1
  6. package/dist-server/graphql/index.js +0 -33
  7. package/dist-server/graphql/index.js.map +0 -1
  8. package/dist-server/graphql/resolvers/index.js +0 -32
  9. package/dist-server/graphql/resolvers/index.js.map +0 -1
  10. package/dist-server/graphql/resolvers/interface-with-hub/add-release-order.js +0 -242
  11. package/dist-server/graphql/resolvers/interface-with-hub/add-release-order.js.map +0 -1
  12. package/dist-server/graphql/resolvers/interface-with-hub/auto-add-release-order.js +0 -218
  13. package/dist-server/graphql/resolvers/interface-with-hub/auto-add-release-order.js.map +0 -1
  14. package/dist-server/graphql/resolvers/interface-with-hub/auto-update-all-marketplace-product-variation-quantity.js +0 -159
  15. package/dist-server/graphql/resolvers/interface-with-hub/auto-update-all-marketplace-product-variation-quantity.js.map +0 -1
  16. package/dist-server/graphql/resolvers/interface-with-hub/generate-replenishment-order.js +0 -27
  17. package/dist-server/graphql/resolvers/interface-with-hub/generate-replenishment-order.js.map +0 -1
  18. package/dist-server/graphql/resolvers/interface-with-hub/index.js +0 -12
  19. package/dist-server/graphql/resolvers/interface-with-hub/index.js.map +0 -1
  20. package/dist-server/graphql/resolvers/interface-with-hub/warehouse-marketplace-products.js +0 -157
  21. package/dist-server/graphql/resolvers/interface-with-hub/warehouse-marketplace-products.js.map +0 -1
  22. package/dist-server/graphql/resolvers/shipping-provider/index.js +0 -6
  23. package/dist-server/graphql/resolvers/shipping-provider/index.js.map +0 -1
  24. package/dist-server/graphql/resolvers/shipping-provider/shipping-providers.js +0 -32
  25. package/dist-server/graphql/resolvers/shipping-provider/shipping-providers.js.map +0 -1
  26. package/dist-server/graphql/resolvers/warehouse-product/auto-link-warehouse-marketplace-product-variations.js +0 -63
  27. package/dist-server/graphql/resolvers/warehouse-product/auto-link-warehouse-marketplace-product-variations.js.map +0 -1
  28. package/dist-server/graphql/resolvers/warehouse-product/index.js +0 -6
  29. package/dist-server/graphql/resolvers/warehouse-product/index.js.map +0 -1
  30. package/dist-server/graphql/types/index.js +0 -33
  31. package/dist-server/graphql/types/index.js.map +0 -1
  32. package/dist-server/graphql/types/interface-with-hub/index.js +0 -29
  33. package/dist-server/graphql/types/interface-with-hub/index.js.map +0 -1
  34. package/dist-server/graphql/types/interface-with-hub/new-stock-replenishment.js +0 -34
  35. package/dist-server/graphql/types/interface-with-hub/new-stock-replenishment.js.map +0 -1
  36. package/dist-server/graphql/types/interface-with-hub/replenishment-order-product.js +0 -50
  37. package/dist-server/graphql/types/interface-with-hub/replenishment-order-product.js.map +0 -1
  38. package/dist-server/graphql/types/interface-with-hub/stock-replenishment-list.js +0 -16
  39. package/dist-server/graphql/types/interface-with-hub/stock-replenishment-list.js.map +0 -1
  40. package/dist-server/graphql/types/interface-with-hub/stock-replenishment.js +0 -47
  41. package/dist-server/graphql/types/interface-with-hub/stock-replenishment.js.map +0 -1
  42. package/dist-server/graphql/types/interface-with-hub/warehouse-inventory.js +0 -17
  43. package/dist-server/graphql/types/interface-with-hub/warehouse-inventory.js.map +0 -1
  44. package/dist-server/graphql/types/interface-with-hub/warehouse-marketplace-product-list.js +0 -14
  45. package/dist-server/graphql/types/interface-with-hub/warehouse-marketplace-product-list.js.map +0 -1
  46. package/dist-server/graphql/types/interface-with-hub/warehouse-marketplace-product.js +0 -20
  47. package/dist-server/graphql/types/interface-with-hub/warehouse-marketplace-product.js.map +0 -1
  48. package/dist-server/graphql/types/shipping-provider/index.js +0 -10
  49. package/dist-server/graphql/types/shipping-provider/index.js.map +0 -1
  50. package/dist-server/graphql/types/shipping-provider/shipping-provider-list.js +0 -13
  51. package/dist-server/graphql/types/shipping-provider/shipping-provider-list.js.map +0 -1
  52. package/dist-server/graphql/types/shipping-provider/shipping-provider.js +0 -13
  53. package/dist-server/graphql/types/shipping-provider/shipping-provider.js.map +0 -1
  54. package/dist-server/graphql/types/warehouse-product/index.js +0 -11
  55. package/dist-server/graphql/types/warehouse-product/index.js.map +0 -1
  56. package/dist-server/graphql/types/warehouse-product/warehouse-product.js +0 -12
  57. package/dist-server/graphql/types/warehouse-product/warehouse-product.js.map +0 -1
  58. package/dist-server/index.js +0 -34
  59. package/dist-server/index.js.map +0 -1
  60. package/dist-server/middlewares/index.js +0 -4
  61. package/dist-server/middlewares/index.js.map +0 -1
  62. package/dist-server/migrations/1599732967233-SeedCommonCode.js +0 -52
  63. package/dist-server/migrations/1599732967233-SeedCommonCode.js.map +0 -1
  64. package/dist-server/migrations/1608009991075-SeedUser.js +0 -51
  65. package/dist-server/migrations/1608009991075-SeedUser.js.map +0 -1
  66. package/dist-server/migrations/index.js +0 -12
  67. package/dist-server/migrations/index.js.map +0 -1
  68. package/dist-server/routers/etrax-router.js +0 -155
  69. package/dist-server/routers/etrax-router.js.map +0 -1
  70. package/dist-server/routers/shopify-pos-public-router.js +0 -109
  71. package/dist-server/routers/shopify-pos-public-router.js.map +0 -1
  72. package/dist-server/routes.js +0 -11
  73. package/dist-server/routes.js.map +0 -1
  74. package/dist-server/util/interface-helper.js +0 -53
  75. package/dist-server/util/interface-helper.js.map +0 -1
  76. package/dist-server/util/no-generator.js +0 -14
  77. package/dist-server/util/no-generator.js.map +0 -1
@@ -1,52 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.SeedCommonCode1599732967233 = void 0;
4
- const typeorm_1 = require("typeorm");
5
- const code_base_1 = require("@things-factory/code-base");
6
- const shell_1 = require("@things-factory/shell");
7
- const codes = [
8
- {
9
- name: 'COUNTRY_CODES',
10
- description: 'country code',
11
- details: [
12
- { name: 'my', description: 'Malaysia' },
13
- { name: 'sg', description: 'Singapore' },
14
- { name: 'th', description: 'Thailand' },
15
- { name: 'vn', description: 'Vietnam' },
16
- { name: 'id', description: 'Indonesia' },
17
- { name: 'ph', description: 'Philippines' }
18
- ]
19
- },
20
- {
21
- name: 'ECOMMERCE_PLATFORM',
22
- description: 'ecommerce platform',
23
- details: [
24
- { name: 'lazada', description: 'Lazada' },
25
- { name: 'shopee', description: 'Shopee' },
26
- { name: 'shopify', description: 'Shopify' },
27
- { name: 'zalora', description: 'Zalora' }
28
- ]
29
- }
30
- ];
31
- class SeedCommonCode1599732967233 {
32
- async up(queryRunner) {
33
- const codeRepo = (0, typeorm_1.getRepository)(code_base_1.CommonCode);
34
- const codeDetailRepo = (0, typeorm_1.getRepository)(code_base_1.CommonCodeDetail);
35
- const domain = await (0, typeorm_1.getRepository)(shell_1.Domain).findOne({
36
- subdomain: 'maybank'
37
- });
38
- return await Promise.all(codes.map(async (code) => {
39
- const commonCode = await codeRepo.save(Object.assign(Object.assign({}, code), { domain }));
40
- await codeDetailRepo.save(commonCode.details.map((detail, idx) => {
41
- return Object.assign(Object.assign({}, detail), { commonCode,
42
- domain, rank: (idx + 1) * 10 });
43
- }));
44
- }));
45
- }
46
- async down(queryRunner) {
47
- const codeRepo = (0, typeorm_1.getRepository)(code_base_1.CommonCode);
48
- const codeDetailRepo = (0, typeorm_1.getRepository)(code_base_1.CommonCodeDetail);
49
- }
50
- }
51
- exports.SeedCommonCode1599732967233 = SeedCommonCode1599732967233;
52
- //# sourceMappingURL=1599732967233-SeedCommonCode.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"1599732967233-SeedCommonCode.js","sourceRoot":"","sources":["../../server/migrations/1599732967233-SeedCommonCode.ts"],"names":[],"mappings":";;;AAAA,qCAAwE;AACxE,yDAAwE;AACxE,iDAA8C;AAE9C,MAAM,KAAK,GAAG;IACZ;QACE,IAAI,EAAE,eAAe;QACrB,WAAW,EAAE,cAAc;QAC3B,OAAO,EAAE;YACP,EAAE,IAAI,EAAE,IAAI,EAAE,WAAW,EAAE,UAAU,EAAE;YACvC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,GAAG,EAAE,EAAE;gBACrC,uCACK,MAAM,KACT,UAAU;oBACV,MAAM,EACN,IAAI,EAAE,CAAC,GAAG,GAAG,CAAC,CAAC,GAAG,EAAE,IACrB;YACH,CAAC,CAAC,CACH,CAAA;QACH,CAAC,CAAC,CACH,CAAA;IACH,CAAC;IAEM,KAAK,CAAC,IAAI,CAAC,WAAwB;QACxC,MAAM,QAAQ,GAAG,IAAA,uBAAa,EAAC,sBAAU,CAAC,CAAA;QAC1C,MAAM,cAAc,GAAG,IAAA,uBAAa,EAAC,4BAAgB,CAAC,CAAA;IACxD,CAAC;CACF;AAjCD,kEAiCC"}
@@ -1,51 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.SeedUser1608009991075 = void 0;
4
- const auth_base_1 = require("@things-factory/auth-base");
5
- const shell_1 = require("@things-factory/shell");
6
- const typeorm_1 = require("typeorm");
7
- const ADMIN_USER = {
8
- name: 'Admin',
9
- email: 'admin@hatiolab.com',
10
- password: 'admin',
11
- userType: 'user',
12
- status: auth_base_1.UserStatus.ACTIVATED
13
- };
14
- class SeedUser1608009991075 {
15
- async up(queryRunner) {
16
- const userRepository = (0, typeorm_1.getRepository)(auth_base_1.User);
17
- const domainRepository = (0, typeorm_1.getRepository)(shell_1.Domain);
18
- let adminUser = await userRepository.findOne({ where: { name: ADMIN_USER.name }, relations: ['domains'] });
19
- let systemDomain = await domainRepository.findOne({ where: { systemFlag: true } });
20
- if (!adminUser) {
21
- const salt = auth_base_1.User.generateSalt();
22
- adminUser = await userRepository.save(Object.assign(Object.assign({}, ADMIN_USER), { salt, password: auth_base_1.User.encode(ADMIN_USER.password, salt) }));
23
- }
24
- else {
25
- adminUser.userType = 'user';
26
- await userRepository.save(adminUser);
27
- }
28
- if (systemDomain) {
29
- systemDomain.extType = 'company';
30
- await domainRepository.save(systemDomain);
31
- }
32
- const companyInput = {
33
- name: systemDomain.name,
34
- description: systemDomain.description || null,
35
- address: '',
36
- postalCode: '',
37
- countryCode: '',
38
- brn: ''
39
- };
40
- }
41
- async down(queryRunner) {
42
- const userRepository = (0, typeorm_1.getRepository)(auth_base_1.User);
43
- const domainRepository = (0, typeorm_1.getRepository)(shell_1.Domain);
44
- const user = await userRepository.findOne({ where: { name: ADMIN_USER.name } });
45
- await userRepository.delete(user);
46
- const systemDomain = await domainRepository.findOne({ where: { systemFlag: true } });
47
- await domainRepository.delete(systemDomain);
48
- }
49
- }
50
- exports.SeedUser1608009991075 = SeedUser1608009991075;
51
- //# sourceMappingURL=1608009991075-SeedUser.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"1608009991075-SeedUser.js","sourceRoot":"","sources":["../../server/migrations/1608009991075-SeedUser.ts"],"names":[],"mappings":";;;AAAA,yDAA4D;AAE5D,iDAA8C;AAC9C,qCAAoF;AAEpF,MAAM,UAAU,GAAG;IACjB,IAAI,EAAE,OAAO;IACb,KAAK,EAAE,oBAAoB;IAC3B,QAAQ,EAAE,OAAO;IACjB,QAAQ,EAAE,MAAM;IAChB,MAAM,EAAE,sBAAU,CAAC,SAAS;CAC7B,CAAA;AACD,MAAa,qBAAqB;IACzB,KAAK,CAAC,EAAE,CAAC,WAAwB;QACtC,MAAM,cAAc,GAAqB,IAAA,uBAAa,EAAC,gBAAI,CAAC,CAAA;QAC5D,MAAM,gBAAgB,GAAuB,IAAA,uBAAa,EAAC,cAAM,CAAC,CAAA;QAElE,IAAI,SAAS,GAAS,MAAM,cAAc,CAAC,OAAO,CAAC,EAAE,KAAK,EAAE,EAAE,IAAI,EAAE,UAAU,CAAC,IAAI,EAAE,EAAE,SAAS,EAAE,CAAC,SAAS,CAAC,EAAE,CAAC,CAAA;QAChH,IAAI,YAAY,GAAW,MAAM,gBAAgB,CAAC,OAAO,CAAC,EAAE,KAAK,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,EAAE,CAAC,CAAA;QAE1F,IAAI,CAAC,SAAS,EAAE;YACd,MAAM,IAAI,GAAG,gBAAI,CAAC,YA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
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.migrations = void 0;
4
- const glob = require('glob');
5
- const path = require('path');
6
- exports.migrations = [];
7
- glob.sync(path.resolve(__dirname, '.', '**', '*.js')).forEach(function (file) {
8
- if (file.indexOf('index.js') !== -1)
9
- return;
10
- exports.migrations = exports.migrations.concat(Object.values(require(path.resolve(file))) || []);
11
- });
12
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../server/migrations/index.ts"],"names":[],"mappings":";;;AAAA,MAAM,IAAI,GAAG,OAAO,CAAC,MAAM,CAAC,CAAA;AAC5B,MAAM,IAAI,GAAG,OAAO,CAAC,MAAM,CAAC,CAAA;AAEjB,QAAA,UAAU,GAAG,EAAE,CAAA;AAE1B,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,UAAU,IAAI;IAC1E,IAAI,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;QAAE,OAAM;IAC3C,kBAAU,GAAG,kBAAU,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAA;AAClF,CAAC,CAAC,CAAA"}
@@ -1,155 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.etraxRouter = void 0;
7
- const koa_router_1 = __importDefault(require("koa-router"));
8
- const typeorm_1 = require("typeorm");
9
- const biz_base_1 = require("@things-factory/biz-base");
10
- const integration_fulfillment_1 = require("@things-factory/integration-fulfillment");
11
- const integration_lmd_1 = require("@things-factory/integration-lmd");
12
- const integration_marketplace_1 = require("@things-factory/integration-marketplace");
13
- const marketplace_base_1 = require("@things-factory/marketplace-base");
14
- const shell_1 = require("@things-factory/shell");
15
- const debug = require('debug')('things-factory:jest.config');
16
- exports.etraxRouter = new koa_router_1.default();
17
- exports.etraxRouter.post(`/lmd/etrax/status_update`, async (context, next) => {
18
- const repo = (0, typeorm_1.getRepository)(integration_lmd_1.LastMileDelivery);
19
- const requestBody = context.request.body;
20
- debug('etrax_status_update/context: ', context);
21
- const bodyToken = requestBody.Token;
22
- const bodyTimestamp = requestBody.TimeStamp;
23
- const bodySourceID = requestBody.SourceID;
24
- const extOrderNo = requestBody.ExtOrderNo;
25
- const trackingNo = requestBody.TrackingNo;
26
- const status = requestBody.Status;
27
- const awbUrl = requestBody.AWBurl;
28
- const customerCode = bodySourceID;
29
- const lmd = await repo.findOne({
30
- where: { clientName: customerCode, platform: 'eTrax' }
31
- });
32
- debug(lmd);
33
- const secretKey = lmd.secretKey;
34
- if (customerCode === '' || secretKey === '') {
35
- //Cant find the correct record
36
- return;
37
- }
38
- const etrax = new integration_lmd_1.Etrax(customerCode);
39
- debug('RequestBody: ', requestBody);
40
- //Validate Token
41
- const validate = await etrax.validateToken(bodyToken, 'UPDATE_STATUS', bodyTimestamp);
42
- debug('IsAuthenticated: ', validate);
43
- if (!validate) {
44
- //Return unauthorized
45
- const resp = {
46
- Status: 'ERROR',
47
- Code: 302,
48
- Message: 'Validate failed',
49
- OrderNo: extOrderNo,
50
- ExtOrderNo: extOrderNo,
51
- TrackingNo: trackingNo
52
- };
53
- context.type = 'application/json';
54
- context.body = JSON.stringify(resp);
55
- return;
56
- }
57
- //TAS - Transporter Assignment Success
58
- if (status === 'TAS') {
59
- //Update DB if Validate Success
60
- const orderRepo = (0, typeorm_1.getRepository)(marketplace_base_1.MarketplaceOrder);
61
- const orderShippingRepo = (0, typeorm_1.getRepository)(marketplace_base_1.MarketplaceOrderShipping);
62
- let order = await orderRepo.findOne({
63
- where: { orderNo: extOrderNo },
64
- relations: [
65
- 'domain',
66
- 'marketplaceStore',
67
- 'marketplaceOrderItems',
68
- 'marketplaceOrderItems.marketplaceOrderShippingItems',
69
- 'marketplaceOrderItems.marketplaceOrderShippingItems.marketplaceOrderShipping',
70
- 'marketplaceOrderItems.marketplaceOrderShippingItems.marketplaceOrderShipping.fulfillmentCenter',
71
- 'marketplaceOrderItems.marketplaceProductVariation',
72
- ]
73
- });
74
- let orderItems = order.marketplaceOrderItems;
75
- const marketplaceStore = order.marketplaceStore;
76
- const marketplaceTransporter = await (0, typeorm_1.getRepository)(integration_marketplace_1.MarketplaceTransporter).findOne({
77
- where: { marketplaceStore },
78
- relations: ['pickupTransporter']
79
- });
80
- for (const orderItem of orderItems) {
81
- if (orderItem.marketplaceOrderShippingItems[0].marketplaceOrderShipping !== null) {
82
- const orderShippingItems = orderItem.marketplaceOrderShippingItems;
83
- const orderShipping = orderShippingItems[0].marketplaceOrderShipping;
84
- const fulfillmentCenter = orderShipping === null || orderShipping === void 0 ? void 0 : orderShipping.fulfillmentCenter;
85
- const currentDate = new Date();
86
- const centerId = fulfillmentCenter.centerId;
87
- const warehouseDomain = await (0, typeorm_1.getRepository)(shell_1.Domain).findOne({ where: { subdomain: centerId } });
88
- const customerBizplaces = await (0, biz_base_1.getCustomerBizplaces)(warehouseDomain);
89
- const customerBizplaceId = customerBizplaces.find(customerBizplace => customerBizplace.company.domain.id == (order === null || order === void 0 ? void 0 : order.domain.id)).id;
90
- let patch = {
91
- id: orderShipping.releaseOrderId,
92
- trackingNo: trackingNo,
93
- transporter: marketplaceTransporter === null || marketplaceTransporter === void 0 ? void 0 : marketplaceTransporter.pickupTransporter.name
94
- };
95
- integration_fulfillment_1.FulfillmentAPI.updateReleaseGoodDetails(fulfillmentCenter, {
96
- customerBizplaceId,
97
- releaseOrder: Object.assign({}, patch),
98
- shippingOrder: null
99
- });
100
- await orderShippingRepo.update({ id: orderShipping.id }, { trackingNo: trackingNo, airwayBill: awbUrl, updatedAt: currentDate, transporter: (marketplaceTransporter === null || marketplaceTransporter === void 0 ? void 0 : marketplaceTransporter.pickupTransporter.name) || orderShipping.transporter });
101
- }
102
- }
103
- // to-do update tracking no to every marketplaces
104
- if (marketplaceStore.platform === 'woocommerce' || marketplaceStore.platform === 'shopify') {
105
- const note = 'http://ets.sntglobal.com/?mod=tracking&action=index&orders=' + trackingNo;
106
- let orderInfo = await (0, typeorm_1.getRepository)(marketplace_base_1.MarketplaceOrder).findOne({
107
- where: {
108
- name: order.name
109
- },
110
- relations: ['marketplaceOrderItems', 'marketplaceOrderItems.marketplaceProductVariation']
111
- });
112
- const result = await integration_marketplace_1.StoreAPI.setStoreOrderStatusReadyToShip(marketplaceStore, {
113
- orderId: order.name,
114
- trackingUrl: note,
115
- trackingNo,
116
- order: orderInfo,
117
- note,
118
- transporter: marketplaceTransporter === null || marketplaceTransporter === void 0 ? void 0 : marketplaceTransporter.pickupTransporter.name
119
- });
120
- if (marketplaceStore.platform === 'woocommerce') {
121
- await integration_marketplace_1.StoreAPI.updateOrderStatus(marketplaceStore, {
122
- orderId: order.name,
123
- status: 'DELIVERED'
124
- });
125
- }
126
- }
127
- try {
128
- const updatedOrder = await integration_marketplace_1.StoreAPI.getStoreOrder(marketplaceStore, { orderId: order.name });
129
- order.status = updatedOrder.status;
130
- order.orderUpdatedAt = updatedOrder.orderUpdatedAt;
131
- order.trackingNo = updatedOrder.trackingNo;
132
- order.shippingProvider = updatedOrder.shippingProvider;
133
- await (0, typeorm_1.getRepository)(marketplace_base_1.MarketplaceOrder).save(order);
134
- for (let idx = 0; idx < order.marketplaceOrderItems.length; idx++) {
135
- let matchItem = updatedOrder.orderItems.find(i => i.variationId == order.marketplaceOrderItems[idx].marketplaceProductVariation.variationId);
136
- if (matchItem) {
137
- let targetMarketplaceOrderItem = Object.assign(Object.assign({}, order.marketplaceOrderItems[idx]), { shippingProvider: matchItem.shippingProvider, trackingCode: matchItem.trackingNo, status: matchItem.status });
138
- await (0, typeorm_1.getRepository)(marketplace_base_1.MarketplaceOrderItem).save(targetMarketplaceOrderItem);
139
- }
140
- }
141
- }
142
- catch (e) { }
143
- const resp = {
144
- Status: 'SUCCESS',
145
- Code: 200,
146
- Message: 'Updated',
147
- OrderNo: order.orderNo,
148
- ExtOrderNo: extOrderNo,
149
- TrackingNo: trackingNo
150
- };
151
- context.type = 'application/json';
152
- context.body = JSON.stringify(resp);
153
- }
154
- });
155
- //# sourceMappingURL=etrax-router.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"etrax-router.js","sourceRoot":"","sources":["../../server/routers/etrax-router.ts"],"names":[],"mappings":";;;;;;AAAA,4DAA+B;AAC/B,qCAAuC;AAEvC,uDAAyE;AACzE,qFAA2F;AAC3F,qEAAyE;AACzE,qFAA4G;AAC5G,uEAKyC;AACzC,iDAA8C;AAE9C,MAAM,KAAK,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC,4BAA4B,CAAC,CAAA;AAC/C,QAAA,WAAW,GAAG,IAAI,oBAAM,EAAE,CAAA;AAEvC,mBAAW,CAAC,IAAI,CAAC,0BAA0B,EAAE,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE;IACnE,MAAM,IAAI,GAAG,IAAA,uBAAa,EAAC,kCAAgB,CAAC,CAAA;IAC5C,MAAM,WAAW,GAAG,OAAO,CAAC,OAAO,CAAC,IAAI,CAAA;IACxC,KAAK,CAAC,+BAA+B,EAAE,OAAO,CAAC,CAAA;IAE/C,MAAM,SAAS,GAAG,WAAW,CAAC,KAAK,CAAA;IACnC,MAAM,aAAa,GAAG,WAAW,CAAC,SAAS,CAAA;IAC3C,MAAM,YAAY,GAAG,WAAW,CAAC,QAAQ,CAAA;IACzC,MAAM,UAAU,GAAG,WAAW,CAAC,UAAU,CAAA;IACzC,MAAM,UAAU,GAAG,WAAW,CAAC,UAAU,CAAA;IACzC,MAAM,MAAM,GAAG,WAAW,CAAC,MAAM,CAAA;IACjC,MAAM,MAAM,GAAG,WAAW,CAAC,MAAM,CAAA;IAEjC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GAAG,CAAC,KACnC,gBAAgB,EAAE,SAAS,CAAC,gBAAgB,EAC5C,YAAY,EAAE,SAAS,CAAC,UAAU,EAClC,MAAM,EAAE,SAAS,CAAC,MAAM,GACzB,CAAA;oBAED,MAAM,IAAA,uBAAa,EAAC,uCAAoB,CAAC,CAAC,IAAI,CAAC,0BAA0B,CAAC,CAAA;iBAC3E;aACF;SACF;QAAC,OAAM,CAAC,EAAE,GAAE;QAEb,MAAM,IAAI,GAAG;YACX,MAAM,EAAE,SAAS;YACjB,IAAI,EAAE,GAAG;YACT,OAAO,EAAE,SAAS;YAClB,OAAO,EAAE,KAAK,CAAC,OAAO;YACtB,UAAU,EAAE,UAAU;YACtB,UAAU,EAAE,UAAU;SACvB,CAAA;QACD,OAAO,CAAC,IAAI,GAAG,kBAAkB,CAAA;QACjC,OAAO,CAAC,IAAI,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAA;KACpC;AACH,CAAC,CAAC,CAAA"}
@@ -1,109 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.shopifyPosPublicRouter = void 0;
7
- const biz_base_1 = require("@things-factory/biz-base");
8
- const env_1 = require("@things-factory/env");
9
- const integration_marketplace_1 = require("@things-factory/integration-marketplace");
10
- const marketplace_base_1 = require("@things-factory/marketplace-base");
11
- const product_base_1 = require("@things-factory/product-base");
12
- const warehouse_base_1 = require("@things-factory/warehouse-base");
13
- const koa_router_1 = __importDefault(require("koa-router"));
14
- const typeorm_1 = require("typeorm");
15
- const shopifyConfig = env_1.config.get('marketplaceIntegrationShopify', {});
16
- const { apiKey, apiSecret } = shopifyConfig;
17
- exports.shopifyPosPublicRouter = new koa_router_1.default();
18
- exports.shopifyPosPublicRouter.post('/webhook-shopify/orders/create', async (context, next) => {
19
- const { request, t } = context;
20
- const hmac = request.get('x-shopify-hmac-sha256');
21
- const shopDomain = request.get('x-shopify-shop-domain');
22
- const shop = shopDomain.replace('.myshopify.com', '');
23
- const shopify = new integration_marketplace_1.Shopify({ apiKey, apiSecret, shop });
24
- const marketplaceStore = await (0, typeorm_1.getRepository)(integration_marketplace_1.MarketplaceStore).findOne({
25
- where: { storeId: shop, status: 'ACTIVE' },
26
- relations: ['domain']
27
- });
28
- if (!marketplaceStore) {
29
- context.status = 404;
30
- context.body = t('error.unable to find store account');
31
- return;
32
- }
33
- const webhookKey = marketplaceStore.webhookKey;
34
- const verifyMerchant = shopify.verifyWebhook(request, hmac, webhookKey);
35
- if (!verifyMerchant) {
36
- context.status = 404;
37
- context.body = t('error.unable to verify webhook origin');
38
- return;
39
- }
40
- const data = request.body;
41
- if (data.source_name === 'pos') {
42
- const domainCompany = await (0, typeorm_1.getRepository)(biz_base_1.Company).findOne({
43
- where: { domain: marketplaceStore.domain }
44
- });
45
- const bizplaces = await (0, typeorm_1.getRepository)(biz_base_1.Bizplace).find({
46
- where: { company: domainCompany },
47
- relations: ['domain']
48
- });
49
- const warehouseDomains = bizplaces.map((bizplace) => bizplace.domain);
50
- const selectedWarehouseDomain = warehouseDomains.filter(domain => domain.description === 'default' && domain.extType === 'warehouse');
51
- const refOrder = { id: data.id, name: data.order_number };
52
- const lineItems = data.line_items;
53
- for (var i = 0; i < lineItems.length; i++) {
54
- const variationId = lineItems[i].variant_id;
55
- var itemQty = lineItems[i].quantity;
56
- var itemUomValue = 0;
57
- const marketplaceProductVariation = await (0, typeorm_1.getRepository)(marketplace_base_1.MarketplaceProductVariation).findOne({
58
- where: {
59
- variationId,
60
- domain: marketplaceStore.domain
61
- }
62
- });
63
- const warehouseProduct = await (0, typeorm_1.getRepository)(product_base_1.Product).findOne({
64
- where: {
65
- sku: marketplaceProductVariation.sku
66
- },
67
- relations: ['bizplace']
68
- });
69
- const inventories = await (0, typeorm_1.getRepository)(warehouse_base_1.Inventory).find({
70
- where: {
71
- product: warehouseProduct,
72
- domain: selectedWarehouseDomain[0],
73
- status: 'STORED'
74
- },
75
- relations: ['domain', 'bizplace', 'product', 'warehouse', 'location']
76
- });
77
- for (var j = 0; j < inventories.length; j++) {
78
- var inventory = inventories[j];
79
- if (inventory.qty >= itemQty) {
80
- itemUomValue = (inventory.uomValue / inventory.qty) * itemQty;
81
- inventory.qty -= itemQty;
82
- inventory.uomValue -= itemUomValue;
83
- await (0, warehouse_base_1.generateInventoryHistory)(inventory, refOrder, warehouse_base_1.INVENTORY_TRANSACTION_TYPE.SALES_ADJUSTMENT, -itemQty, -itemUomValue, null);
84
- if (inventory.qty === 0) {
85
- inventory.status = warehouse_base_1.INVENTORY_STATUS.TERMINATED;
86
- await (0, warehouse_base_1.generateInventoryHistory)(inventory, refOrder, warehouse_base_1.INVENTORY_STATUS.TERMINATED, 0, 0, null);
87
- }
88
- itemQty = 0;
89
- }
90
- else {
91
- itemQty -= inventory.qty;
92
- itemUomValue = (inventory.uomValue / inventory.qty) * itemQty;
93
- inventory.qty -= itemQty;
94
- inventory.uomValue -= itemUomValue;
95
- await (0, warehouse_base_1.generateInventoryHistory)(inventory, refOrder, warehouse_base_1.INVENTORY_TRANSACTION_TYPE.SALES_ADJUSTMENT, -itemQty, -itemUomValue, null);
96
- if (inventory.qty === 0) {
97
- inventory.status = warehouse_base_1.INVENTORY_STATUS.TERMINATED;
98
- await (0, warehouse_base_1.generateInventoryHistory)(inventory, refOrder, warehouse_base_1.INVENTORY_STATUS.TERMINATED, 0, 0, null);
99
- }
100
- }
101
- if (itemQty == 0) {
102
- break;
103
- }
104
- }
105
- }
106
- }
107
- context.status = 200;
108
- });
109
- //# sourceMappingURL=shopify-pos-public-router.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"shopify-pos-public-router.js","sourceRoot":"","sources":["../../server/routers/shopify-pos-public-router.ts"],"names":[],"mappings":";;;;;;AACA,uDAA4D;AAC5D,6CAA4C;AAC5C,qFAAmF;AACnF,uEAA8E;AAC9E,+DAAsD;AACtD,mEAK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b,IAAI,CACL,CAAA;oBAED,IAAI,SAAS,CAAC,GAAG,KAAK,CAAC,EAAE;wBACvB,SAAS,CAAC,MAAM,GAAG,iCAAgB,CAAC,UAAU,CAAA;wBAE9C,MAAM,IAAA,yCAAwB,EAAC,SAAS,EAAE,QAAQ,EAAE,iCAAgB,CAAC,UAAU,EAAE,CAAC,EAAE,CAAC,EAAE,IAAI,CAAC,CAAA;qBAC7F;oBACD,OAAO,GAAG,CAAC,CAAA;iBACZ;qBAAM;oBACL,OAAO,IAAI,SAAS,CAAC,GAAG,CAAA;oBACxB,YAAY,GAAG,CAAC,SAAS,CAAC,QAAQ,GAAG,SAAS,CAAC,GAAG,CAAC,GAAG,OAAO,CAAA;oBAC7D,SAAS,CAAC,GAAG,IAAI,OAAO,CAAA;oBACxB,SAAS,CAAC,QAAQ,IAAI,YAAY,CAAA;oBAElC,MAAM,IAAA,yCAAwB,EAC5B,SAAS,EACT,QAAQ,EACR,2CAA0B,CAAC,gBAAgB,EAC3C,CAAC,OAAO,EACR,CAAC,YAAY,EACb,IAAI,CACL,CAAA;oBAED,IAAI,SAAS,CAAC,GAAG,KAAK,CAAC,EAAE;wBACvB,SAAS,CAAC,MAAM,GAAG,iCAAgB,CAAC,UAAU,CAAA;wBAE9C,MAAM,IAAA,yCAAwB,EAAC,SAAS,EAAE,QAAQ,EAAE,iCAAgB,CAAC,UAAU,EAAE,CAAC,EAAE,CAAC,EAAE,IAAI,CAAC,CAAA;qBAC7F;iBACF;gBAED,IAAI,OAAO,IAAI,CAAC,EAAE;oBAChB,MAAK;iBACN;aACF;SACF;KACF;IAED,OAAO,CAAC,MAAM,GAAG,GAAG,CAAA;AACtB,CAAC,CAAC,CAAA"}
@@ -1,11 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const shopify_pos_public_router_1 = require("./routers/shopify-pos-public-router");
4
- const etrax_router_1 = require("./routers/etrax-router");
5
- const debug = require('debug')('things-factory:operato-mms:routes');
6
- process.on('bootstrap-module-global-public-route', (app, globalPublicRouter) => {
7
- globalPublicRouter.use(shopify_pos_public_router_1.shopifyPosPublicRouter.routes(), shopify_pos_public_router_1.shopifyPosPublicRouter.allowedMethods());
8
- globalPublicRouter.use(etrax_router_1.etraxRouter.routes(), etrax_router_1.etraxRouter.allowedMethods());
9
- });
10
- process.on('bootstrap-module-domain-private-route', (app, domainPrivateRouter) => { });
11
- //# sourceMappingURL=routes.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"routes.js","sourceRoot":"","sources":["../server/routes.ts"],"names":[],"mappings":";;AAAA,mFAA4E;AAC5E,yDAAoD;AAEpD,MAAM,KAAK,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC,mCAAmC,CAAC,CAAA;AAEnE,OAAO,CAAC,EAAE,CAAC,sCAA6C,EAAE,CAAC,GAAG,EAAE,kBAAkB,EAAE,EAAE;IACpF,kBAAkB,CAAC,GAAG,CAAC,kDAAsB,CAAC,MAAM,EAAE,EAAE,kDAAsB,CAAC,cAAc,EAAE,CAAC,CAAA;IAChG,kBAAkB,CAAC,GAAG,CAAC,0BAAW,CAAC,MAAM,EAAE,EAAE,0BAAW,CAAC,cAAc,EAAE,CAAC,CAAA;AAC5E,CAAC,CAAC,CAAA;AAEF,OAAO,CAAC,EAAE,CAAC,uCAA8C,EAAE,CAAC,GAAG,EAAE,mBAAmB,EAAE,EAAE,GAAE,CAAC,CAAC,CAAA"}
@@ -1,53 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- var _a;
6
- Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.interfaceHelper = void 0;
8
- const env_1 = require("@things-factory/env");
9
- const oauth2_client_1 = require("@things-factory/oauth2-client");
10
- const node_fetch_1 = __importDefault(require("node-fetch"));
11
- const typeorm_1 = require("typeorm");
12
- const url_1 = require("url");
13
- const platforms = ((_a = env_1.config.get('oauth2')) === null || _a === void 0 ? void 0 : _a.platforms) || [];
14
- const API_URL_MAP = new Map(platforms.map(platform => [platform.name, platform.apiURL]));
15
- exports.interfaceHelper = {
16
- async fetch(platform, endPoint, method, context, body) {
17
- const { domain } = context.state;
18
- const url = new url_1.URL(API_URL_MAP.get(platform));
19
- url.host = domain.subdomain + '.' + url.host;
20
- url.pathname += '/' + endPoint;
21
- url.pathname.replace(/\/+/g, '/');
22
- endPoint = decodeURIComponent(url.href);
23
- const accessToken = await this.getAccessToken(domain);
24
- const requestInit = {
25
- method,
26
- headers: {
27
- Accept: 'application/json',
28
- 'Content-Type': 'application/json',
29
- Authorization: `Bearer ${accessToken}`
30
- }
31
- };
32
- if (body)
33
- requestInit.body = JSON.stringify(body);
34
- const res = await (0, node_fetch_1.default)(endPoint, requestInit);
35
- if (res.ok) {
36
- const { result } = await res.json();
37
- return result;
38
- }
39
- else {
40
- const errorcode = res.status;
41
- const message = await res.text();
42
- return { errorcode, message };
43
- }
44
- },
45
- async getAccessToken(domain) {
46
- const { accessToken } = await (0, typeorm_1.getRepository)(oauth2_client_1.Oauth2Client).findOne({
47
- domain,
48
- name: 'Operato Hub'
49
- });
50
- return accessToken;
51
- }
52
- };
53
- //# sourceMappingURL=interface-helper.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"interface-helper.js","sourceRoot":"","sources":["../../server/util/interface-helper.ts"],"names":[],"mappings":";;;;;;;AAAA,6CAA4C;AAC5C,iEAA4D;AAE5D,4DAA+C;AAC/C,qCAAuC;AACvC,6BAAyB;AAIzB,MAAM,SAAS,GAAuC,CAAA,MAAA,YAAM,CAAC,GAAG,CAAC,QAAQ,CAAC,0CAAE,SAAS,KAAI,EAAE,CAAA;AAC3F,MAAM,WAAW,GAAwB,IAAI,GAAG,CAAC,SAAS,CAAC,GAAG,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,CAAA;AAEhG,QAAA,e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O,EAAE,CAAA;SAC9B;IACH,CAAC;IAED,KAAK,CAAC,cAAc,CAAC,MAAc;QACjC,MAAM,EAAE,WAAW,EAAE,GAAiB,MAAM,IAAA,uBAAa,EAAC,4BAAY,CAAC,CAAC,OAAO,CAAC;YAC9E,MAAM;YACN,IAAI,EAAE,aAAa;SACpB,CAAC,CAAA;QAEF,OAAO,WAAW,CAAA;IACpB,CAAC;CACF,CAAA"}
@@ -1,14 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.NoGenerator = void 0;
4
- const uuid_1 = require("uuid");
5
- class NoGenerator {
6
- static id() {
7
- return `${(0, uuid_1.v4)()}`;
8
- }
9
- static sku() {
10
- return `SKU-${(0, uuid_1.v4)()}`;
11
- }
12
- }
13
- exports.NoGenerator = NoGenerator;
14
- //# sourceMappingURL=no-generator.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"no-generator.js","sourceRoot":"","sources":["../../server/util/no-generator.ts"],"names":[],"mappings":";;;AAAA,+BAAmC;AAEnC,MAAa,WAAW;IACtB,MAAM,CAAC,EAAE;QACP,OAAO,GAAG,IAAA,SAAM,GAAE,EAAE,CAAA;IACtB,CAAC;IAED,MAAM,CAAC,GAAG;QACR,OAAO,OAAO,IAAA,SAAM,GAAE,EAAE,CAAA;IAC1B,CAAC;CACF;AARD,kCAQC"}