コード例 #1
0
 /**
  * \brief BillingAddressエンドポイントリソース取得メソッド
  *
  */
 public function fetchBillingAddress()
 {
     parent::fetchResource($this->url, "GET");
     $res_body = parent::getLastResponse();
     $json_response = json_decode($res_body, true);
     Logger::debug("json response(" . get_class() . "::" . __FUNCTION__ . ")", $json_response);
     if ($json_response != null) {
         if (empty($json_response["error"])) {
             $this->billing_address = $json_response;
         } else {
             $error = $json_response["error"]["code"];
             $error_desc = $json_response["error"]["message"];
             Logger::error($error . "(" . get_class() . "::" . __FUNCTION__ . ")", $error_desc);
             throw new ApiException($error, $error_desc);
         }
     } else {
         Logger::error("no_response(" . get_class() . "::" . __FUNCTION__ . ")", "Failed to get the response body");
         throw new ApiException("no_response", "Failed to get the response body");
     }
 }
コード例 #2
0
 /**
  * \brief UserInfoエンドポイントリソース取得メソッド
  *
  */
 public function fetchUserInfo()
 {
     parent::setParam("schema", $this->schema);
     parent::fetchResource($this->url, "GET");
     $res_body = parent::getLastResponse();
     $json_response = json_decode($res_body, true);
     Logger::debug("json response(" . get_class() . "::" . __FUNCTION__ . ")", $json_response);
     if ($json_response != null) {
         if (empty($json_response["error"])) {
             $this->user_info = $json_response;
         } else {
             $error = $json_response["error"];
             $error_desc = $json_response["error_description"];
             Logger::error($error . "(" . get_class() . "::" . __FUNCTION__ . ")", $error_desc);
             throw new ApiException($error, $error_desc);
         }
     } else {
         Logger::error("no_response(" . get_class() . "::" . __FUNCTION__ . ")", "Failed to get the response body");
         throw new ApiException("no_response", "Failed to get the response body");
     }
 }