Perform an http call. This method is used by the resource specific classes. Please use the $payments property to
perform operations on payments.
public performHttpCall ( $http_method, $api_method, $http_body = NULL ) : string | ||
$http_method | ||
$api_method | ||
$http_body | ||
Результат | string |
/** * Perform an API call, and interpret the results and convert them to correct objects. * * @param $http_method * @param $api_method * @param null $http_body * * @throws Mollie_API_Exception * * @return object */ protected function performApiCall($http_method, $api_method, $http_body = null) { $body = $this->api->performHttpCall($http_method, $api_method, $http_body); if (!($object = @json_decode($body))) { throw new Mollie_API_Exception("Unable to decode Mollie response: \"{$body}\"."); } if (!empty($object->error)) { throw new Mollie_API_Exception("Error executing API call ({$object->error->type}): {$object->error->message}."); } return $object; }
/** * Perform an API call, and interpret the results and convert them to correct objects. * * @param $http_method * @param $api_method * @param null $http_body * * @return object * @throws Mollie_API_Exception */ protected function performApiCall($http_method, $api_method, $http_body = NULL) { $body = $this->api->performHttpCall($http_method, $api_method, $http_body); if (empty($body)) { throw new Mollie_API_Exception("Unable to decode Mollie response: '{$body}'."); } $object = @json_decode($body); if (json_last_error() != JSON_ERROR_NONE) { throw new Mollie_API_Exception("Unable to decode Mollie response: '{$body}'."); } if (!empty($object->error)) { $exception = new Mollie_API_Exception("Error executing API call ({$object->error->type}): {$object->error->message}."); if (!empty($object->error->field)) { $exception->setField($object->error->field); } throw $exception; } return $object; }