Ejemplo n.º 1
0
 /**
  *
  * Receives a Json string and generates a domain object
  *
  * @param string $value
  *
  * @return HppResponse
  */
 public function ReadValue($value)
 {
     $array = json_decode($value, true);
     $array = new SafeArrayAccess($array, "");
     if ($array) {
         $hppResponse = new HppResponse();
         $hppResponse->setMerchantId($array['MERCHANT_ID']);
         $hppResponse->setAccount($array['ACCOUNT']);
         $hppResponse->setOrderId($array['ORDER_ID']);
         $hppResponse->setAmount($array['AMOUNT']);
         $hppResponse->setAuthCode($array['AUTHCODE']);
         $hppResponse->setTimeStamp($array['TIMESTAMP']);
         $hppResponse->setHash($array['SHA1HASH']);
         $hppResponse->setResult($array['RESULT']);
         $hppResponse->setMessage($array['MESSAGE']);
         $hppResponse->setCvnResult($array['CVNRESULT']);
         $hppResponse->setPasRef($array['PASREF']);
         $hppResponse->setBatchId($array['BATCHID']);
         $hppResponse->setEci($array['ECI']);
         $hppResponse->setCavv($array['CAVV']);
         $hppResponse->setXid($array['XID']);
         $hppResponse->setCommentOne($array['COMMENT1']);
         $hppResponse->setCommentTwo($array['COMMENT2']);
         $hppResponse->setTss($array['TSS']);
         $hppResponse->setAVSAddressResult($array['AVSADDRESSRESULT']);
         $hppResponse->setAVSPostCodeResult($array['AVSPOSTCODERESULT']);
         foreach ($array->getUnderLayingArray() as $key => $value) {
             if (!$this->isKnownProperty($key)) {
                 $hppResponse->setSupplementaryDataValue($key, $value);
             }
         }
         return $hppResponse;
     }
     return $array;
 }
 /**
  *
  * 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;
 }