* Version: * v2.3.0 * Purpose: * Demonstrates how to use the Raven Helper library to report on past payments * and the events associated with them. * Usage: * Open command prompt in containing directory and run "php payment_reporting.php". * See: * For full documentation see "https://docs.deepcovelabs.com/card/#payments-reporting-endpoint" */ require '../vendor/autoload.php'; use Raven\Raven; date_default_timezone_set('UTC'); # First, instantiate the SDK with your AccessKey_ID and AccessKey_Secret. $rvn = new Raven('ernest', 'all good men die young'); $helloResp = $rvn->hello(); $endTime = new DateTime(); $startTime = new DateTime(); // setting it 1 day $startTime->sub(new DateInterval('P1D')); // ReportRequest Data $reportData = ["ReportFormat" => "RavenPaymentFile_v1.0", "StartTime" => $startTime->format('Y-m-d\\TH:i:s'), "EndTime" => $endTime->format('Y-m-d\\TH:i:s'), "ResultFields" => 'RoutingNumber PaymentType Amount Currency CardNumber ApprovalCode']; $reportRequest = new \Raven\Request('payments', $reportData); echo "Raven operation: " . $reportRequest->getOperation() . "\n"; echo "Request: " . json_encode($reportRequest->all(), JSON_PRETTY_PRINT) . "\n"; $reportResp = $rvn->send($reportRequest); echo "Response: " . json_encode($reportResp->all(), JSON_PRETTY_PRINT) . "\n"; $pmtReportLines = explode("\r", $reportResp->get("Report")); echo "\n"; foreach ($pmtReportLines as $reportLine) { echo $reportLine . "\n";