コード例 #1
0
 public function validate()
 {
     $hash = PZ_Utils::generate_hash($this->get_response_params(), $this->secret_key);
     $hash_match = $hash == $this->get_hash() ? TRUE : FALSE;
     return $hash_match;
 }
コード例 #2
0
ファイル: RefundRequest.php プロジェクト: sreeram77/quri
 public function refund()
 {
     $this->params = PZ_Utils::params_filter($this->params);
     $validate_result = (object) $this->validate();
     if ($validate_result->status == false) {
         throw new Exception("Invalid params : " . $validate_result->message);
     }
     $hash = PZ_Utils::generate_hash($this->params);
     $this->set_hash($hash);
     $curl = curl_init();
     curl_setopt($curl, CURLOPT_URL, $this->refund_api_url);
     curl_setopt($curl, CURLOPT_POST, 1);
     curl_setopt($curl, CURLOPT_POSTFIELDS, http_build_query($this->params));
     curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
     // curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, true);
     $response = curl_exec($curl);
     if (!$response) {
         throw new Exception('Curl error: ' . curl_error($curl));
     }
     curl_close($curl);
     return new RefundResponse($response);
 }
コード例 #3
0
 private function invalid_positive_number($fieldName, $max_length = 0)
 {
     return !PZ_Utils::is_valid_parameter($this->params[$fieldName], $max_length) || !(ctype_digit($this->params[$fieldName]) || is_int($this->params[$fieldName])) || $this->params[$fieldName] <= 0;
 }
コード例 #4
0
ファイル: QueryRequest.php プロジェクト: sreeram77/quri
 private function get_query_url()
 {
     $this->params = PZ_Utils::params_filter($this->params);
     $validate_result = $this->validate();
     if (empty($validate_result["status"])) {
         throw new Exception("Invalid params : " . $validate_result["message"]);
     }
     $hash = PZ_Utils::generate_hash($this->params);
     $this->set_hash($hash);
     $url = $this->query_api_url . "?" . http_build_query($this->params);
     return $url;
 }