Class ReceiptDataService


  • public class ReceiptDataService
    extends CayenneService
    Provides receipt data handling services.
    • Constructor Detail

      • ReceiptDataService

        public ReceiptDataService()
    • Method Detail

      • hasReceiptXml

        public boolean hasReceiptXml​(Submission submission)
        Returns whether a submission has receipt data Note: If a submission has been deleted, this will return false. If a submission has no receipt data but does have submission data, the receipt data can be generated from the form data.
        Parameters:
        submission - the submission
        Returns:
        whether receipt data is available for the submission
      • getReceiptXml

        public String getReceiptXml​(Submission submission)
                             throws ApplicationException
        Returns the receipt xml data for a submission If a submission has no receipt data but does have submission data, the receipt data will be generated from the form data. If receipt data has to be generated from form data, this method stores and commits the receipt data.
        Parameters:
        submission - the submission
        Returns:
        whether receipt data is available for the submission
        Throws:
        ApplicationException - if the submission is deleted or has neither submission nor receipt data
      • setPaymentReceiptDetails

        public void setPaymentReceiptDetails​(Submission submission,
                                             String receiptNo,
                                             Date paymentDate)
        Allows to set the receipt number and payment date to be written in to the Receipt section The Receipt section is looked up using the schema config map for the submission's form deploy Note that this method does NOT commit the changes, it merely writes them into the submission's receipt data.
        Parameters:
        submission - the submission
        receiptNo - the receipt number to be used
        paymentDate - the date and time of payment
      • clearPaymentReceiptDetails

        public String clearPaymentReceiptDetails​(Submission submission,
                                                 String receiptXml)
        Clears out payment information stored in the receipt data, then stores the updated receipt XML.
        Parameters:
        submission - the submission (required, payment status must not be "Completed")
        receiptXml - the receipt XML (optional; will be retrieved via the submission data storage service if not specified)
        Returns:
        the updated receipt XML
        Since:
        4.1.2
      • getReceiptPdf

        public byte[] getReceiptPdf​(Submission submission,
                                    String mode)
        Get receipt pdf as byte array.
        Parameters:
        submission - the submission
        mode - the render receipt mode RequestLog.RECEIPT_MODES
        Returns:
        the byte array for the receipt pdf
      • getReceiptXPath

        protected String getReceiptXPath​(Submission submission)
        Return the Receipt XPath for the given submission
        Parameters:
        submission - the submission
        Returns:
        the form receipt XPath, if available