public function create_payment(Pronamic_WP_Pay_Gateways_Mollie_PaymentRequest $request) { $result = null; $data = $request->get_array(); $response = $this->send_request('payments/', 'POST', $data); $response_code = wp_remote_retrieve_response_code($response); if ($response_code == 201) { $body = wp_remote_retrieve_body($response); // NULL is returned if the json cannot be decoded or if the encoded data is deeper than the recursion limit. $result = json_decode($body); } else { $body = wp_remote_retrieve_body($response); $mollie_result = json_decode($body); $this->error = new WP_Error('mollie_error', $mollie_result->error->message, $mollie_result->error); } return $result; }
public function create_payment(Pronamic_WP_Pay_Gateways_Mollie_PaymentRequest $request) { return $this->send_request('payments/', 'POST', $request->get_array(), 201); }