/**
  *
  * Receives a domain object and generates a Json string
  *
  * @param HppRequest $hppRequest
  *
  * @return string
  */
 public function WriteValueAsString($hppRequest)
 {
     $prop = array('MERCHANT_ID' => $hppRequest->getMerchantId(), 'ACCOUNT' => $hppRequest->getAccount(), 'ORDER_ID' => $hppRequest->getOrderId(), 'AMOUNT' => $hppRequest->getAmount(), 'CURRENCY' => $hppRequest->getCurrency(), 'TIMESTAMP' => $hppRequest->getTimeStamp(), 'SHA1HASH' => $hppRequest->getHash(), 'AUTO_SETTLE_FLAG' => $hppRequest->getAutoSettleFlag(), 'COMMENT1' => $hppRequest->getCommentOne(), 'COMMENT2' => $hppRequest->getCommentTwo(), 'RETURN_TSS' => $hppRequest->getReturnTss(), 'SHIPPING_CODE' => $hppRequest->getShippingCode(), 'SHIPPING_CO' => $hppRequest->getShippingCountry(), 'BILLING_CODE' => $hppRequest->getBillingCode(), 'BILLING_CO' => $hppRequest->getBillingCountry(), 'CUST_NUM' => $hppRequest->getCustomerNumber(), 'VAR_REF' => $hppRequest->getVariableReference(), 'PROD_ID' => $hppRequest->getProductId(), 'HPP_LANG' => $hppRequest->getLanguage(), 'CARD_PAYMENT_BUTTON' => $hppRequest->getCardPaymentButtonText(), 'CARD_STORAGE_ENABLE' => $hppRequest->getCardStorageEnable(), 'OFFER_SAVE_CARD' => $hppRequest->getOfferSaveCard(), 'PAYER_REF' => $hppRequest->getPayerReference(), 'PMT_REF' => $hppRequest->getPaymentReference(), 'PAYER_EXIST' => $hppRequest->getPayerExists(), 'VALIDATE_CARD_ONLY' => $hppRequest->getValidateCardOnly(), 'DCC_ENABLE' => $hppRequest->getDccEnable());
     $supplementaryData = $hppRequest->getSupplementaryData();
     if (is_array($supplementaryData)) {
         foreach ($supplementaryData as $key => $value) {
             $prop[$key] = $value;
         }
     }
     if ($hppRequest->getHppVersion() != null) {
         $prop['HPP_VERSION'] = $hppRequest->getHppVersion();
     }
     if ($hppRequest->getHppSelectStoredCard() != null) {
         $prop['HPP_SELECT_STORED_CARD'] = $hppRequest->getHppSelectStoredCard();
     }
     if ($hppRequest->getPostDimensions() != null) {
         $prop['HPP_POST_DIMENSIONS'] = $hppRequest->getPostDimensions();
     }
     if ($hppRequest->getPostResponse() != null) {
         $prop['HPP_POST_RESPONSE'] = $hppRequest->getPostResponse();
     }
     return json_encode($prop);
 }
 /**
  * Checks request post dimensions matches expected values.
  *
  * @param HppRequest $hppRequestConverted
  * @param PHPUnit_Framework_TestCase $testCase
  */
 public static function checkValidHppRequestPostDimensions(HppRequest $hppRequestConverted, PHPUnit_Framework_TestCase $testCase)
 {
     $postDimensions = $hppRequestConverted->getPostDimensions();
     $testCase->assertEquals(self::POST_DIMENSIONS, $postDimensions, "Json conversion incorrect ");
     $testCase->assertEquals(sizeof(self::POST_DIMENSIONS), sizeof($postDimensions), "Json conversion incorrect size");
     $hppRequestConverted = $hppRequestConverted->encode(RealexHpp::ENCODING_CHARSET);
     $hppRequestConverted = $hppRequestConverted->decode(RealexHpp::ENCODING_CHARSET);
     $postDimensions = $hppRequestConverted->getPostDimensions();
     $testCase->assertEquals(self::POST_DIMENSIONS, $postDimensions, "Json conversion incorrect ");
 }