コード例 #1
0
 /**
  *
  * 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;
 }