User Experience
R24 AMR | Min(s) read

Supporting Python Script

Banks can extend the Transact Explorer’s API framework (tb-server API) to customise the validations that allow them to define Python hooks rather than changing the core framework. The customised Python hooks are part of the initial configuration process, which are stored separately from core changes. That is, once configured, the user cannot change any information during execution.

The Python method definitions are predefined as pre-process and post-process, which allows you to invoke customized validations before and after the request processing in Temenos Transact.

It is not mandatory to have both pre() and post() methods in the Python script. It can be either or both methods.

Configuring Deployment Environment

To configure the deployment environment, you need to configure the generic config microservice.

Configuring Environment variables

To enable the Python script validation, you should set the below properties in environment variable as shown below:

  • -Dtemn.config.service.base.pathurl= http://localhost:7006/ms-genericconfig-api/api/
  • -Dextension.script.home=C:\temp\extension

Sample screenshot with the properties is shown below.

You should map every resource to operation id, which must be mapped with a Python script to invoke Python script validation. The existing UXPB mapping and its script files can be used as such in Transact Explorer.

Ensure all the servers (tb-server, Config Micro-service) are running.

Defining and Storing Script in System Path

You can place the extension Python scripts in any local system directory. You can use the below system property to configure the absolute path.

-Dextension.script.home= ”C:\temp\extension”
This option is used only if the configuration microservice is not available.

Sample screenshot with the property is shown below.

Configuring Module Dependency

Validate the Python by verifying the presence of server module dependency configurations.

To perform the validation,

  1. Verify the availability of the jar files under the Validation module.

  2. Check the updated module.xml file for the relevant file name.

  3. Ensure that the Validation module is available in the JBoss standalone-utp.xml file.

Python Script In and Out Parameters

To perform validation on request or response payload in Python scripts, the IN and OUT parameters are constructed at runtime and sent as HashMap Objects.

UXPB scripts works in TE without any modification.

IN Parameters

Parameter Description
jsonData Request or Response of the processing record in JSON format.
userId User ID or SignOn name of the logged in user.
companyId The company ID of the logged in user.
userRole The role of the logged in user.
Authorization If IDP is configured, indicates the JWT token, else indicates the OsToken of the user’s session.
tbServerUrl The base tb-server URL.
resource The current resource to which the extension is attached.
operationId The operation ID of the current resource.
domainId Unique ID of the domain (uxpb or te). Defaults to ‘uxpb’ if the operation ID ends with Uxpb, else defaults to ‘te’.
pythonScriptName The python script file name.
recordId The transaction ID of the processing record.

OUT Parameters

Parameter Description
Python Response

The Python response contains the below components:

  • jsonData - Indicates the validated or updated JSON body from the Python script.
  • responseCode (Mandatory) - Indicates the response. Set to 0 for successful response and -1 for failure response.
  • status – Indicates the status of python processing. Set to 200 for successful response and 400 for failure response.
  • failureMessage - Indicates the failure message (array list) from python script during error case in the description of failureMessage.
Custom TE Python scripts should declare a global variable named 'disable_conversion' and set the value as 'true' to bypass the conversions that occur for UXPB scripts.

Below is the sample script file:

Invoking REST API from Python Script

You can use Python native Requests module when you need to call API from the Python script. This option allows you to avail all the functional features with respect to Queryparams, special character URLs, different content types, URL encoding, and decoding cases.

Configuring Python through Workbench UUX

The Workbench UUX serves as the UI for configuring Python extensions for TE within GCMS. There have been no alterations to the Workbench UI with respect to TE. Same UX resource extension that supports UXPB is used for TE. You can access the options within the Workbench for configuring Python files and their respective mappings accordingly.

Configuring Python Scripts

Configuring Resource Extension

Below is the sample execution.

Enquiry -ENQ CUSTOMER

Sample Script -CustomerEnq.py

Configuring Resource Extension

Script execution in TE

Script execution in UXPB

Copyright © 2020- Temenos Headquarters SA

Published on :
Monday, May 27, 2024 2:04:45 PM IST