ReceiptSettings Object



 
The ReceiptSettings Object provides configuration values for payment receipts.


Members Table

    The following table lists the members provided by the ReceiptSettings object.

    Members
    Properties Description
    Condition When the receipt should be send.
    IsEnabled Whether receipts are enabled.
    PrinterName Receives the receipt printers name.
    TemplateText Receives the template text with variables.
    Type Gets the receipt type.

Remarks
    None.
Examples
    The following example illustrates how to handle simple receipt printing and mailing.

    <SCRIPT TYPE="text/javascript">
    window.external.InitScriptInterface();
    SiteCash = SiteKiosk.Plugins("SiteCash");
    
    ONINPAYMENT = 1;
    ONSESSIONEND = 2;
    
    PRINT = 1;
    SEND_EMAIL = 2;
    
    if (SiteCash.ReceiptSettings.IsEnabled)
    {
        switch (SiteCash.ReceiptSettings.Condition)
        {
            case ONINPAYMENT:
                SiteCash.OnInpayment = OfferReceipt;
                break;
            case ONSESSIONEND:
                SiteCash.OnSessionEnd = OfferReceipt;
                break;
        }
    }
    
    function OfferReceipt()
    {
        var text = SiteCash.Macromap.Expand(
            SiteCash.ReceiptSettings.TemplateText);
    
        switch (SiteCash.ReceiptSettings.Type)
        {
            case PRINT:
                if (confirm("Do you want to print a receipt?"))
                {
                    var printer = SiteKiosk.Printer.FindPrinter(
                        SiteCash.ReceiptSettings.PrinterName);
                    if (printer)
                    {
                        printer.PrintDocument("Arial", 80, text,
                            "", "", false);
                    }
                }
                break;
            case SEND_EMAIL:
                if (confirm("Do you want to send a email receipt?"))
                {
                    var email = SiteKiosk.Email.CreateJob(true);
                    email.PlainBody = text;
                    email.AddRecipient("someone@examle.com");
                    email.Send();
                }
                break;
        }
    }
    </SCRIPT>
    

Applies to
    SiteKiosk v7.2 (and later versions).

Back to top