Class ReceiptSvc


  • public class ReceiptSvc
    extends Object
    Provides a PDF Receipt service which supports rendering PDF receipts on demand.

    Examples

    The example below ensures the form PDF receipt has been generated.

     import com.avoka.tm.query.*
     import com.avoka.tm.svc.*
     import com.avoka.tm.vo.*
    
     // Get the transaction object
     Txn txn = ...
    
     // Ensure PDF receipt has been rendered
     new ReceiptSvc()
         .setTxn(txn)
         .renderReceipt()
    
     // Re-query Txn and fetch PDF receipt data
     txn = new TxnQuery()
         .setTxn(txn)
         .withReceiptPdf()
         .firstValue()
    
     byte[] receiptPdf = txn.receiptPdf
     
    Since:
    5.0.1
    • Constructor Detail

      • ReceiptSvc

        public ReceiptSvc()
    • Method Detail

      • setTxn

        public ReceiptSvc setTxn​(Txn txn)
        Set the transaction parameter.
        Parameters:
        txn - the transaction to set
        Returns:
        the receipt service
      • renderReceipt

        public byte[] renderReceipt()
        Render the transaction PDF receipt and return the PDF bytes data.
        Returns:
        the rendered PDF data