SendMoney
class SendMoney extends Transaction (View source)
Class SendMoney
This class encapsulates and implements an expressive API using a set of methods to implement the required properties to place a call to the Hubtel Server in order to send money to a customer.
Traits
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. | from Transaction |
| protected string | $customerEmail | The customer email address | from Transaction |
| protected string | $customerMsisdn | The customer mobile money number. | from Transaction |
| protected string | $channel | The mobile money provider channel | from Transaction |
| protected string | $amount | The mobile money transaction amount | from Transaction |
| protected string | $primaryCallbackURL | A callback URL to receive the transaction status from Hubtel to your API request. | from Transaction |
| protected string | $secondaryCallbackURL | The second URL for callback response in the event of failure of primary callback URL. | from Transaction |
| protected string | $clientReference | The reference number that is provided by you to reference a transaction from your end. | from Transaction |
| protected string | $description | The short description of the transaction. | from Transaction |
| protected | $parametersRequired | {@inheritdoc} | |
| protected | $parametersOptional | {@inheritdoc} |
Methods
Construct for creating a new instance of the SendMoney Api class
Executes the HTTP request.
sets the customer's email address.
Sets the customer's phone number to be billed or funded.
sets the transaction channel (Mobile Network)
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.
Sets the URL to call back if he transaction is unsuccesful.
Set's a reference on the transaction for easy identification and transaction tracking.
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)
This method exposes the mass assignment method.
This method is used to mass assign the properties required by the Hubtel ReceiveMoney and SendMoney Api
This method serves as an entry to a transaction class instane. It creates a new transaction class by first starting with the required amount value of the transaction to be created.
Sets the channel (Mobile Network) (requred by the Hubtel ReceiveMoney|SendMoney Api)
Dynamically handle missing Static Api Call to Amount.
Dynamically handle missing public method call on Amount.
This method checks that all properties marked as required have been assigned a value.
This method picks up all the defined properties the $parameterRequired|$parameterOptional property array list from the class object and returns an array containing each list item name as a key and the matching property value from the class
This method calls the accessors for keys passed in and returns back the value it receives from the class instance
This api method sets the receiver's name (requred by the Hubtel SendMoney Api)
This api method sets the receiver's name (requred by the Hubtel SendMoney Api)
This api method sets the receiver's email (requred by the Hubtel SendMoney Api)
This method sets the description of the transaction. Best used to describe why the money is being sent for future reference and book keeping.
Sets a reference to reference a transaction from your end.
The method runs the transaction
Details
at line 59
void
__construct(array $data = [])
Construct for creating a new instance of the SendMoney Api class
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)
in Transaction at line 115
string
getCustomerName()
returnes the name of the give customer
in Transaction at line 127
Transaction
setCustomerName(string $customerName)
Sets the name of the customer.
in Transaction at line 139
string
getCustomerEmail()
get the customer's email address.
in Transaction at line 151
Transaction
setCustomerEmail(string $customerEmail)
sets the customer's email address.
in Transaction at line 163
string
getCustomerMsisdn()
gets the msisdn (Customer's phone number)
in Transaction at line 175
Transaction
setCustomerMsisdn(string $customerMsisdn)
Sets the customer's phone number to be billed or funded.
in Transaction at line 187
string
getChannel()
returns the transaction channel (Mobile Network)
in MassAssignable at line 68
abstract MassAssignable
setChannel(string $channel)
sets the transaction channel (Mobile Network)
in Transaction at line 211
string
getAmount()
Gets the money value for the transaction.
in MassAssignable at line 43
abstract MassAssignable
setAmount(string $amount)
sets the money value (Amount) to be sent or received
in Transaction at line 235
string
getPrimaryCallbackURL()
Returns the primary callback URL that has been set on the instance.
in Transaction at line 247
Transaction
setPrimaryCallbackURL(string $primaryCallbackURL)
set the callback url to callback if the transaction was successful.
in Transaction at line 259
string
getSecondaryCallbackURL()
Returns the callback url on the transaction
in Transaction at line 271
Transaction
setSecondaryCallbackURL(string $secondaryCallbackURL)
Sets the URL to call back if he transaction is unsuccesful.
in Transaction at line 283
string
getClientReference()
get the transaction reference.
in MassAssignable at line 60
abstract MassAssignable
setClientReference(string $clientReference)
Set's a reference on the transaction for easy identification and transaction tracking.
in Transaction at line 308
string
getDescription()
gets the description of the transaction.
in MassAssignable at line 51
abstract MassAssignable
setDescription(string $description)
sets a description for the transaction.
in MassAssignable at line 35
abstract MassAssignable
setCustomer(array $data = [])
This function sets the customer data (name, email and msisdn|number|phone)
in Transaction at line 364
Transaction
callback(string $primaryCallbackURL)
This method sests a single callback for both the success and Error
in MassAssignable at line 75
abstract MassAssignable
setCallback(array|string $data = [])
This method sets the callbacks for the Hubtel Payments
in Transaction at line 413
Transaction
callbackOnFail(string $secondaryCallbackURL)
Sets the URL to call when the payment fails or is unsuccessfull
in Transaction 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)
in MassAssignable at line 82
MassAssignable
make(array $data = [])
This method exposes the mass assignment method.
in MassAssignable at line 93
protected MassAssignable
massAssign(array $data = [])
This method is used to mass assign the properties required by the Hubtel ReceiveMoney and SendMoney Api
in MassAssignable at line 164
protected
assignOnSendMoneyInstance($data = [])
in MassAssignable at line 171
protected
assignOnReceiveMoneyInstance($data = [])
in Transactable at line 33
protected Transactable
amount(float|number $amount)
This method serves as an entry to a transaction class instane. It creates a new transaction class by first starting with the required amount value of the transaction to be created.
(required by the Hubtel ReceiveMoney Api)
in Transactable at line 45
Transactable
channel(string $channel)
Sets the channel (Mobile Network) (requred by the Hubtel ReceiveMoney|SendMoney Api)
in Transactable at line 58
static Transactable
__callStatic(string $method, array $parameters)
Dynamically handle missing Static Api Call to Amount.
in Transactable at line 71
Transactable
__call(string $method, array $parameters)
Dynamically handle missing public method call on Amount.
in CanCleanParameters at line 35
protected bool
propertiesPassRequired()
This method checks that all properties marked as required have been assigned a value.
A protected $parametersRequired property must contain the names of the required parameters on the class that will use this trait method. and all parameters must each have a defined get accessor on the class object instance
in CanCleanParameters at line 60
protected array
propertiesToArray()
This method picks up all the defined properties the $parameterRequired|$parameterOptional property array list from the class object and returns an array containing each list item name as a key and the matching property value from the class
in CanCleanParameters at line 93
protected mixed
accessPropertyByKey(string $key)
This method calls the accessors for keys passed in and returns back the value it receives from the class instance
throws an error if a defined parameter in the $parameterRequired|$parameterOptional does not have a reachable get[PropertyName] accessor defined on the class instance.
at line 71
protected SendMoney
to(number $customerMsisdn)
This api method sets the rceiver's phone number.
(requred by the Hubtel SendMoney Api)
at line 83
SendMoney
customerName(string $customerName)
This api method sets the receiver's name (requred by the Hubtel SendMoney Api)
at line 95
SendMoney
recepientName(string $customerName)
This api method sets the receiver's name (requred by the Hubtel SendMoney Api)
at line 106
SendMoney
customerEmail(string $customerEmail)
This api method sets the receiver's email (requred by the Hubtel SendMoney Api)
at line 118
SendMoney
description(string $description)
This method sets the description of the transaction. Best used to describe why the money is being sent for future reference and book keeping.
(requred by the Hubtel SendMoney Api)
at line 128
SendMoney
reference(string|number $reference)
Sets a reference to reference a transaction from your end.
at line 137
Object
run()
The method runs the transaction