meemup-library 1.5.29 → 1.5.30

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.
@@ -30,6 +30,7 @@ declare class _PreviewContentController {
30
30
  standardHtmlContainer(strHtml: string): string;
31
31
  createClosingWorkDay(data: IPointOfSaleApiClosingWorkDay, companyTitle: string): Promise<string>;
32
32
  createCashDrawerReport(device: IPointOfSaleCashDrawer, form: IPointOfSaleCashDrawerReportForm, records: IPointOfSaleCashDrawerReportRecord[], company: string, currency: string, member: IPointOfSaleTeamMember, formatDate: (value: string) => string): Promise<string>;
33
+ createPaymentInfoReceipt(detail: IOrderDetails, template: IPrintTemplate): string;
33
34
  }
34
35
  declare const PreviewContentController: _PreviewContentController;
35
36
  export default PreviewContentController;
@@ -14,6 +14,10 @@ import EnumOrderSummaryPrintPlacementType from "../enums/EnumOrderSummaryPrintPl
14
14
  import { initPointOfSaleTeamMember } from "../interfaces/pos/IPointOfSaleTeamMember";
15
15
  import MoneyController from "./MoneyController";
16
16
  import EnumClosingWorkDaySection from "../enums/EnumClosingWorkDaySection";
17
+ import PhoneController from "./PhoneController";
18
+ import EnumPaymentState from "../enums/EnumPaymentState";
19
+ import dayjs from "../utils/dayjs";
20
+ import { Formats } from "../statics";
17
21
  class _PreviewContentController {
18
22
  constructor() {
19
23
  this.calculatePaperSize = (paper, width) => {
@@ -766,6 +770,34 @@ class _PreviewContentController {
766
770
  return '';
767
771
  });
768
772
  }
773
+ createPaymentInfoReceipt(detail, template) {
774
+ var _a;
775
+ const { font, width, paper, paddingTop, paddingBottom, } = template;
776
+ const fontFamily = (font === "Font A" || font === "Font B") ? "arial" : font;
777
+ let content = `<div style="font-family : ${fontFamily}; font-weight : normal; padding : ${paddingTop}px 0 ${paddingBottom}px 0; width: ${this.calculatePaperSize(paper, width)};"> `;
778
+ content += `<p style="display:block; font-size: ${template.fontSize}px; text-align: center;">${detail.company.title}</p>`;
779
+ content += `<p style="display:block; font-size: ${template.fontSize}px; text-align: center;">${detail.company.address}</p>`;
780
+ content += `<p style="display:block; font-size: ${template.fontSize}px; text-align: center;">${PhoneController.toDisplay(detail.company.phone)}</p>`;
781
+ content += `<p style="display:block; font-size: ${template.fontSize}px; text-align: left; margin-top:24px;">Payment type and status:</p>`;
782
+ const total = MoneyController.format(detail.order.totalAmount, detail.company.currencySymbol);
783
+ const afterTotal = detail.order.paymentState === EnumPaymentState.Paid ? "PAID" : "NOT PAID";
784
+ content += `<p style="display:block; font-size: ${template.fontSize * 2}px; text-align: left; margin-bottom:24px;">${total + ", " + afterTotal}</p>`;
785
+ content += `<p style="display:block; font-size: ${template.fontSize}px; text-align: left;">Reg. date ${dayjs(detail.order.registrationDate).format(Formats.displayDateTime)}</p>`;
786
+ content += `<p style="display:block; font-size: ${template.fontSize}px; text-align: left;">Order REF:${detail.order.id} , #${detail.order.orderNumber}</p>`;
787
+ content += `<div style="display:flex; flex-direction : row; justify-content: space-between; align-items :center; ">
788
+ <p style="font-size: ${template.fontSize * 2}px; text-align: left;">Total, ${afterTotal}</p>
789
+ <p style="font-size: ${template.fontSize * 2}px; text-align: right;">${total}</p>
790
+ </div>`;
791
+ content += `<div style="display:flex; flex-direction : row; justify-content:center; align-items:center; gap : 8px; margin-top:24px; margin-bottom: 24px;">
792
+ <div style="border-top:1px solid black; flex:1;"></div>
793
+ <p style="font-size: ${template.fontSize * 2}px; text-align: right;">${(_a = detail.paymentInfo) === null || _a === void 0 ? void 0 : _a.state}</p>
794
+ <div style="border-top:1px solid black; flex:1;"></div>
795
+ </div>`;
796
+ content += SimplePreviewController.printMetaData(template, detail);
797
+ content += SimplePreviewController.printFooter(template, detail);
798
+ content += `</div>`;
799
+ return (`<div style="display: flex;"><div style="width : auto;">${content}</div></div>`);
800
+ }
769
801
  }
770
802
  const PreviewContentController = new _PreviewContentController();
771
803
  export default PreviewContentController;
@@ -497,7 +497,7 @@ class SimplePreviewController {
497
497
  }
498
498
  printMetaData(template, detail) {
499
499
  var _a, _b, _c;
500
- if (detail.paymentInfo !== null && detail.order.paymentType === EnumPaymentType.StripeTerminal && Array.isArray((_a = detail.paymentInfo) === null || _a === void 0 ? void 0 : _a.metadata) && ((_c = (_b = detail.paymentInfo) === null || _b === void 0 ? void 0 : _b.metadata) === null || _c === void 0 ? void 0 : _c.length) > 0) {
500
+ if (detail.paymentInfo !== null && Array.isArray((_a = detail.paymentInfo) === null || _a === void 0 ? void 0 : _a.metadata) && ((_c = (_b = detail.paymentInfo) === null || _b === void 0 ? void 0 : _b.metadata) === null || _c === void 0 ? void 0 : _c.length) > 0) {
501
501
  let content = this.createDivContainer(template);
502
502
  content += this.printSolidLine();
503
503
  detail.paymentInfo.metadata.forEach(item => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "meemup-library",
3
- "version": "1.5.29",
3
+ "version": "1.5.30",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -11,7 +11,7 @@
11
11
  "remove:one": "rimraf dist",
12
12
  "remove:two": "rimraf ./src/dist",
13
13
  "test": "echo \"Error: no test specified\" && exit 1",
14
- "commit": "git add . && git commit -m \"version.1.5.29\" && git push origin "
14
+ "commit": "git add . && git commit -m \"version.1.5.30\" && git push origin "
15
15
  },
16
16
  "files": [
17
17
  "/dist"
@@ -26,4 +26,4 @@
26
26
  "dependencies": {
27
27
  "dayjs": "^1.11.13"
28
28
  }
29
- }
29
+ }