1 | <?php |
||
15 | class MazzumaPayment |
||
16 | { |
||
17 | /** @var string The API access token */ |
||
18 | private $key = null; |
||
19 | /** @var string The Network directional flow of payment */ |
||
20 | private $flow = null; |
||
21 | /** @var string The network of the Sender */ |
||
22 | private $payeeNetwork = null; |
||
23 | /** @var string The Sender Telephone Number */ |
||
24 | private $from = null; |
||
25 | /** @var string The Reciever Telephone Number */ |
||
26 | private $to = null; |
||
27 | /** @var integer The amount being Transfered */ |
||
28 | private $amount = null; |
||
29 | /** @var integer The response from the API */ |
||
30 | private $apiResponse = null; |
||
31 | |||
32 | /** @var string The API URL */ |
||
33 | private $api = 'https://client.teamcyst.com/api_call.php'; |
||
34 | |||
35 | |||
36 | /** |
||
37 | * Creates a new MazzumaPayment Instance |
||
38 | * |
||
39 | */ |
||
40 | public function __construct($key) |
||
44 | |||
45 | /** |
||
46 | * Calls the API to process the transaction |
||
47 | * |
||
48 | * @return object The Response from the API Call |
||
49 | */ |
||
50 | public function send() |
||
74 | |||
75 | /** |
||
76 | * Parses the Payment Details into Json for API call |
||
77 | * @param $paymentDirectionalFlow string The Network directional flow of payment |
||
78 | * @param $payeeNetwork string The Network Operator of the Sender |
||
79 | * @param $APIKey string The API access key, as obtained on https://dashboard.mazzuma.com/ |
||
80 | * @param $payee string The Sender Telephone Number |
||
81 | * @param $reciever string The Recievers Telephone Number |
||
82 | * @param $amount integer The amount been transacted |
||
83 | * @return object |
||
84 | */ |
||
85 | private function parsePaymentDetails( |
||
106 | |||
107 | /** |
||
108 | * Sets the Sender |
||
109 | * @param $payee string The telephone Number of the Sender |
||
110 | * |
||
111 | * @return object |
||
112 | */ |
||
113 | public function from($payee) |
||
120 | |||
121 | /** |
||
122 | * returns the Sender |
||
123 | * |
||
124 | * @return string |
||
125 | */ |
||
126 | public function getFrom() |
||
130 | |||
131 | /** |
||
132 | * Sets the Reciever |
||
133 | * @param $reciever string The telephone Number of the Reciever |
||
134 | * |
||
135 | * @return object |
||
136 | */ |
||
137 | public function to($reciever) |
||
144 | |||
145 | /** |
||
146 | * returns the Reciever |
||
147 | * |
||
148 | * @return object |
||
149 | */ |
||
150 | public function getTo() |
||
154 | |||
155 | /** |
||
156 | * Sets the Amount |
||
157 | * @param $totalAmount string The amount to be sent |
||
158 | * |
||
159 | * @return object |
||
160 | */ |
||
161 | public function amount($totalAmount) |
||
168 | |||
169 | /** |
||
170 | * returns the Amount |
||
171 | * @param $totalAmount string The amount to be sent |
||
172 | * |
||
173 | * @return integer |
||
174 | */ |
||
175 | public function getAmount() |
||
179 | |||
180 | /** |
||
181 | * Sets the Sender Network |
||
182 | * @param $paymentFlow string The flow of the Payment |
||
183 | * |
||
184 | * @return object |
||
185 | */ |
||
186 | public function transfer($paymentFlow) |
||
194 | |||
195 | /** |
||
196 | * Checks if payment was successful |
||
197 | * |
||
198 | * @return boolean |
||
199 | */ |
||
200 | public function isSuccessful() |
||
208 | |||
209 | /** |
||
210 | * Gets the Sender Network from the payment Flow |
||
211 | * |
||
212 | * @return boolean |
||
213 | */ |
||
214 | public function getSenderNetwork($paymentFlow) |
||
220 | |||
221 | /** |
||
222 | * Sets the Option Parameter in the Data Payload |
||
223 | *` |
||
224 | * @param string $paymentDirection The flow of the Payment |
||
225 | * |
||
226 | * @return string Returns the ioption value for the payload |
||
227 | */ |
||
228 | private function setPaymentRoute($paymentDirection) |
||
263 | |||
264 | /** |
||
265 | * Validates The telephone Numbers |
||
266 | * |
||
267 | * @param string $telephone The telephone number of a reciever or sender |
||
268 | * |
||
269 | * @return boolean |
||
270 | */ |
||
271 | private function validateTelephone($telephone) |
||
281 | |||
282 | /** |
||
283 | * Validates The Amount |
||
284 | * |
||
285 | * @param string $amount The amount been transacted |
||
286 | * |
||
287 | * @return boolean |
||
288 | */ |
||
289 | private function validateAmount($amount) |
||
297 | } |
||
298 |