• 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

Delivery Process

The Delivery Process service is used to deliver data associated with a completed submission, including submitted form XML, file attachments and the PDF receipt document to external systems.

Service Invoke Parameters

Parameter Description Nullable
svcDef the service definition value object, see SvcDef no
txn the transaction record value object, see Txn no

Error Handling

Submission delivery is performed asynchronously by a background job. If a delivery process error occurs the end user will never see this error.

If an exception is thrown by the Delivery Process, the SubmissionDeliveryController will make the submission delivery status Error and will log the error in the Journey Manager database error log.

Please note the SubmissionDeliveryController will rollback the current delivery transaction if an unhandled error is thrown by the Delivery Process. Any Journey Manager database changed performed by the Groovy Script will be rolled back with the transaction, including any delivery checkpoint changes.

If the Service Definition is configured to perform a number of automatic retry attempts, then the submission will be scheduled to retry delivery after the configured period of time.

Service Template

This section shows service template Groovy script.

import com.avoka.tm.util.*
import com.avoka.tm.vo.*

class FluentDeliveryProcess {

    // Injected at runtime 
    public Logger logger

    /*
     * Perform Transaction Delivery Process
     *
     * returns: null if completed or DeliveryResult objet
     */
    DeliveryResult invoke(SvcDef svcDef, Txn txn) {

        try {
            // TODO: perform delivery work

            return new DeliveryResultBuilder()
                .setStatus(Txn.DELIVERY_COMPLETED)
                .build()

        } catch (Exception e) {
            return new DeliveryResultBuilder()
                .setMaxDeliveryAttempts(5)
                .setMessage(e)
                .setNextDeliveryMins(30)
                .setStatus(Txn.DELIVERY_ERROR)
                .build()
        }
    }
}}

Unit Test Template

This section shows unit test template Groovy script.

import com.avoka.tm.svc.*
import com.avoka.tm.test.*
import com.avoka.tm.util.*
import com.avoka.tm.vo.*
import org.junit.*

class UnitTest extends AbstractJUnitTest {

    // Injected at runtime 
    public static Logger logger

    /*
     * Perform service unit test
     *
     * throws: exception if unit test fails
     */
    @Test
    void testDeliveryCompleted() throws Exception {

        String xmlData = testParams['Test XML Data']
        Txn txn = new MockVoBuilder().createTxnDeliveryReadyWithXml(xmlData)
        
        Map params = [
            "svcDef": svcDef,
            "txn": txn
        ]

        DeliveryResult result = (DeliveryResult) new ServiceInvoker(svcDef).invoke(params)

        // Check result
        logger.info result

        assert result.status == Txn.DELIVERY_COMPLETED 
    }
} 
← Render Receipt ServiceTask Expiry Process →

Terms & Conditions

Privacy Policy

Cookie Policy

Copyright © 2003-2022 Temenos Headquarters SA