T_QRYTRN - Run a Transaction Query


// Example Program: T_QRYTRN // Description: // This is a test program to demonstrate running a transaction query // from CyberSource using the CTI_QueryTransaction() API. // // To achieve this, generate a unique ID with CTI_NextUniqueId(), and // then populate the required fields in the ReportDS data structure. // Call the API, passing in your unique ID and the other parameters // as shown. // // CTI_QueryTransaction() will return *On if no error was encountered, // or *Off if an error occurred. If an error occurred, you should look // at the fields in ErrorDS to retrieve information about the error. // // Otherwise, the query response can be found in the download directory // specified in your CTICFGENV record. Ctl-Opt ActGrp(*Caller) BndDir('CTIBND') Option(*NoDebugIO); /COPY QRPGLECPY,CTICB // This is included for demo output purposes. Dcl-Pr WriteToJobLog Int(10) Extproc('Qp0zLprintf'); pString Pointer Value Options(*String); End-Pr; Dcl-C NewLine x'15'; // This stores the unique ID for this API call Dcl-S UniqueId Like(CTI_UniqueId_t) Inz; Dcl-Ds ReportDS LikeDS(CTI_QueryTransactionDS_t) Inz(*LikeDS); // This holds any error information returned by the API call Dcl-Ds ErrorDS LikeDS(CTI_ErrorDS_t) Inz(*LikeDS); // Modify this field to use your merchant ID Dcl-S MerchantId Like(CTI_MerchantId_t) Inz('ikrengel'); reset ErrorDS; // Each API call requires a unique ID UniqueId = CTI_NextUniqueId(); ReportDS.MerchantId = MerchantId; ReportDS.Environment = CTI_ENV_TEST; // If this value is not specified, CTI will use a value of '*DEFAULT' //ReportDS.KeyLabel = ''; ReportDS.TransactionId = '5526774514056749004007'; ReportDS.Filepath = %Char(UniqueId) + '_query.json'; if not CTI_QueryTransaction( UniqueId : ReportDS : ErrorDS ); WriteToJobLog( 'Failure' + NewLine ); WriteToJobLog( 'Source: ' + ErrorDS.Source + NewLine ); WriteToJobLog( %Trim(ErrorDS.MessageId) + ': ' + ErrorDS.Message + NewLine ); else; WriteToJobLog( 'Success' + NewLine ); endif; *INLR = *On; return;