/**
  *
  * Receives a Json string and generates a domain object
  *
  * @param string $value
  *
  * @return HppRequest
  */
 public function ReadValue($value)
 {
     $array = json_decode($value, true);
     $array = new SafeArrayAccess($array, "");
     if ($array) {
         $hppRequest = new HppRequest();
         $hppRequest->setMerchantId($array['MERCHANT_ID']);
         $hppRequest->setAccount($array['ACCOUNT']);
         $hppRequest->setOrderId($array['ORDER_ID']);
         $hppRequest->setAmount($array['AMOUNT']);
         $hppRequest->setCurrency($array['CURRENCY']);
         $hppRequest->setTimeStamp($array['TIMESTAMP']);
         $hppRequest->setHash($array['SHA1HASH']);
         $hppRequest->setAutoSettleFlag($array['AUTO_SETTLE_FLAG']);
         $hppRequest->setCommentOne($array['COMMENT1']);
         $hppRequest->setCommentTwo($array['COMMENT2']);
         $hppRequest->setReturnTss($array['RETURN_TSS']);
         $hppRequest->setShippingCode($array['SHIPPING_CODE']);
         $hppRequest->setShippingCountry($array['SHIPPING_CO']);
         $hppRequest->setBillingCode($array['BILLING_CODE']);
         $hppRequest->setBillingCountry($array['BILLING_CO']);
         $hppRequest->setCustomerNumber($array['CUST_NUM']);
         $hppRequest->setVariableReference($array['VAR_REF']);
         $hppRequest->setProductId($array['PROD_ID']);
         $hppRequest->setLanguage($array['HPP_LANG']);
         $hppRequest->setCardPaymentButtonText($array['CARD_PAYMENT_BUTTON']);
         $hppRequest->setValidateCardOnly($array['VALIDATE_CARD_ONLY']);
         $hppRequest->setDccEnable($array['DCC_ENABLE']);
         $hppRequest->setCardStorageEnable($array['CARD_STORAGE_ENABLE']);
         $hppRequest->setOfferSaveCard($array['OFFER_SAVE_CARD']);
         $hppRequest->setPayerReference($array['PAYER_REF']);
         $hppRequest->setPaymentReference($array['PMT_REF']);
         $hppRequest->setPayerExists($array['PAYER_EXIST']);
         $hppRequest->setHppVersion($array['HPP_VERSION']);
         $hppRequest->setHppSelectStoredCard($array['HPP_SELECT_STORED_CARD']);
         $hppRequest->setPostDimensions($array['HPP_POST_DIMENSIONS']);
         $hppRequest->setPostResponse($array['HPP_POST_RESPONSE']);
         $supplementaryData = array();
         foreach ($array->getUnderLayingArray() as $key => $value) {
             if (!$this->isKnownProperty($key)) {
                 $supplementaryData[$key] = $value;
             }
         }
         $hppRequest->setSupplementaryData($supplementaryData);
         return $hppRequest;
     }
     return $array;
 }
 /**
  * Generates {@link HppRequest} object with empty defaults (time stamp and order ID).
  *
  * @param bool $cardStorage
  *
  * @return HppRequest
  */
 public static function generateValidHppRequestWithEmptyDefaults($cardStorage)
 {
     $hppRequest = new HppRequest();
     $hppRequest->addAccount(self::ACCOUNT)->addAmount(self::AMOUNT)->addAutoSettleFlag(self::AUTO_SETTLE_FLAG == Flag::TRUE ? 1 : 0)->addBillingCode(self::BILLING_CODE)->addBillingCountry(self::BILLING_COUNTRY)->addCardPaymentButtonText(self::CARD_PAYMENT_BUTTON_TEXT)->addCardStorageEnable(self::CARD_STORAGE_ENABLE == Flag::TRUE ? 1 : 0)->addCommentOne(self::COMMENT_ONE)->addCommentTwo(self::COMMENT_TWO)->addCurrency(self::CURRENCY)->addCustomerNumber(self::CUSTOMER_NUMBER)->addLanguage(self::LANGUAGE)->addMerchantId(self::MERCHANT_ID)->addOfferSaveCard(self::OFFER_SAVE_CARD == Flag::TRUE ? 1 : 0)->addPayerExists(self::PAYER_EXISTS == Flag::TRUE ? 1 : 0)->addPayerReference(self::PAYER_REF)->addPaymentReference(self::PAYMENT_REF)->addProductId(self::PRODUCT_ID)->addReturnTss(self::RETURN_TSS == Flag::TRUE ? 1 : 0)->addShippingCode(self::SHIPPING_CODE)->addShippingCountry(self::SHIPPING_COUNTRY)->addVariableReference(self::VARIABLE_REFERENCE)->addValidateCardOnly(self::VALIDATE_CARD_ONLY)->addDccEnable(self::DCC_ENABLE)->addHppVersion(self::HPP_VERSION)->addhppSelectStoredCard(self::HPP_SELECT_STORED_CARD);
     $hppRequest->setTimeStamp(self::TIMESTAMP);
     $hppRequest->setHash(self::HASH_REQUEST);
     if ($cardStorage) {
         $hppRequest->setCardStorageEnable(Flag::TRUE);
         $hppRequest->setOfferSaveCard(Flag::TRUE);
     }
     $hppRequest->setSupplementaryData(self::$SUPPLEMENTARY_DATA);
     return $hppRequest;
 }