• 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

Transaction History Publisher

The Transaction History Publisher is used to publish transaction history data to customer's data warehouse.

The result list of ids should contain published records primary keys.

This service is configured via the Form Details tab under the Tracking Code section.

Service Invoke Parameters

Parameter Description Nullable
svcDef the service definition value object, see SvcDef no
rows the rows data as List no

Script Result

The script should return a list of numbers which are published.

Error Handling

If an error occurs invoking your Transaction History Publisher script the error will be logged in the Journey Manager database error log, the user will be redirected to the error page on the form space. The transaction will be rolled back, and no transaction record will be created.

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 com.jcraft.jsch.*

class FluentTransactionHistoryPublisher {

    /*
     * Perform a transaction history publishing
     *
     * return: list of the published transactions' primary keys.  
     */
    List<number> invoke(SvcDef svcDef, List<map>> rows) {
    
        /* // JCraft SFTP Upload Example
        ChannelSftp channelSftp
        Session session
        try {
            String username = svcDef.svcConn.username
            String password = svcDef.svcConn.password
            String endpoint = svcDef.svcConn.endpoint
        
            JSch jsch = new JSch()
            session = jsch.getSession(username, endpoint, 22)
            session.setPassword(password)
            
            Properties config = new Properties()
            config.put("StrictHostKeyChecking", "no")
            session.setConfig(config)
            session.connect()
            Channel channel = session.openChannel("sftp")
            channel.connect()
            channelSftp = (ChannelSftp) channel
            
            // TODO: write the rows in local 'myfile.data' file and then upload            
            channelSftp.put('/local/storage/myfile.data', '/remote/myfile.data')
  
        } finally {
            channelSftp?.disconnect()
            session?.disconnect()
        }
        */
       
        //Fill and return rows' ids
        final List<number> result = new ArrayList&lt;>()
        for (Map<string object> row: rows) {
            result.add(Long.parseLong(row.get('transaction_history_oid').toString()))
        }
        return result
    }
}

Unit Test Template

This section shows unit test template Groovy script.

import com.avoka.core.groovy.GroovyLogger as logger
import com.avoka.tm.svc.*
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 testTxnHistoryPublisher() throws Exception {
    
        //TODO fill some rows data
        List<map>> rows = new ArrayList&lt;>() 

        Map params = [
            "svcDef": svcDef,
            "rows": rows
        ]

        List<number> ids = (List<number>) new ServiceInvoker(svcDef).invoke(params)

        logger.info "Published ids.size: " + ids.size()

        // Test any business logic performed
        assert ids != null        
    }
}
← SSO Authentication ProviderVirus Scan →

Terms & Conditions

Privacy Policy

Cookie Policy

Copyright © 2003-2022 Temenos Headquarters SA