@things-factory/integration-powrup 4.3.822 → 4.3.824

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.
@@ -14,7 +14,10 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
+ exports.notifyPowrupOrderStatus = void 0;
17
18
  require("./powrup-api");
18
19
  require("./powrup");
19
20
  __exportStar(require("./powrup-api"), exports);
21
+ var notify_order_status_1 = require("./powrup/notify-order-status");
22
+ Object.defineProperty(exports, "notifyPowrupOrderStatus", { enumerable: true, get: function () { return notify_order_status_1.notifyPowrupOrderStatus; } });
20
23
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../server/controllers/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,wBAAqB;AACrB,oBAAiB;AAEjB,+CAA4B"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../server/controllers/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,wBAAqB;AACrB,oBAAiB;AAEjB,+CAA4B;AAC5B,oEAAsE;AAA7D,8HAAA,uBAAuB,OAAA"}
@@ -20,4 +20,5 @@ __exportStar(require("./initiate-shipment"), exports);
20
20
  __exportStar(require("./fetch-document"), exports);
21
21
  __exportStar(require("./update-stock"), exports);
22
22
  __exportStar(require("./get-tracking-no"), exports);
23
+ __exportStar(require("./update-order-status"), exports);
23
24
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../server/controllers/powrup/apis/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,yCAAsB;AACtB,+CAA4B;AAC5B,sDAAmC;AACnC,mDAAgC;AAChC,iDAA8B;AAC9B,oDAAiC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../server/controllers/powrup/apis/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,yCAAsB;AACtB,+CAA4B;AAC5B,sDAAmC;AACnC,mDAAgC;AAChC,iDAA8B;AAC9B,oDAAiC;AACjC,wDAAqC"}
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.updateOrderStatus = void 0;
4
+ function updateOrderStatus() {
5
+ return {
6
+ method: 'post',
7
+ path: '/wms/update-order-status',
8
+ denormalize(req) {
9
+ return { payload: { orderId: req.orderId, status: req.status, timestamp: req.timestamp } };
10
+ },
11
+ normalize(res) {
12
+ return res;
13
+ }
14
+ };
15
+ }
16
+ exports.updateOrderStatus = updateOrderStatus;
17
+ //# sourceMappingURL=update-order-status.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"update-order-status.js","sourceRoot":"","sources":["../../../../server/controllers/powrup/apis/update-order-status.ts"],"names":[],"mappings":";;;AAAA,SAAgB,iBAAiB;IAC/B,OAAO;QACL,MAAM,EAAE,MAAM;QACd,IAAI,EAAE,0BAA0B;QAChC,WAAW,CAAC,GAAG;YACb,OAAO,EAAE,OAAO,EAAE,EAAE,OAAO,EAAE,GAAG,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,CAAC,MAAM,EAAE,SAAS,EAAE,GAAG,CAAC,SAAS,EAAE,EAAE,CAAA;QAC5F,CAAC;QACD,SAAS,CAAC,GAAG;YACX,OAAO,GAAG,CAAA;QACZ,CAAC;KACF,CAAA;AACH,CAAC;AAXD,8CAWC"}
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.notifyPowrupOrderStatus = void 0;
4
+ const typeorm_1 = require("typeorm");
5
+ const powrup_api_1 = require("../powrup-api");
6
+ const service_1 = require("../../service");
7
+ async function notifyPowrupOrderStatus(releaseGood, status, timestamp) {
8
+ try {
9
+ const powrup = await (0, typeorm_1.getRepository)(service_1.Powrup).createQueryBuilder().where('active = :active', { active: true }).andWhere('platform = :platform', { platform: 'POWRUP' }).getOne();
10
+ if (!powrup)
11
+ return;
12
+ await powrup_api_1.PowrupAPI.updateOrderStatus(powrup, {
13
+ orderId: releaseGood.refOrderId,
14
+ status,
15
+ timestamp: (timestamp || new Date()).toISOString(),
16
+ context: { state: { domain: releaseGood.domain, user: null } }
17
+ });
18
+ }
19
+ catch (e) {
20
+ console.error(`Failed to notify Powrup order status: ${e.message}`);
21
+ }
22
+ }
23
+ exports.notifyPowrupOrderStatus = notifyPowrupOrderStatus;
24
+ //# sourceMappingURL=notify-order-status.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"notify-order-status.js","sourceRoot":"","sources":["../../../server/controllers/powrup/notify-order-status.ts"],"names":[],"mappings":";;;AAAA,qCAAuC;AACvC,8CAAyC;AACzC,2CAAsC;AAE/B,KAAK,UAAU,uBAAuB,CAAC,WAAgB,EAAE,MAAc,EAAE,SAAgB;IAC9F,IAAI;QACF,MAAM,MAAM,GAAG,MAAM,IAAA,uBAAa,EAAC,gBAAM,CAAC,CAAC,kBAAkB,EAAE,CAAC,KAAK,CAAC,kBAAkB,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,QAAQ,CAAC,sBAAsB,EAAE,EAAE,QAAQ,EAAE,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAA;QAC7K,IAAI,CAAC,MAAM;YAAE,OAAM;QACnB,MAAM,sBAAS,CAAC,iBAAiB,CAAC,MAAM,EAAE;YACxC,OAAO,EAAE,WAAW,CAAC,UAAU;YAC/B,MAAM;YACN,SAAS,EAAE,CAAC,SAAS,IAAI,IAAI,IAAI,EAAE,CAAC,CAAC,WAAW,EAAE;YAClD,OAAO,EAAE,EAAE,KAAK,EAAE,EAAE,MAAM,EAAE,WAAW,CAAC,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,EAAE;SAC/D,CAAC,CAAA;KACH;IAAC,OAAO,CAAC,EAAE;QACV,OAAO,CAAC,KAAK,CAAC,yCAAyC,CAAC,CAAC,OAAO,EAAE,CAAC,CAAA;KACpE;AACH,CAAC;AAbD,0DAaC"}
@@ -36,6 +36,7 @@ class PowrupAPI {
36
36
  static packOrder(powrup, req) { }
37
37
  static updateStock(powrup, req) { }
38
38
  static getTrackingNo(powrup, req) { }
39
+ static updateOrderStatus(powrup, req) { }
39
40
  }
