1
0
-1

Want to add additional payment information into the submission xml after payments have been completed, and before the submission xml is delivered.

What would be the best approach?

    CommentAdd your comment...

    1 answer

    1.  
      2
      1
      0

      Hi Mike, This can be done in the TM Submission Completed Processor service which is always called after a successful payment is processed or when no payment was actually required at all, before delivery. Keep in mind the Submission Completed processor might be called in the form submission user thread when no payment is required so handle any exceptions and errors properly.

      helpful API:

      def xmlDoc = new XmlDoc(submissionXml);

      def paymentLog = DaoFactory.getPaymentLogDao().getLatestPaymentLog(submission)

      xmlDoc.setText('/AvokaSmartForm/YourXPathToWhereToStoreTheReceiptNumber', paymentLog.getDrReceiptNo()  )

       

      // reset PDF receipt just in case it was generated in the meantime (shouldnt be?)
      submission.setReceiptStatus(Submission.STATUS_Ready);
      submission.setReceiptRenderDuration(null);
      submission.setReceiptRenderTime(null);
      submission.getSubmissionData().setReceiptData(null);

      ServiceFactory.getSubmissionDataService().setSubmissionXmlData( submission, XmlUtils.toString(xmlDoc.getDocument()), request);

       

      the code is an extract from an earlier TM version so the API support might be a bit different(better) in the latest TM versions.

      Miro

        CommentAdd your comment...