meemup-library 1.0.27 → 1.0.28

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.
@@ -1,10 +1,7 @@
1
+ import { initCustomerFacingDisplayPacket } from "../interfaces/cfds/ICustomerFacingDisplayPacket";
1
2
  export default new class CustomerFacingDisplayPacketController {
2
3
  code(order, setting, localSetting) {
3
- let packet = {
4
- r: localSetting.udpClientName,
5
- c: setting.currencySymbol,
6
- d: []
7
- };
4
+ let packet = Object.assign(Object.assign({}, initCustomerFacingDisplayPacket), { r: localSetting.udpClientName, c: setting.currencySymbol, d: [] });
8
5
  order.products.forEach(product => {
9
6
  let extPro = [];
10
7
  product.extras.forEach(ext => {
@@ -23,14 +20,23 @@ export default new class CustomerFacingDisplayPacketController {
23
20
  };
24
21
  packet.d.push(pro);
25
22
  });
23
+ packet.dd = order.displayDiscount;
24
+ packet.re = order.remark;
25
+ packet.ot = order.orderType;
26
+ packet.dc = order.deliveryCost;
27
+ packet.ds = order.displaySubTotal;
28
+ packet.tt = setting.taxTitle;
29
+ packet.dt = order.displayTax;
30
+ packet.pt = order.paymentType;
31
+ packet.ps = order.paymentState;
32
+ packet.rcp = order.roundCashPayments;
33
+ packet.rca = order.displayRoundCashAmount;
34
+ packet.fees = order.displayFees;
35
+ packet.ta = order.displayTotalAmount;
26
36
  return packet;
27
37
  }
28
38
  decode(data) {
29
- let packet = {
30
- r: "",
31
- c: "",
32
- d: []
33
- };
39
+ let packet = Object.assign({}, initCustomerFacingDisplayPacket);
34
40
  try {
35
41
  return JSON.parse(data);
36
42
  }
@@ -1,8 +1,25 @@
1
+ import EnumOrderType from "../../enums/EnumOrderType";
2
+ import EnumPaymentState from "../../enums/EnumPaymentState";
3
+ import EnumPaymentType from "../../enums/EnumPaymentType";
4
+ import ICalculateFeeResult from "../ICalculateFeeResult";
1
5
  import ICustomerFacingDisplayPacketProduct from "./ICustomerFacingDisplayPacketProduct";
2
6
  interface ICustomerFacingDisplayPacket {
3
7
  r: string;
4
8
  c: string;
5
9
  d: ICustomerFacingDisplayPacketProduct[];
10
+ dd: number;
11
+ re: string;
12
+ ot: EnumOrderType;
13
+ dc: number;
14
+ ds: number;
15
+ tt: string;
16
+ dt: number;
17
+ pt: EnumPaymentType;
18
+ ps: EnumPaymentState;
19
+ rcp: number;
20
+ rca: number;
21
+ fees: ICalculateFeeResult[];
22
+ ta: number;
6
23
  }
7
24
  export default ICustomerFacingDisplayPacket;
8
- export declare const initCustomerFacingDisplaySetting: ICustomerFacingDisplayPacket;
25
+ export declare const initCustomerFacingDisplayPacket: ICustomerFacingDisplayPacket;
@@ -1,5 +1,21 @@
1
- export const initCustomerFacingDisplaySetting = {
1
+ import EnumOrderType from "../../enums/EnumOrderType";
2
+ import EnumPaymentState from "../../enums/EnumPaymentState";
3
+ import EnumPaymentType from "../../enums/EnumPaymentType";
4
+ export const initCustomerFacingDisplayPacket = {
2
5
  r: "",
3
6
  c: "",
4
- d: []
7
+ d: [],
8
+ dd: 0,
9
+ re: "",
10
+ ot: EnumOrderType.dining,
11
+ dc: 0,
12
+ ds: 0,
13
+ tt: "HST",
14
+ dt: 0,
15
+ pt: EnumPaymentType.cash,
16
+ ps: EnumPaymentState.NOT_PAID,
17
+ rcp: 0,
18
+ rca: 0,
19
+ fees: [],
20
+ ta: 0
5
21
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "meemup-library",
3
- "version": "1.0.27",
3
+ "version": "1.0.28",
4
4
  "description": "",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",