// Example Program: T_SLTRNQR1
// Description:
// This program demonstrates the CTI_RunSingleTransQuery() subprocedure
// which retrieves CyberSource's on-demand transaction query for a
// single given transaction.
//
// This example demonstrates download and processing the report as one
// API call, querying a transaction request ID. It will save the file to
// the IFS and create an associated record in CTIRPT, then parse the
// report fields into the CTIRPT* output tables.
//
// This program assumes that you have correctly configured your merchant
// and environment tables (CTICFGMCH and CTICFGENV) and that you have at
// least one valid batch transaction on the given date.
Ctl-Opt ActGrp(*Caller) BndDir('CTIBND');
/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;
// This holds any error information returned by the API call
Dcl-Ds ErrorDS LikeDS(CTI_ErrorDS_t) Inz(*LikeDS);
// This holds configuration values for the report request API call
Dcl-Ds ReportDS LikeDS(CTI_OnDemandReportConfigDS_t) Inz(*LikeDS);
reset ReportDS;
reset ErrorDS;
// Each API call requires a unique ID
UniqueId = CTI_NextUniqueId();
ReportDS.MerchantId = 'YOUR_MERCHANT_ID';
// Because we are both downloading and processing the report, we do not
// need to specify an IFS filepath - it will save the report using the
// default download directory set in CTICFGENV.
ReportDS.Operation = CTI_DOWNLOAD_REPORT + CTI_PROCESS_REPORT;
// This must be a valid CyberSource transaction request ID.
ReportDS.TransRequestId = 'TRANSACTION_REQUEST_ID';
if not CTI_RunSingleTransQuery( UniqueId : ReportDS : ErrorDS );
WriteToJobLog( 'Error Message Id: ' + ErrorDS.MessageId + NewLine );
WriteToJobLog( 'Error Message: ' + ErrorDS.Message + NewLine );
WriteToJobLog( 'Error Source: ' + ErrorDS.Source + NewLine );
endif;
*INLR = *ON;
return;