Class ReceiptGenerator

java.lang.Object
com.avoka.tm.svc.ReceiptGenerator

public class ReceiptGenerator extends Object
Provides a PDF Receipt generate service which supports rendering PDF receipts on demand. This Receipt generate service only supports PhantomJSRenderReceiptService and PuppeteerRenderReceiptService

Examples

The example below illustrates how to generate receipt byte array using the provided parameter data.

 import com.avoka.tm.svc.ReceiptGenerator

 byte[] receiptBytes = new ReceiptGenerator()
                           .setFormCode("formCode")
                           .setFormTemplateVersion("1.0.0")
                           .setSvcName("serviceName")
                           .setSvcVersion("1.0.0")
                           .setXml("xmlData")
                           .generateReceipt() 
Since:
24.10.0
  • Constructor Details

    • ReceiptGenerator

      public ReceiptGenerator()
  • Method Details

    • setFormCode

      public ReceiptGenerator setFormCode(String formCode)
      Set the formCode parameter.
      Parameters:
      formCode - the formCode to render (required)
      Returns:
      the receipt generator service
    • setFormTemplateVersion

      public ReceiptGenerator setFormTemplateVersion(String formTemplateVersion)
      Set the formTemplateVersion
      Parameters:
      formTemplateVersion - the version number of the form to render. If not set, the current version will be resolved
      Returns:
      the receipt generator service
    • setSvcClientCode

      public ReceiptGenerator setSvcClientCode(String svcClientCode)
      Set the receipt service client Code to render.
      Parameters:
      svcClientCode - the client code of the receipt service to render (optional). If not set, will look up for global one
      Returns:
      the receipt generator service
    • setSvcName

      public ReceiptGenerator setSvcName(String svcName)
      Set the receipt service name to render.
      Parameters:
      svcName - the receipt service name to render (required)
      Returns:
      the receipt generator service
    • setSvcVersion

      public ReceiptGenerator setSvcVersion(String svcVersion)
      Set the receipt service version to invoke.
      Parameters:
      svcVersion - the receipt service version number to invoke (required)
      Returns:
      the receipt generator service
    • setXml

      public ReceiptGenerator setXml(String xml)
      Set the xml parameter.
      Parameters:
      xml - the form XML String to render (required)
      Returns:
      the receipt generator service
    • generateReceipt

      public byte[] generateReceipt()
      Generate the PDF based on the provided params and return the PDF byte data.
      Returns:
      the generated PDF data in byte array