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;
 }
 /**
  * Generates valid {@link HppResponse} object.
  *
  * @return HppResponse
  */
 public static function generateValidHppResponse()
 {
     $hppResponse = new HppResponse();
     $hppResponse->setAccount(self::ACCOUNT);
     $hppResponse->setAmount(self::AMOUNT);
     $hppResponse->setAuthCode(self::AUTH_CODE);
     $hppResponse->setBatchId(self::BATCH_ID);
     $hppResponse->setCavv(self::CAVV);
     $hppResponse->setCommentOne(self::COMMENT_ONE);
     $hppResponse->setCommentTwo(self::COMMENT_TWO);
     $hppResponse->setCvnResult(self::CVN_RESULT);
     $hppResponse->setEci(self::ECI);
     $hppResponse->setHash(self::HASH_RESPONSE);
     $hppResponse->setMerchantId(self::MERCHANT_ID_RESPONSE);
     $hppResponse->setMessage(self::MESSAGE);
     $hppResponse->setOrderId(self::ORDER_ID_RESPONSE);
     $hppResponse->setPasRef(self::PAS_REF);
     $hppResponse->setResult(self::RESULT);
     $hppResponse->setTimeStamp(self::TIMESTAMP_RESPONSE);
     $hppResponse->setTss(self::$TSS);
     $hppResponse->setXid(self::XID);
     $hppResponse->setAVSAddressResult(self::AVS_ADDRESS);
     $hppResponse->setAVSPostCodeResult(self::AVS_POSTCODE);
     foreach (self::$SUPPLEMENTARY_DATA as $key => $value) {
         $hppResponse->setSupplementaryDataValue($key, $value);
     }
     return $hppResponse;
 }