meemup-library 1.0.20 → 1.0.22
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/lib/controllers/CustomerFacingDisplayPacketController.d.ts +9 -0
- package/lib/controllers/CustomerFacingDisplayPacketController.js +39 -0
- package/lib/interfaces/cfds/ICustomerFacingDisplayPacket.d.ts +7 -0
- package/lib/interfaces/cfds/ICustomerFacingDisplayPacket.js +5 -0
- package/lib/interfaces/cfds/ICustomerFacingDisplaySetting.d.ts +8 -0
- package/lib/interfaces/cfds/ICustomerFacingDisplaySetting.js +7 -0
- package/lib/interfaces/cfds/ICustomerFacingDisplayStore.d.ts +5 -0
- package/lib/interfaces/cfds/ICustomerFacingDisplayStore.js +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import ILocalSetting from "../interfaces/ILocalSetting";
|
|
2
|
+
import ISetting from "../interfaces/ISetting";
|
|
3
|
+
import ICustomerFacingDisplayPacket from "../interfaces/cfds/ICustomerFacingDisplayPacket";
|
|
4
|
+
import IOrder from "../interfaces/order/IOrder";
|
|
5
|
+
declare const _default: {
|
|
6
|
+
code(order: IOrder, setting: ISetting, localSetting: ILocalSetting): ICustomerFacingDisplayPacket;
|
|
7
|
+
decode(data: string): ICustomerFacingDisplayPacket;
|
|
8
|
+
};
|
|
9
|
+
export default _default;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
export default new class CustomerFacingDisplayPacketController {
|
|
2
|
+
code(order, setting, localSetting) {
|
|
3
|
+
let packet = {
|
|
4
|
+
r: localSetting.udpClientName,
|
|
5
|
+
c: setting.currencySymbol,
|
|
6
|
+
d: []
|
|
7
|
+
};
|
|
8
|
+
order.products.forEach(product => {
|
|
9
|
+
let extPro = [];
|
|
10
|
+
product.extras.forEach(ext => {
|
|
11
|
+
extPro.push({
|
|
12
|
+
q: ext.quantity,
|
|
13
|
+
t: ext.text,
|
|
14
|
+
p: ext.totalAmount
|
|
15
|
+
});
|
|
16
|
+
});
|
|
17
|
+
let pro = {
|
|
18
|
+
q: product.quantity,
|
|
19
|
+
t: product.title,
|
|
20
|
+
e: extPro
|
|
21
|
+
};
|
|
22
|
+
packet.d.push(pro);
|
|
23
|
+
});
|
|
24
|
+
return packet;
|
|
25
|
+
}
|
|
26
|
+
decode(data) {
|
|
27
|
+
let packet = {
|
|
28
|
+
r: "",
|
|
29
|
+
c: "",
|
|
30
|
+
d: []
|
|
31
|
+
};
|
|
32
|
+
try {
|
|
33
|
+
return JSON.parse(data);
|
|
34
|
+
}
|
|
35
|
+
catch (e) {
|
|
36
|
+
}
|
|
37
|
+
return packet;
|
|
38
|
+
}
|
|
39
|
+
}();
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|