Class ReceiptSvc


  • public class ReceiptSvc
    extends java.lang.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 Summary

      Constructors 
      Constructor Description
      ReceiptSvc()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      byte[] renderReceipt()
      Render the transaction PDF receipt and return the PDF bytes data.
      ReceiptSvc setTxn​(Txn txn)
      Set the transaction parameter.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • 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