1 | <?php |
||
15 | class MazzumaPayment |
||
16 | { |
||
17 | /** @var string The API access token */ |
||
18 | private $key; |
||
19 | /** @var string The Network directional flow of payment */ |
||
20 | private $flow; |
||
21 | /** @var string The network of the Sender */ |
||
22 | private $payeeNetwork; |
||
23 | /** @var string The Sender Telephone Number */ |
||
24 | private $from; |
||
25 | /** @var string The Reciever Telephone Number */ |
||
26 | private $to; |
||
27 | /** @var integer The amount being Transfered */ |
||
28 | private $amount; |
||
29 | /** @var integer The response from the API */ |
||
30 | private $apiResponse; |
||
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 | private function getSenderNetwork($paymentFlow) |
||
220 | |||
221 | /** |
||
222 | * returns the Reciever |
||
223 | * |
||
224 | * @return object |
||
225 | */ |
||
226 | public function getPayeeNetwork() |
||
230 | |||
231 | /** |
||
232 | * Sets the Option Parameter in the Data Payload |
||
233 | *` |
||
234 | * @param string $paymentDirection The flow of the Payment |
||
235 | * |
||
236 | * @return string Returns the ioption value for the payload |
||
237 | */ |
||
238 | private function setPaymentRoute($paymentDirection) |
||
273 | |||
274 | /** |
||
275 | * returns the Flow of the Transaction |
||
276 | * |
||
277 | * @return string |
||
278 | */ |
||
279 | public function getFlow() |
||
283 | |||
284 | /** |
||
285 | * Validates The telephone Numbers |
||
286 | * |
||
287 | * @param string $telephone The telephone number of a reciever or sender |
||
288 | * |
||
289 | * @return boolean |
||
290 | */ |
||
291 | private function validateTelephone($telephone) |
||
301 | |||
302 | /** |
||
303 | * Validates The Amount |
||
304 | * |
||
305 | * @param string $amount The amount been transacted |
||
306 | * |
||
307 | * @return boolean |
||
308 | */ |
||
309 | private function validateAmount($amount) |
||
317 | } |
||
318 |