Transaction
class Transaction extends Api (View source)
Transaction Class
This class encapsulates all the Hubtel Transaction properties required and optional that appears both on the SendMoney and ReceiveMoney requests.
Properties
| protected ConfigInterface | $config | The Config repository instance. | from Api |
| protected string | $baseUrl | The Default Hubtel Base url for merchant payment | from Api |
| protected Response | $response | This is the response received from the hubtel server if no exception was thrown. | from Api |
| protected string | $customerName | The name of the customer. | |
| protected string | $customerEmail | The customer email address | |
| protected string | $customerMsisdn | The customer mobile money number. | |
| protected string | $channel | The mobile money provider channel | |
| protected string | $amount | The mobile money transaction amount | |
| protected string | $primaryCallbackURL | A callback URL to receive the transaction status from Hubtel to your API request. | |
| protected string | $secondaryCallbackURL | The second URL for callback response in the event of failure of primary callback URL. | |
| protected string | $clientReference | The reference number that is provided by you to reference a transaction from your end. | |
| protected string | $description | The short description of the transaction. | |
| protected array | $parametersRequired | Defines an array of required properties | |
| protected array | $parametersOptional | Defines an array of the names of optional properties/parameters names |
Methods
Executes the HTTP request.
returnes the name of the give customer
Sets the name of the customer.
get the customer's email address.
sets the customer's email address.
gets the msisdn (Customer's phone number)
Sets the customer's phone number to be billed or funded.
returns the transaction channel (Mobile Network)
sets the transaction channel (Mobile Network)
Gets the money value for the transaction.
sets the money value (Amount) to be sent or received
Returns the primary callback URL that has been set on the instance.
set the callback url to callback if the transaction was successful.
Returns the callback url on the transaction
Sets the URL to call back if he transaction is unsuccesful.
get the transaction reference.
Set's a reference on the transaction for easy identification and transaction tracking.
gets the description of the transaction.
sets a description for the transaction.
This function sets the customer data (name, email and msisdn|number|phone)
This method sests a single callback for both the success and Error
This method sets the callbacks for the Hubtel Payments
Sets the URL to call when the payment fails or is unsuccessfull
Set the URL to call when the payment is been confirmed successful (requred by the Hubtel ReceiveMoney Api)
Details
array
_options(string $url = null, array $parameters = [])
Send an OPTIONS request.
array
execute(string $httpMethod, string $url, array $parameters = [])
Executes the HTTP request.
ConfigInterface
getConfig()
Api
setConfig(ConfigInterface $config)
at line 115
string
getCustomerName()
returnes the name of the give customer
at line 127
Transaction
setCustomerName(string $customerName)
Sets the name of the customer.
at line 139
string
getCustomerEmail()
get the customer's email address.
at line 151
Transaction
setCustomerEmail(string $customerEmail)
sets the customer's email address.
at line 163
string
getCustomerMsisdn()
gets the msisdn (Customer's phone number)
at line 175
Transaction
setCustomerMsisdn(string $customerMsisdn)
Sets the customer's phone number to be billed or funded.
at line 187
string
getChannel()
returns the transaction channel (Mobile Network)
at line 199
Transaction
setChannel(string $channel)
sets the transaction channel (Mobile Network)
at line 211
string
getAmount()
Gets the money value for the transaction.
at line 223
Transaction
setAmount(string $amount)
sets the money value (Amount) to be sent or received
at line 235
string
getPrimaryCallbackURL()
Returns the primary callback URL that has been set on the instance.
at line 247
Transaction
setPrimaryCallbackURL(string $primaryCallbackURL)
set the callback url to callback if the transaction was successful.
at line 259
string
getSecondaryCallbackURL()
Returns the callback url on the transaction
at line 271
Transaction
setSecondaryCallbackURL(string $secondaryCallbackURL)
Sets the URL to call back if he transaction is unsuccesful.
at line 283
string
getClientReference()
get the transaction reference.
at line 296
Transaction
setClientReference(string $clientReference)
Set's a reference on the transaction for easy identification and transaction tracking.
at line 308
string
getDescription()
gets the description of the transaction.
at line 320
Transaction
setDescription(string $description)
sets a description for the transaction.
at line 334
Transaction
setCustomer(array $data = [])
This function sets the customer data (name, email and msisdn|number|phone)
at line 364
Transaction
callback(string $primaryCallbackURL)
This method sests a single callback for both the success and Error
at line 380
Transaction
setCallback(array|string $data = [])
This method sets the callbacks for the Hubtel Payments
at line 413
Transaction
callbackOnFail(string $secondaryCallbackURL)
Sets the URL to call when the payment fails or is unsuccessfull
at line 424
Transaction
callbackOnSuccess(string $primaryCallbackURL)
Set the URL to call when the payment is been confirmed successful (requred by the Hubtel ReceiveMoney Api)