/**
  *
  * Receives a domain object and generates a Json string
  *
  * @param HppResponse $hppResponse
  *
  * @return string
  */
 public function WriteValueAsString($hppResponse)
 {
     $prop = array('MERCHANT_ID' => $hppResponse->getMerchantId(), 'ACCOUNT' => $hppResponse->getAccount(), 'ORDER_ID' => $hppResponse->getOrderId(), 'AMOUNT' => $hppResponse->getAmount(), 'AUTHCODE' => $hppResponse->getAuthCode(), 'TIMESTAMP' => $hppResponse->getTimeStamp(), 'SHA1HASH' => $hppResponse->getHash(), 'RESULT' => $hppResponse->getResult(), 'MESSAGE' => $hppResponse->getMessage(), 'CVNRESULT' => $hppResponse->getCvnResult(), 'PASREF' => $hppResponse->getPasRef(), 'BATCHID' => $hppResponse->getBatchId(), 'ECI' => $hppResponse->getEci(), 'CAVV' => $hppResponse->getCavv(), 'XID' => $hppResponse->getXid(), 'COMMENT1' => $hppResponse->getCommentOne(), 'COMMENT2' => $hppResponse->getCommentTwo(), 'TSS' => $hppResponse->getTss(), 'AVSADDRESSRESULT' => $hppResponse->getAVSAddressResult(), 'AVSPOSTCODERESULT' => $hppResponse->getAVSPostCodeResult());
     $supplementaryData = $hppResponse->getSupplementaryData();
     if (is_array($supplementaryData)) {
         foreach ($supplementaryData as $key => $value) {
             $prop[$key] = $value;
         }
     }
     return json_encode($prop);
 }
 /**
  * @param HppResponse $hppResponseExpected
  * @param HppResponse $hppResponseConverted
  * @param PHPUnit_Framework_TestCase $testCase
  */
 public static function checkValidHppResponse(HppResponse $hppResponseExpected, HppResponse $hppResponseConverted, PHPUnit_Framework_TestCase $testCase)
 {
     $testCase->assertEquals($hppResponseExpected->getAccount(), $hppResponseConverted->getAccount(), "Json conversion incorrect Account");
     $testCase->assertEquals($hppResponseExpected->getAmount(), $hppResponseConverted->getAmount(), "Json conversion incorrect Amount");
     $testCase->assertEquals($hppResponseExpected->getCommentOne(), $hppResponseConverted->getCommentOne(), "Json conversion incorrect Comment One");
     $testCase->assertEquals($hppResponseExpected->getCommentTwo(), $hppResponseConverted->getCommentTwo(), "Json conversion incorrect Comment Two");
     $testCase->assertEquals($hppResponseExpected->getMerchantId(), $hppResponseConverted->getMerchantId(), "Json conversion incorrect Merchant ID");
     $testCase->assertEquals($hppResponseExpected->getTimeStamp(), $hppResponseConverted->getTimeStamp(), "Json conversion incorrect Time Stamp");
     $testCase->assertEquals($hppResponseExpected->getHash(), $hppResponseConverted->getHash(), "Json conversion incorrect Hash");
     $testCase->assertEquals($hppResponseExpected->getOrderId(), $hppResponseConverted->getOrderId(), "Json conversion incorrect Order ID");
     $testCase->assertEquals($hppResponseExpected->getAuthCode(), $hppResponseConverted->getAuthCode(), "Json conversion incorrect Auth Code");
     $testCase->assertEquals($hppResponseExpected->getBatchId(), $hppResponseConverted->getBatchId(), "Json conversion incorrect Batch ID");
     $testCase->assertEquals($hppResponseExpected->getCavv(), $hppResponseConverted->getCavv(), "Json conversion incorrect CAVV");
     $testCase->assertEquals($hppResponseExpected->getCvnResult(), $hppResponseConverted->getCvnResult(), "Json conversion incorrect CVN Result");
     $testCase->assertEquals($hppResponseExpected->getEci(), $hppResponseConverted->getEci(), "Json conversion incorrect ECI");
     $testCase->assertEquals($hppResponseExpected->getMessage(), $hppResponseConverted->getMessage(), "Json conversion incorrect Message");
     $testCase->assertEquals($hppResponseExpected->getPasRef(), $hppResponseConverted->getPasRef(), "Json conversion incorrect Pas Ref");
     $testCase->assertEquals($hppResponseExpected->getResult(), $hppResponseConverted->getResult(), "Json conversion incorrect Result");
     $testCase->assertEquals($hppResponseExpected->getXid(), $hppResponseConverted->getXid(), "Json conversion incorrect XID");
     $testCase->assertEquals($hppResponseExpected->getAVSAddressResult(), $hppResponseConverted->getAVSAddressResult(), "Json conversion incorrect AVS Address Result");
     $testCase->assertEquals($hppResponseExpected->getAVSPostCodeResult(), $hppResponseConverted->getAVSPostCodeResult(), "Json conversion incorrect AVS Address Postcode");
     $tss = $hppResponseExpected->getTss();
     $convertedTss = $hppResponseConverted->getTss();
     $testCase->assertEquals($tss[self::TSS_ONE_KEY], $convertedTss[self::TSS_ONE_KEY], "Json conversion incorrect TSS Entry");
     $testCase->assertEquals($tss[self::TSS_TWO_KEY], $convertedTss[self::TSS_TWO_KEY], "Json conversion incorrect TSS Entry");
     $testCase->assertEquals(sizeof(self::$TSS), sizeof($convertedTss), "Json conversion incorrect size");
     $testCase->assertEquals(sizeof($tss), sizeof($convertedTss), "Json conversion incorrect size");
 }