API Development
API Development
An API defined in Swagger 2.0 is imported into an API project. Import process will create the Camel routes, mock responses and wire the routes to the mock
responses. This is done using a Maven plugin, either from your IDE or from the command line.
Getting Started
The table below describes the technical terminologies used in the solution.
Terms Description
Apache Camel Apache Camel is an open source framework for message-oriented middleware
with a rule-based routing and mediation engine that provides a Java object-
based implementation of the Enterprise Integration Patterns using an
application programming interface (or declarative Java domain-specific
language) to configure routing and mediation rules.
Archetype It is defined as an original pattern or model from which all other things of the
same kind are made.
Maven Maven is a build automation tool used primarily for Java projects.
Inventory It is a file that provides the information of an API in core banking terms. It helps
in creating the service implementation by generating swagger specification of
an API.
Creation of Artefacts in T24- This section explains how data is retrieved from T24 system and provided to IRIS to expose to external requests. This in turn
reduces the data loads being retrieved and simplifies the whole process. Also, it can be referred as filtering of T24 data by T24 being expose to the
external request.
Creation of Service Project- It contains the default directories and set of model data. It basically acts as a platform where developers can build and run
the required APIs. It also contains a set of archetypes which gives developers options of creating desired APIs.
Creation of Provider API- Provider APIs expose core banking capabilities as RESTful APIs. The key concept is that each Provider API is driven from an
inventory that defines the contents of the API in core banking terms. The inventory is used to create the Swagger specification of the API. Together, the
inventory file and the generated swagger specification are used to create the service implementation.
Creation of Published API- Publisher APIs provide the following REST resources:
Login
Logout
Add API, Update API, Remove API, Copy an API
Validation roles
Note: When you access any API other than the login and logout APIs through an external REST client, first invoke the login API to ensure that user is
authenticated. When the login API is invoked, the system stores the generated session cookie in a file, which we use in the next API invocations.
Workbench Installation
Workbench binaries are available as irf-web-client-release.zip bundle T24 Binaries available in the T24 Installation.
1. Copy the content “web-client folder” available in T24 Binaries under com\temenos\irf\irf-test-webclient\xxxx.x.x .
2. Extract the content of “web client” folder bundle into <Apache HTTP Server Installation Home >\htdocs folder.
Note: If you have existing artefacts, then you can skip this step and navigate to Create Service Project step.
In order for T24 Version and Enquiry artefacts to be used in the Interaction Framework, certain rules must be followed. These rules provide a simple and effective
governance framework that
ID Naming Convention
For Enquiry, the following ID naming convention must be followed:
Description
Each Enquiry and Version must have a description. For Enquiry, this is the DESCRIPT field, for Version the DESCRIPTION field is used.
Restrictions on Enquiry
Header fields should not be used in API enquiries.
Click here to know how the T24 enquiry definition affects the JSON response.
Note: If there is an existing Service Project, you can skip Create Service Project step and navigate to Provider API step.
-DarchetypeVersion=1.0 -DarchetypeCatalog=local
Supply values for various arguments, either interactively or as parameters from the command line:
Define value for property 'version' 1.0-SNAPSHOT: :
Define value for property 'package' com.temenos.training.irf::
groupId: com.temenos.training.irf
artifactId: training-api
version: 1.0-SNAPSHOT
package: com.temenos.training.irf
As a single command:
-DarchetypeVersion=1.0 -DartifactId=training-api
Using Eclipse
From the File menu, select File > New > Maven Project
Select archetype
Select the irf-service-archetype option from Artifact Id column and click the Next button.
http://localhost:8080/api/v1.0.0/meta/apis
Where a T24 ENQUIRY is selected, the URL parameters need to be mapped to the ENQUIRY selection fields.
A selection field can be mapped from mulitple URL query or path parameters. In the above example, fromDate and toDate are both mapped to the valueDate
selection field.
Click Next in the top right fo the screen to review the provider API
Step 5 - Review
The inventory file can be copied directly from the Inventory pane and pasted into an IDE. Or if preferred click Finish to create a zip file file containing the swager
spec, Camel routes, mappings and mock responses.
The result provides a link to download a zip file containing the swager spec, Camel routes, mappings and mock responses.
Step 7 Importing generated Artifacts
Extract the content of downloaded zip into <service-provider> project/ resources folder.
Project Structure
You can create the service container using the supplied Maven Archetype, either from your IDE or from the command line.
-DarchetypeVersion=1.0
Supply values for various arguments, either interactively or as parameters from the command line:
Define value for property 'version' 1.0-SNAPSHOT: :
Define value for property 'package' com.temenos.training.irf::
groupId: com.temenos.training.irf
artifactId: training-container
version: 1.0.0-SNAPSHOT
package: com.temenos.training.irf
As a single command:
-DarchetypeVersion=1.0 -DartifactId=training-container
Using Eclipse
From the File menu, select File > New > Maven Project
mvn jetty:run
In Eclipse, right click the project and select Run As > Maven Build
Where a T24 ENQUIRY is selected, the URL parameters need to be mapped to the ENQUIRY selection fields.
A selection field can be mapped from mulitple URL query or path parameters. In the above example, fromDate and toDate are both mapped to the valueDate
selection field.
Click Next in the top right of the screen to review the Provider API.
Step 4 – Review
Note: The inventory file can be copied directly from the Inventory pane and pasted into an IDE or if preferred click Finish to create a zip file containing
the swagger spec, Camel routes, mappings and mock responses.
Click here to know how to create a zip file containing the swagger spec, Camel routes, mappings and mock responses.
-DarchetypeVersion=1.0 -DarchetypeCatalog=local
Supply values for various arguments, either interactively or as parameters from the command line:
Define value for property 'version' 1.0-SNAPSHOT: :
Define value for property 'package' com.temenos.training.irf::
groupId: com.temenos.training.irf
artifactId: training-api
version: 1.0-SNAPSHOT
package: com.temenos.training.irf
As a single command:
-DarchetypeVersion=1.0 -DartifactId=training-api
Using Eclipse
From the File menu, select File > New > Maven Project
Select archetype
Select the irf-service-archetype option from Artifact Id column and click the Next button.
Project Structure
You should see a project created with the following structure:
The result provides a link to download a zip file containing the swagger spec, Camel routes, mappings and mock responses.
NB There are several dependencies tags in the pom.xml file - this dependency needs to be added to the MAIN dependency, below the comment:
<dependency>
<groupId>com.temenos.training</groupId>
<artifactId>provider-accounts</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency>
The service container should restart automatically, if not stop the server and restart manually.
Check Deployment
Use Postman to make a GET request to the management service
localhost:8080/api/v1.0.0/meta/apis
"header": {
"serviceCount": 9,
"audit": {
"processTime": 9
}
},
"body": [
{
"endPoints": [
{
},
{
}
]
},
{
"endPoints": [
{
}
]
},
Service configuration
Define the Service Definition parameters for "New Arrangement creation" for a commercial loan product.
Select the "LENDING" under the "Available artifact" section and add it
Download the Generated Artifacts
Click Next and click Finish.
Group Id : com.temenos.irf.training.aalending
Artifact id : provider-smallbusinessloan-service
Click Finish.
<dependency>
<groupId>com.temenos.irf.training.aalending</groupId>
<artifactId>provider-smallbusinessloan-service</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency>
{
"header": {
},
"body": {
"customerId": "100100",
"currency": "USD",
"commitment" : {
"amount": "7000",
"term": "1Y"
}
}
}
Select archetype
Fill in the Group Id, Artifact Id and Version fields, and click Finish.
Project Structure
Give your service a name in the next screen and click Upload & Generate
Download and extract the zip and place the generated files in the service project
Project Structure
Refresh the project view and verify the project structure:
...
<to uri="direct:published.PublishedPaymentStatusReport"/>
</get>
</rest>
...
<route id="direct.published.PublishedPaymentStatusReport">
<from uri="direct:published.PublishedPaymentStatusReport"/>
<process ref="FTStatusReportResponseMapper"/>
</route>
Note: Use "direct-vm" component to map all the publisher path params to provider path params. This will enable it to look through all the
CamelContexts present in the same JVM and route to the underlying provider API.
Save all the files, and build the publisher api project as Maven > Install.
...
<bean id="FTInitiationRequestMapper"
class="com.temenos.irf.published_FT_api.FTInitiationRequestProcessor"/>
<bean id="FTInitiationResponseMapper"
class="com.temenos.irf.published_FT_api.FTInitiationResponseProcessor"/>
<bean id="FTStatusReportResponseMapper"
class="com.temenos.irf.published_FT_api.FTStatusReportResponseProcessor"/>
<bean id="FTSubmissionResponseMapper"
class="com.temenos.irf.published_FT_api.FTSubmissionResponseProcessor"/>
...
...
<to uri="direct:published.PublishedPaymentStatusReport"/>
</get>
...
<route id="direct.published.PublishedPaymentStatusReport">
<from uri="direct:published.PublishedPaymentStatusReport"/>
<process ref="FTStatusReportResponseMapper"/>
</route>
...
<to uri="direct:published.PublishedPaymentTransferInitiation"/>
</post>
...
<route id="direct.published.PublishedPaymentTransferInitiation">
<from uri="direct:published.PublishedPaymentTransferInitiation"/>
<process ref="FTInitiationRequestMapper"/>
<process ref="FTInitiationResponseMapper"/>
</route>
...
<to uri="direct:published.PublishedPaymentTransferSubmission"/>
</post>
...
<route id="direct.published.PublishedPaymentTransferSubmission">
<from uri="direct:published.PublishedPaymentTransferSubmission"/>
<process ref="FTSubmissionResponseMapper"/>
</route>
The request and response mappers configured will have java code to transform from publisher json format to provider json and vice versa.
Published on: 22/05/2019