1 <?php
  2 namespace OpenDNS\MES\Reporting;
  3 use OpenDNS\MES\Request;
  4 
  5 class Report extends Request
  6 {
  7     const REPORT_ACHP_RETURN_SUMMARY = 18;
  8     const REPORT_ACHP_SETTLEMENT_SUMMARY = 17;
  9     const REPORT_AUTHORIZATION_LOG = 15;
 10     const REPORT_BATCH_SUMMARY = 1;
 11     const REPORT_CHARGEBACK_ADJUSTMENTS = 5;
 12     const REPORT_CUSTOM = 9;
 13     const REPORT_DAILY_INTERCHANGE_SUMMARY = 8;
 14     const REPORT_DEPOSIT_SUMMARY = 3;
 15     const REPORT_FX_BATCH_SUMMARY = 10;
 16     const REPORT_FX_INTERCHANGE_SUMMARY = 13;
 17     const REPORT_INTERNATIONAL_CHARGEBACKS = 11;
 18     const REPORT_INTERNATIONAL_RETRIEVAL_REQUESTS = 12;
 19     const REPORT_INTERNATIONAL_SETTLEMENT_SUMMARY = 14;
 20     const REPORT_PAYMENT_GATEWAY_REJECTED_TRANSACTIONS = 23;
 21     const REPORT_PAYMENT_GATEWAY_SETTLED_TRANSACTIONS = 22;
 22     const REPORT_PAYMENT_GATEWAY_UNSETTLED_TRANSACTIONS = 21;
 23     const REPORT_RETRIEVAL_REQUESTS = 7;
 24     const REPORT_SETTLEMENT_SUMMARY = 2;
 25 
 26     const TYPE_SUMMARY = 0;
 27     const TYPE_DETAIL = 1;
 28 
 29     const QUERY_VISA_ARDEF_TABLES = 283;
 30     const QUERY_MC_ARDEF_TABLES = 284;
 31 
 32     protected $httpMethod = 'GET';
 33 
 34     protected $defaultFieldValues = array(
 35         'reportType' => 0,
 36         'encoding' => 'csv',
 37         'includeTridentTranId' => 'true',
 38     );
 39 
 40     protected $apiBasePath = '/jsp/reports/report_api.jsp';
 41 
 42      43  44  45  46  47  48  49  50 
 51     public function setAuthenticationInfo($userId, $password)
 52     {
 53         return $this->setField('userId', $userId)
 54                     ->setField('userPass', $password);
 55     }
 56 
 57      58  59  60  61  62  63  64 
 65     public function setReportId($reportId)
 66     {
 67         return $this->setField('dsReportId', $reportId);
 68     }
 69 
 70      71  72  73  74  75 
 76     public function setBeginDate(\DateTime $startDate)
 77     {
 78         
 79         return $this->setField('beginDate.month', $startDate->format('m') - 1)
 80                     ->setField('beginDate.day', $startDate->format('d'))
 81                     ->setField('beginDate.year', $startDate->format('Y'))
 82                     ->setField('reportDateBegin', $startDate->format('m/d/Y'));
 83     }
 84 
 85      86  87  88  89  90 
 91     public function setEndDate(\DateTime $endDate)
 92     {
 93         
 94         return $this->setField('endDate.month', $endDate->format('m') - 1)
 95                     ->setField('endDate.day', $endDate->format('d'))
 96                     ->setField('endDate.year', $endDate->format('Y'))
 97                     ->setField('reportDateEnd', $endDate->format('m/d/Y'));
 98     }
 99 
100     101 102 103 104 105 
106     public function setNodeId($nodeId)
107     {
108         return $this->setField('nodeId', $nodeId);
109     }
110 
111     112 113 114 115 116 117 118 
119     public function setReportType($reportType)
120     {
121         return $this->setField('reportType', $reportType);
122     }
123 
124     125 126 127 128 129 
130     public function setIncludeTridentTransactionId($includeId)
131     {
132         return $this->setField('includeTridentTranId', $includeId ? 'true' : 'false');
133     }
134 
135     136 137 138 139 140 
141     public function setIncludePurchaseId($includeId)
142     {
143         return $this->setField('includePurchaseId', $includeId ? 'true' : 'false');
144     }
145 
146     147 148 149 150 151 152 153 154 
155     public function setCustomQueryId($queryId)
156     {
157         return $this->setField('queryId', $queryId);
158     }
159 
160 }
161