Package com.avoka.tm.svc
Class ReceiptSvc
- java.lang.Object
-
- com.avoka.tm.svc.ReceiptSvc
-
public class ReceiptSvc extends Object
Provides a PDF Receipt service which supports rendering PDF receipts on demand. Furthermore, a receipt could be rendered in various modes (deliver, email or web) by specific receipt render service.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.receiptPdfThe example render Web mode PDF receipt with specific service by txn, service name and service version. Note service should be with the same client as the txn.
import com.avoka.tm.query.* import com.avoka.tm.svc.* import com.avoka.tm.vo.* // Get the transaction object Txn txn = ... // Render receipt with that service byte[] receiptPdf = new ReceiptSvc() .setTxn(txn) .setSvcName('My Receipt Render Service Name') .setSvcVersion('1.2.3') .setReceiptMode(ReceiptMode.WEB) .renderReceipt()- Since:
- 5.0.1
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classReceiptSvc.ReceiptModeReceipt mode enum.
-
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.ReceiptSvcsetReceiptMode(ReceiptSvc.ReceiptMode receiptMode)Set the receipt mode (default is DELIVERY).ReceiptSvcsetSvcName(String srvName)Set the receipt service definition name to render.ReceiptSvcsetSvcVersion(String svcVersion)Set the receipt service definition version to invoke.ReceiptSvcsetTxn(Txn txn)Set the transaction parameter.
-
-
-
Method Detail
-
setTxn
public ReceiptSvc setTxn(Txn txn)
Set the transaction parameter.- Parameters:
txn- the transaction to set (required)- Returns:
- the receipt service
-
setSvcName
public ReceiptSvc setSvcName(String srvName)
Set the receipt service definition name to render.- Parameters:
srvName- the receipt service definition name to render- Returns:
- the receipt service
- Since:
- 19.11.0
-
setSvcVersion
public ReceiptSvc setSvcVersion(String svcVersion)
Set the receipt service definition version to invoke. If not specified, then the current one will be used- Parameters:
svcVersion- receipt service definition version number to invoke- Returns:
- the receipt service
- Since:
- 19.11.0
-
setReceiptMode
public ReceiptSvc setReceiptMode(ReceiptSvc.ReceiptMode receiptMode)
Set the receipt mode (default is DELIVERY).- Parameters:
receiptMode- the receipt mode- Returns:
- the receipt service
- Since:
- 19.11.0
-
renderReceipt
public byte[] renderReceipt()
Render the transaction PDF receipt and return the PDF bytes data.- Returns:
- the rendered PDF data
-
-