// Example Program: T_PAYBTRPT
// This program demonstrates the CTI_RunPayBatchDetailReport()
// subprocedure. This subprocedure retrieves CyberSource's on-demand
// payment batch detail report.
// This example demonstrates processing a report which was manually
// saved to the IFS, but which does not have an associated record in
// the CTIRPT table. It will create a record in CTIRPT, then read and
// parse the file 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');
// This is included for demo output purposes.
Dcl-Pr WriteToJobLog Int(10) Extproc('Qp0zLprintf');
pString Pointer Value Options(*String);
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_ReportAPIConfigDS_t) Inz(*LikeDS);
// In order to create a record in CTIRPT, we need to provide a new
// unique ID for the report.
UniqueId = CTI_NextUniqueId();
ReportDS.MerchantId = 'YOUR_MERCHANT_ID';
ReportDS.Operation = CTI_PROCESS_REPORT;
// This is the IFS filepath of a previously downloaded report. This
// could have been downloaded either using this API, or through some
// other method.
ReportDS.ReportStmf = '/your/reports/my_saved_report.xml';
if not CTI_RunPayBatchDetailReport( UniqueId : ReportDS : ErrorDS );
WriteToJobLog( 'Error Message Id: ' + ErrorDS.MessageId + NewLine );
WriteToJobLog( 'Error Message: ' + ErrorDS.Message + NewLine );
WriteToJobLog( 'Error Source: ' + ErrorDS.Source + NewLine );
*INLR = *ON;