40
41
  PowrupAPI.platforms = {};
41
42
  __decorate([
@@ -74,5 +75,11 @@ __decorate([
74
75
  __metadata("design:paramtypes", [Object, Object]),
75
76
  __metadata("design:returntype", Object)
76
77
  ], PowrupAPI, "getTrackingNo", null);
78
+ __decorate([
79
+ decorators_1.api,
80
+ __metadata("design:type", Function),
81
+ __metadata("design:paramtypes", [Object, Object]),
82
+ __metadata("design:returntype", Object)
83
+ ], PowrupAPI, "updateOrderStatus", null);
77
84
  exports.PowrupAPI = PowrupAPI;
78
85
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../server/controllers/powrup-api/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qCAAuC;AAEvC,2CAAsC;AACtC,6CAAkC;AAElC,MAAa,SAAS;IAGpB,MAAM,CAAC,gBAAgB,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI;QACxC,SAAS,CAAC,SAAS,CAAC,IAAI,CAAC,GAAG;YAC1B,MAAM;YACN,IAAI;SACL,CAAA;IACH,CAAC;IAED,MAAM,CAAC,WAAW,CAAC,IAAI;QACrB,OAAO,SAAS,CAAC,SAAS,CAAC,IAAI,CAAC,CAAA;IAClC,CAAC;IAED,MAAM,CAAC,KAAK,CAAC,SAAS,CAAC,EAAE;QACvB,MAAM,UAAU,GAAG,IAAA,uBAAa,EAAC,gBAAM,CAAC,CAAA;QACxC,OAAO,MAAM,UAAU,CAAC,OAAO,CAAC;YAC9B,KAAK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EAAC,gBAAM,CAAC,CAAA;QACxC,OAAO,MAAM,UAAU,CAAC,OAAO,CAAC;YAC9B,KAAK,EAAE,EAAE,EAAE,EAAE;YACb,SAAS,EAAE,CAAC,QAAQ,CAAC;SACtB,CAAC,CAAA;IACJ,CAAC;IAGM,AAAP,MAAM,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,IAAQ,CAAC;IAGzB,AAAP,MAAM,CAAC,aAAa,CAAC,MAAM,EAAE,GAAG,IAAQ,CAAC;IAGlC,AAAP,MAAM,CAAC,gBAAgB,CAAC,MAAM,EAAE,GAAG,IAAQ,CAAC;IAGrC,AAAP,MAAM,CAAC,SAAS,CAAC,MAAM,EAAE,GAAG,IAAQ,CAAC;IAG9B,AAAP,MAAM,CAAC,WAAW,CAAC,MAAM,EAAE,GAAG,IAAQ,CAAC;IAGhC,AAAP,MAAM,CAAC,aAAa,CAAC,MAAM,EAAE,GAAG,IAAQ,CAAC;IAGlC,AAAP,MAAM,CAAC,iBAAiB,CAAC,MAAM,EAAE,GAAG,IAAQ,CAAC;;AAxCtC,mBAAS,GAAG,EAAE,CAAA;AAsBd;IADN,gBAAG;;;;2BAC4B;AAGzB;IADN,gBAAG;;;;oCACqC;AAGlC;IADN,gBAAG;;;;uCACwC;AAGrC;IADN,gBAAG;;;;gCACiC;AAG9B;IADN,gBAAG;;;;kCACmC;AAGhC;IADN,gBAAG;;;;oCACqC;AAGlC;IADN,gBAAG;;;;wCACyC;AAzC/C,8BA0CC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@things-factory/integration-powrup",
3
- "version": "4.3.822",
3
+ "version": "4.3.824",
4
4
  "main": "dist-server/index.js",
5
5
  "browser": "client/index.js",
6
6
  "things-factory": true,
@@ -30,10 +30,10 @@
30
30
  "@things-factory/context-ui": "^4.3.815",
31
31
  "@things-factory/grist-ui": "^4.3.815",
32
32
  "@things-factory/i18n-base": "^4.3.815",
33
- "@things-factory/integration-marketplace": "^4.3.822",
34
- "@things-factory/integration-ui": "^4.3.822",
33
+ "@things-factory/integration-marketplace": "^4.3.824",
34
+ "@things-factory/integration-ui": "^4.3.824",
35
35
  "@things-factory/more-ui": "^4.3.815",
36
- "@things-factory/resource-ui": "^4.3.815",
36
+ "@things-factory/resource-ui": "^4.3.823",
37
37
  "@things-factory/setting-ui": "^4.3.815",
38
38
  "@things-factory/system-ui": "^4.3.815",
39
39
  "debug": "^4.1.1",
@@ -50,5 +50,5 @@
50
50
  "nock": "^13.0.2",
51
51
  "should": "^13.2.3"
52
52
  },
53
- "gitHead": "a3d4a456e624f2ec794324e0f395d737df34e554"
53
+ "gitHead": "7c6aa626b0ce0ce8ab988710b0e8fc2ed0bba5c2"
54
54
  }
