Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for custom fields on printed receipts #383

Closed
2 tasks
StefanKert opened this issue Jan 22, 2025 · 1 comment
Closed
2 tasks

Support for custom fields on printed receipts #383

StefanKert opened this issue Jan 22, 2025 · 1 comment

Comments

@StefanKert
Copy link
Member

StefanKert commented Jan 22, 2025

Currently the Epson RT Printer doesn't support custom printed lines sent by the cash register. One of the things that we have added in the Digital Receipt should also be used for the Epson RT Printer to make sure that all receipt artifiacts work end 2 end.

  • Extend RT Printer SCU to be able to interpret ftReceiptCaseData.cbReceiptLines array (check Digital Receipt)
  • KBA for how to send custom fields / documentation?

The current digital receipt logic parses the content like this:

        var receiptLines = new List<string>();
        if (!string.IsNullOrEmpty(request.ftReceiptCaseData))
        {
            try
            {
                using var doc = JsonDocument.Parse(request.ftReceiptCaseData);
                var element = doc.RootElement;
                if (element.TryGetProperty("cbReceiptLines", out var lines))
                {
                    receiptLines = lines.EnumerateArray().Where(x => x.GetString() != null).Select(x => x.GetString()!)?.ToList() ?? new List<string>();
                }
            }
            catch { }
        }

Each row in the field cbReceiptLines contains a single line that should be printed in the footer section of the document. To esnure backwards compatibility we should support both the old format ( string based )

Example:

{
    "ReceiptRequest": {
        ....
        "ftReceiptCaseData": "{\"cbReceiptLines\":[\"Line 1\",\"Line 2\"]}",
        "ftReceiptCase": 4707387510509010945
    },

and also object based

Example:

{
    "ReceiptRequest": {
        ....
        "ftReceiptCaseData": {
                "cbReceiptLines":
                [
                        "Line 1",
                        "Line 2"
                ]
        },
        "ftReceiptCase": 4707387510509010945
    },

Sending this example would result in additional lines on the bottom of the receipt. We will currently only support adding lines to the bottom of the document.

@StefanKert
Copy link
Member Author

Included in main branch. Going to release with v1.3.67

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant