1 | <?php |
||
14 | class VoiceAndText extends Vtu |
||
15 | { |
||
16 | private $baseUrl = 'https://www.voiceandtext.com/portal/vtu_api.php'; |
||
17 | private $orderId; |
||
18 | private const BUY_AIRTIME = 'APIBuyAirTime'; |
||
19 | private const BUY_DATA = 'APIBuyDataPlan'; |
||
20 | private const PAY_UTILITY = 'APIBuyCableTv'; |
||
21 | private const QUERY_ORDER = 'APIQueryTransaction'; |
||
22 | private const CANCEL_ORDER = 'APICancelTransaction'; |
||
23 | |||
24 | private $statusCodes = [ |
||
25 | 'MISSING_MOBILENETWORK' => 'Mobile network is empty', |
||
26 | 'MISSING_AMOUNT' => 'Amount is empty', |
||
27 | |||
28 | 'INVALID_ AMOUNT' => 'Amount is not valid', |
||
29 | |||
30 | 'INVALID_AIRTIME_AMOUNT' => |
||
31 | 'Minimum amount is 100 and Minimum amount is 50,000', |
||
32 | |||
33 | |||
34 | 'INVALID_RECIPIENT' => |
||
35 | 'An invalid mobile phone number was entered', |
||
36 | |||
37 | 'INSUFICINET_FUND' => |
||
38 | 'Insufficient user wallet balance', |
||
39 | |||
40 | |||
41 | 'INVALID_SERVER_RESPONSE' => |
||
42 | 'Unable to process request', |
||
43 | 'SERVER_ERROR' => |
||
44 | 'Server downtime', |
||
45 | |||
46 | |||
47 | 'INVALID_COMMAND' => |
||
48 | 'The command parameter is not valid', |
||
49 | |||
50 | 'INVALID_API_ KEY' => |
||
51 | 'API Key is wrong', |
||
52 | 'ORDER_RECEIVED' => |
||
53 | 'Your order has been received', |
||
54 | 'MISSING_DATAPLAN'=> |
||
55 | 'Data plan is empty', |
||
56 | |||
57 | 'INVALID_DATAPLAN'=> |
||
58 | 'Data plan is not valid', |
||
59 | |||
60 | |||
61 | 'INVALID_SMARTCARDNO'=> |
||
62 | 'An invalid smartcard number was entered', |
||
63 | 'MISSING_CABLETV'=> |
||
64 | 'The URL format is not valid.', |
||
65 | |||
66 | 'MISSING_PACKAGE'=> |
||
67 | 'Package field is empty', |
||
68 | |||
69 | |||
70 | 'PACKAGE_NOT_AVAILABLE'=> |
||
71 | 'Selected package is not currently available', |
||
72 | |||
73 | ]; |
||
74 | |||
75 | /** |
||
76 | * Class Constructor. |
||
77 | * @param null $token |
||
78 | */ |
||
79 | 5 | public function __construct($token = null) |
|
87 | |||
88 | |||
89 | /** |
||
90 | * @inheritDoc |
||
91 | */ |
||
92 | 3 | public function buyAirtime($amount, $mobileNumber, $mobileNetwork, $callBackUrl): bool |
|
120 | |||
121 | /** |
||
122 | * @inheritDoc |
||
123 | */ |
||
124 | public function buyData($mobileNumber, $mobileNetwork, $dataPlan, $callbackUrl): bool |
||
152 | |||
153 | /** |
||
154 | * @inheritDoc |
||
155 | */ |
||
156 | public function payUtility($smartCardNumber, $cableTv, $package, $callbackUrl): bool |
||
185 | |||
186 | public function getOrderId(): int |
||
190 | |||
191 | /**Check order status |
||
192 | * @param $orderId |
||
193 | * @return bool |
||
194 | */ |
||
195 | public function queryOrder($orderId) |
||
221 | |||
222 | /**Cancel ongoing order |
||
223 | * @param $orderId |
||
224 | * @return bool |
||
225 | */ |
||
226 | public function cancelOrder($orderId) |
||
252 | } |
||
253 |