@@ -2,3 +2,4 @@ import './powrup-api'
2
2
  import './powrup'
3
3
 
4
4
  export * from './powrup-api'
5
+ export { notifyPowrupOrderStatus } from './powrup/notify-order-status'
@@ -3,4 +3,5 @@ export * from './pack-order'
3
3
  export * from './initiate-shipment'
4
4
  export * from './fetch-document'
5
5
  export * from './update-stock'
6
- export * from './get-tracking-no'
6
+ export * from './get-tracking-no'
7
+ export * from './update-order-status'
@@ -0,0 +1,12 @@
1
+ export function updateOrderStatus() {
2
+ return {
3
+ method: 'post',
4
+ path: '/wms/update-order-status',
5
+ denormalize(req) {
6
+ return { payload: { orderId: req.orderId, status: req.status, timestamp: req.timestamp } }
7
+ },
8
+ normalize(res) {
9
+ return res
10
+ }
11
+ }
12
+ }
@@ -0,0 +1,18 @@
1
+ import { getRepository } from 'typeorm'
2
+ import { PowrupAPI } from '../powrup-api'
3
+ import { Powrup } from '../../service'
4
+
5
+ export async function notifyPowrupOrderStatus(releaseGood: any, status: string, timestamp?: Date) {
6
+ try {
7
+ const powrup = await getRepository(Powrup).createQueryBuilder().where('active = :active', { active: true }).andWhere('platform = :platform', { platform: 'POWRUP' }).getOne()
8
+ if (!powrup) return
9
+ await PowrupAPI.updateOrderStatus(powrup, {
10
+ orderId: releaseGood.refOrderId,
11
+ status,
12
+ timestamp: (timestamp || new Date()).toISOString(),
13
+ context: { state: { domain: releaseGood.domain, user: null } }
14
+ })
15
+ } catch (e) {
16
+ console.error(`Failed to notify Powrup order status: ${e.message}`)
17
+ }
18
+ }
@@ -42,4 +42,7 @@ export class PowrupAPI {
42
42
 
43
43
  @api
44
44
  static getTrackingNo(powrup, req): any {}
45
+
46
+ @api
47
+ static updateOrderStatus(powrup, req): any {}
45
48
  }