class Api implements ApiInterface (View source)

Api Class

This class in responsible for making and executing the calls to the Hubtel Server.

Properties

protected ConfigInterface $config The Config repository instance.
protected string $baseUrl The Default Hubtel Base url for merchant payment
protected Response $response This is the response received from the hubtel server if no exception was thrown.

Methods

void
__construct(Config $config)

Constructor.

Api
injectConfig(Config $config)

Injects the configuration tot he Api Instance

Api
setBaseUrl(string $baseUrl)

Change the Default baseUrl defined by hubtel

string
getBaseUrl()

Get the Hubtel payment Base Url from the Api Instance

array
_get(string $url = null, array $parameters = [])

Send a GET request.

array
_head(string $url = null, array $parameters = [])

Send a HEAD request.

array
_delete(string $url = null, array $parameters = [])

Send a DELETE request.

array
_put(string $url = null, array $parameters = [])

Send a PUT request.

array
_patch(string $url = null, array $parameters = [])

Send a PATCH request.

array
_post(string $url = null, array $parameters = [])

Send a POST request.

array
_options(string $url = null, array $parameters = [])

Send an OPTIONS request.

array
execute(string $httpMethod, string $url, array $parameters = [])

Executes the HTTP request.

Client
getClient()

Returns an Http client instance.

HandlerStack
createHandler(Config $config)

Create the client handler.

getConfig()

No description

Api
setConfig(ConfigInterface $config)

No description

Details

void __construct(Config $config)

Constructor.

Parameters

Config $config

Return Value

void

Api injectConfig(Config $config)

Injects the configuration tot he Api Instance

Parameters

Config $config

Return Value

Api

Api setBaseUrl(string $baseUrl)

Change the Default baseUrl defined by hubtel

Parameters

string $baseUrl The hubtel Resource Base URL

Return Value

Api

string getBaseUrl()

Get the Hubtel payment Base Url from the Api Instance

Return Value

string

array _get(string $url = null, array $parameters = [])

Send a GET request.

Parameters

string $url
array $parameters

Return Value

array

array _head(string $url = null, array $parameters = [])

Send a HEAD request.

Parameters

string $url
array $parameters

Return Value

array

array _delete(string $url = null, array $parameters = [])

Send a DELETE request.

Parameters

string $url
array $parameters

Return Value

array

array _put(string $url = null, array $parameters = [])

Send a PUT request.

Parameters

string $url
array $parameters

Return Value

array

array _patch(string $url = null, array $parameters = [])

Send a PATCH request.

Parameters

string $url
array $parameters

Return Value

array

array _post(string $url = null, array $parameters = [])

Send a POST request.

Parameters

string $url
array $parameters

Return Value

array

array _options(string $url = null, array $parameters = [])

Send an OPTIONS request.

Parameters

string $url
array $parameters

Return Value

array

array execute(string $httpMethod, string $url, array $parameters = [])

Executes the HTTP request.

Parameters

string $httpMethod
string $url
array $parameters

Return Value

array

protected Client getClient()

Returns an Http client instance.

Return Value

Client

protected HandlerStack createHandler(Config $config)

Create the client handler.

Parameters

Config $config

Return Value

HandlerStack

ConfigInterface getConfig()

Return Value

ConfigInterface

Api setConfig(ConfigInterface $config)

Parameters

ConfigInterface $config

Return Value

Api