• Platform
    • Manager
    • Maestro
    • Exchange
    • Workspaces
    • Analytics
    • Springboard
    • API
Transact Services Guide (TSG)

Transact Services Guide (TSG)

  • Getting Started
  • Groovy Guide
  • Service Development
  • Groovy Services API
  • REST API

›Groovy Services API

Getting Started

  • Introduction

Groovy Guide

  • Groovy Guide
  • Groovy Declarations
  • Control Statements

Service Development

  • Service Development
  • Transaction Processing Sequence
  • Service Logging
  • Remote Service Calls
  • Fluent Security Configuration
  • Third-party Libraries

Groovy Services API

  • Groovy Services API
  • Fluent Function
  • Delivery Function
  • Form Version Selector
  • Form Security Filter
  • Form Prefill
  • Tracking Number
  • Form Dynamic Data
  • Submission Preprocessor
  • Receipt Number
  • Form Saved Processor
  • Submission Data Validator
  • Submission Completed Processor
  • Render Receipt Service
  • Delivery Process
  • Task Expiry Process
  • Email Service
  • Job Action
  • Scheduled Service
  • Groovy Service
  • SSO Revalidation
  • SSO Get Authentication Token
  • SSO Authentication OK Response
  • SSO Authentication Provider
  • Transaction History Publisher
  • Virus Scan

REST API

  • REST API
  • REST Application Package API
  • REST Delivery API
  • REST Form Groups API
  • REST Groovy Service Invoke v2
  • REST Service Definitions API
  • REST Tasks API
  • REST TestCenter API
  • REST TPac API
  • REST Transactions API
  • REST Transaction History API

Workspaces API

  • Workspaces API
  • Filters
  • Sort
  • Workspaces Category API
  • Workspaces Current User API
  • Workspaces Extract Name API
  • Workspaces Form API
  • Workspaces Group API
  • Workspaces Job API
  • Workspaces Org API
  • Workspaces Property Name API
  • Workspaces Space API
  • Workspaces Txn API
  • Workspaces User API

Submission Data Validator

The Submission Data Validator is called when a completed form is submitted. This service can be used to verify that the submitted XML is valid and not an attempted fraudulent transaction.

A Submission Data Validator service may perform business rules validation on the server using Groovy Script interrogating the submitted XML. If the service finds validation errors it can return a list of validation errors which will then be stored against the transaction, and is visible using the 'Validation Errors' tab. If the service returns one or more validation error strings, then the transaction will have its Data Validation status set to 'Error'.

Data Valiation Error

Transactions with a Error data validation status will not be delivered using the normal delivery channel. If a Form Validation Delivery Channel is defined then the transaction will be delivered using this channel, otherwise it will be marked as Undeliverable and made ready for submission data purging.

Form Data Valiation Delivery

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

import com.avoka.core.groovy.GroovyLogger as logger
import com.avoka.tm.svc.*
import com.avoka.tm.vo.*
import javax.servlet.http.*

class FluentSubmissionDataValidator {

    /*
     * Perform submission data validator service
     *
     * return: list of data validation error messages
     */
    List<string> invoke(SvcDef svcDef, Txn txn, HttpServletRequest request, User user) {

        // TODO: perform validation logic, return any data validation errors in error list
        List errors = new ArrayList<string>()

        return errors
    }
} 

Unit Test Template

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 testStatusSubmitted() throws Exception {

        String xmlData = testParams['Test XML Data']
        Txn txn = new MockVoBuilder().createTxnSubmittedWithXml(xmlData)
        MockRequest request = new MockRequest()

        Map params = [
            "svcDef": svcDef,
            "txn": txn,
            "request": request,
            "user": null
        ]

        List errors = (List) new ServiceInvoker(svcDef).invoke(params)

        txn = new TxnQuery()
            .setId(txn.id)
            .withPropertyMap()
            .firstValue()

        logger.info txn

        // Test any business logic performed
        assert txn.formStatus == Txn.FORM_SUBMITTED

        assert errors.size() == 0
    }
}
← Form Saved ProcessorSubmission Completed Processor →

Terms & Conditions

Privacy Policy

Cookie Policy

Copyright © 2003-2022 Temenos Headquarters SA