1 | <?php |
||
7 | class XMLRequest extends AbstractRequest |
||
8 | { |
||
9 | /** |
||
10 | * @var array |
||
11 | */ |
||
12 | public static $allowedMethods = [ |
||
13 | 'cancel', |
||
14 | 'getBalance', |
||
15 | 'checkCoupon', |
||
16 | 'getReportBySms', |
||
17 | 'getReportBySource', |
||
18 | 'getReportByNumber', |
||
19 | ]; |
||
20 | |||
21 | /** |
||
22 | * @param string $smsId |
||
23 | * @return array|null |
||
24 | */ |
||
25 | public function cancel($smsId) |
||
29 | |||
30 | /** |
||
31 | * @param string $coupon |
||
32 | * @param bool $markAsUsed |
||
33 | * @param null|string $phone |
||
34 | * @return array|null |
||
35 | */ |
||
36 | public function checkCoupon($coupon, $markAsUsed = true, $phone = null) |
||
47 | |||
48 | /** |
||
49 | * @param string $dateFrom |
||
50 | * @param string $dateTo |
||
51 | * @param null|string $source |
||
52 | * @return array|null |
||
53 | */ |
||
54 | public function getReportBySource($dateFrom, $dateTo, $source = null) |
||
65 | |||
66 | /** |
||
67 | * @param string $smsId |
||
68 | * @return array|null |
||
69 | */ |
||
70 | public function getReportBySms($smsId) |
||
74 | |||
75 | /** |
||
76 | * @param string $dateFrom |
||
77 | * @param string $dateTo |
||
78 | * @param null|string $number |
||
79 | * @return array|null |
||
80 | */ |
||
81 | public function getReportByNumber($dateFrom, $dateTo, $number = null) |
||
90 | |||
91 | /** |
||
92 | * @return array|null |
||
93 | */ |
||
94 | public function getBalance() |
||
98 | |||
99 | public function exec($action, $params = [], $method = 'POST') |
||
103 | |||
104 | |||
105 | /** |
||
106 | * @param string $action |
||
107 | * @return string |
||
108 | */ |
||
109 | protected function makeEndPoint($action) |
||
113 | |||
114 | /** |
||
115 | * @param array $requestBody |
||
116 | * @return string|array |
||
117 | */ |
||
118 | protected function formatRequestBody(array $requestBody) |
||
122 | |||
123 | /** |
||
124 | * Parses XML from response and returns it as an array |
||
125 | * |
||
126 | * @param string $response |
||
127 | * @return array |
||
128 | */ |
||
129 | protected function parseResponse($response) |
||
134 | } |