Submission Completed Processor
The Submission Completed Processor is called immediately after a form submission has progressed to form status 'Completed'. This could occur immediately after submission, or later when the user completes attachments or payment steps.
Service Invoke Parameters
Parameter | Description | Nullable |
---|---|---|
svcDef | the service definition value object, see SvcDef | no |
txn | the transaction record value object, see Txn | no |
request | the servlet HttpServletRequest | yes |
user | the authenticated user, see User | yes |
Error Handling
If an error occurs the system will catch the error and log the error to the Journey Manager database error log. The user should not be aware that any error has occurred.
Please note any changes made by the service made to the database will be persisted with the transaction, and it will be up to the service to undo any changes it has made.
Service Template
This section shows service template Groovy script.
import com.avoka.core.groovy.GroovyLogger as logger
import com.avoka.tm.svc.*
import com.avoka.tm.vo.*
import javax.servlet.http.*
class FluentSubmissionCompletedProcessor {
/**
* Perform submission completed processor service
*/
void invoke(SvcDef svcDef, Txn txn, HttpServletRequest request, User user) {
// TODO: perform business logic
new TxnUpdater(txn)
.setProperty("IDV-Status", "Completed")
.update()
new EventLogger()
.setMessage("User '" + user.loginName + "' completed Identity Verification")
.setRequest(request)
.setTxn(txn)
.logInfo()
}
}
Unit Test Template
This section shows unit test template Groovy script.
import com.avoka.core.groovy.GroovyLogger as logger
import com.avoka.tm.query.*
import com.avoka.tm.svc.*
import com.avoka.tm.test.*
import com.avoka.tm.util.*
import com.avoka.tm.vo.*
import org.junit.Test
class UnitTest extends AbstractJUnitTest {
/*
* Perform service unit test
*
* throws exception if unit test fails
*/
@Test
void testStatusCompleted() throws Exception {
String xmlData = testParams['Test XML Data']
Txn txn = new MockVoBuilder().createTxnCompletedWithXml(xmlData)
MockRequest request = new MockRequest()
User user = new MockVoBuilder().createUserLocal()
Map params = [
"svcDef": svcDef,
"txn": txn,
"request": request,
"user": user
]
new ServiceInvoker(svcDef).invoke(params)
txn = new TxnQuery()
.setId(txn.id)
.withPropertyMap()
.firstValue()
logger.info txn
assert txn.formStatus == Txn.FORM_COMPLETED
assert txn.propertyMap["IDV-Status"] == 'Completed'
}
}