First phase - Updating to SI factory
|
For this first phase it is only required to implement the use of CAI_createConversationFactory_SI (thus use the CAI_Connection_SI input structure).
Note: A .INI file use is recommended for connection parameters and API parsing functions are provided (see later section ".INI file handling").
A logical scenario from a Local User Application to open a conversation from the SI factory, request information,
and close a conversation follows.
We are here hilighting the differences with a common scenario:
CAI_Connection_SI myCnx;
CAI_CustomSign myCustomSign;
CAI_Authentication myAuth;
CAI_OpenType open_type;
CAI_initOpenType(&open_type);
CAI_initCustomSign(&myCustomsign);
CAI_initAuthentication(&myAuth);
myAuth.corporate_id= (unsigned char *) corpid;
myAuth.user_id=(unsigned char *) userid;
myAuth.password=(unsigned char *) password;
cai_err = CAI_getConnectionInfoFromINI(iniFile,&myCnx);
cai_err = CAI_getCustomSignInfoFromINI(iniFile,"Office1",&myCustomSign);
/*Note: here possible modification of the customSign structure for changePOS users*/
open_type.custom_sign = &myCustomSign;
cai_err = CAI_createConversationFactory_SI(&myCnx, &myAuth,&factory);
cai_err = CAI_openConversationFromFactory(factory,&open_type,&conversation);
...
closeConversation(Conversation_handle)
|
It is possible to perform transactions in parallel using several conversations.
Note: The retrieve of custom sign-in parameters here is not required for the first phase.
Indeed the .INI for first phase does not need to contain any custom-sign information.
The CAI_getCustomSignInfoFromINI function simply does not fill any field of the CAI_CustomSign structure.
However in preparation for the final phase, it could be added to avoid updating the application.
Caution for "CustomSign" users: The CAI_getCustomSignInfoFromINI function first calls CAI_initCustomSign and thus reset all its content to 0.
Be sure to call it before any manual modification of the CAI_CustomSign structure.
The final phase is not ready yet on Amadeus' side.
We released these functions so that APIv2 customers have time to migrate their application to the new functions.
There should be two different types of information in the .INI file:
- Connection parameters
- Custom sign-in parameters (it will be used in the final phase)
Available functions are thus:
- CAI_getConnectionInfoFromINI(char * ini_name, CAI_Connection_SI *myCnx);
Parses a .ini configuration file and loads data into a CAI_Connection_SI structure
- CAI_displayConnectionInfo(CAI_Connection_SI *myCnx);
- CAI_getCustomSignInfoFromINI(char * ini_name,char * label, CAI_CustomSign *myCustomSign);
Parses a .ini configuration file and loads data into a CAI_CustomSign structure.
Note: The label parameter allows to organise several 'CAI_CustomSign's in a hierarchical (tree-like) manner in one .ini file. (label is usually the office)
- CAI_displayCustomSignInfo(CAI_CustomSign *myCustomSign);
.INI file sample:
# This is an example of ini file for APIv2 Gateway Connections
# to the Amadeus test system.
# TCP/IP Connection information
[CAI_Connection_SI]
tcp_connection_type = 0 ; type 0 connection to Gateway
tcp_connection_nb = 1
[CAI_Connection0]
tcp_server = 195.27.163.89
port_number = 20002
# Custom sign information (empty)
[CAI_CustomSign]
|