/**
  * @param int    $dataProviderIndex
  * @param string $operation
  * @param string $responseCode
  * @param array  $additionalPaymentData
  * @param string $expectedResponse
  * @param string $keyNameForActualResponse
  * @param string $expectedExceptionMessage
  * @param bool   $isOutput
  *
  * @dataProvider providerTestRavenFullSuite
  */
 public function testRavenFullSuite($dataProviderIndex, $operation, $responseCode, array $additionalPaymentData = null, $expectedResponse, $keyNameForActualResponse, $expectedExceptionMessage, $isOutput = false)
 {
     $this->isOutput = $isOutput;
     try {
         $rvn = new Raven(self::ACCESSKEY_ID, self::ACCESSKEY_SECRET);
         //See Programmatic Magic Cards for details:
         //https://docs.deepcovelabs.com/card/#testing-with-the-programmatic-magic-cards
         //Add "PaymentReference"=>"ApprovedTest_20160303_1720_0[US:VI:Approved]"
         //    "PaymentReference"=> {ClientReference(text)}[{CountryCode}:{SchemeCode}:{ResponseCode}]
         $clientReference = "Test_" . $dataProviderIndex . "_" . gmdate('Ymd');
         date_default_timezone_set('utc');
         $expiry_date = (new \DateTime('now'))->add(new \DateInterval('P2Y'))->format('my');
         $payment_data = array_merge(self::BASE_PAYMENT_DATA, ["ExpiryDate" => $expiry_date, "PaymentReference" => $clientReference . $responseCode]);
         if (!empty($additionalPaymentData)) {
             $payment_data = array_merge($payment_data, $additionalPaymentData);
         }
         $req = new Request($operation, $payment_data);
         $resp = $rvn->send($req);
         $this->assertEquals($expectedResponse, $resp->get($keyNameForActualResponse));
         //Echo output
         $this->echoOutput($dataProviderIndex, $req, $resp);
     } catch (Exceptions\ResponseException $e) {
         $this->assertEquals($expectedExceptionMessage, $e->getMessage());
         $this->echoOutput($dataProviderIndex, $req);
         $this->echoExceptions($e);
     } catch (Exceptions\SignatureException $e) {
         $this->assertEquals($expectedExceptionMessage, $e->getMessage());
         $this->echoOutput($dataProviderIndex, $req);
         $this->echoExceptions($e);
     }
 }
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";
}
$eventReportRequest = new \Raven\Request('events');
$eventReportRequest->set('ReportFormat', 'RavenEventFile_v1.0');
$eventReportRequest->set('StartTime', $startTime->format('Y-m-d\\TH:i:s'));
$eventReportRequest->set('EndTime', $endTime->format('Y-m-d\\TH:i:s'));
$eventReportRequest->set('ResultFields', 'RoutingNumber PaymentType Amount Currency CardNumber ApprovalCode');
echo "Raven operation: " . $eventReportRequest->getOperation() . "\n";
echo "Request: " . json_encode($eventReportRequest->all(), JSON_PRETTY_PRINT) . "\n";
$eventReportResp = $rvn->send($eventReportRequest);
echo "Response: " . json_encode($eventReportResp->all(), JSON_PRETTY_PRINT) . "\n";
 *      Open command prompt in containing directory and run "php programic_magic_card.php".
 * See:
 *      For full documentation see "https://docs.deepcovelabs.com/card/#article-all-rapi-endpoints"
 */
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');
// Payment processing request reused several times
$paymentData = ["RoutingNumber" => "987743", "Currency" => "USD", "CardNumber" => "4242424242424242", "ExpiryDate" => "0919", "PaymentType" => "cc_debit", "Amount" => 4321];
# Set Magic Card for canadian payment
$paymentReq = new \Raven\Request('submit', $paymentData);
$paymentReq->set('PaymentReference', 'approvedtest[CA:VI:Approved]');
echo "Request: " . json_encode($paymentReq->all(), JSON_PRETTY_PRINT) . "\n";
$paymentResp = $rvn->send($paymentReq);
echo "Response: " . json_encode($paymentResp->all(), JSON_PRETTY_PRINT) . "\n";
# Submit an intentionally unsuccessful canadian payment
$paymentReq = new \Raven\Request('submit', $paymentData);
$paymentReq->set('PaymentReference', 'declinedtest[CA:VI:Declined]');
echo "Request: " . json_encode($paymentReq->all(), JSON_PRETTY_PRINT) . "\n";
$paymentResp = $rvn->send($paymentReq);
echo "Response: " . json_encode($paymentResp->all(), JSON_PRETTY_PRINT) . "\n";
# Submit a US payment that fails because US cards are not allowed on gaming PRNs
$paymentReq = new \Raven\Request('submit', $paymentData);
$paymentReq->set('PaymentReference', 'failtest[US:VI:Approved]');
echo "Request: " . json_encode($paymentReq->all(), JSON_PRETTY_PRINT) . "\n";
$paymentResp = $rvn->send($paymentReq);
echo "Response: " . json_encode($paymentResp->all(), JSON_PRETTY_PRINT) . "\n";
// Close the file
$closeReq = new \Raven\Request('closefile');