1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Daaner\NovaPoshta\Models; |
4
|
|
|
|
5
|
|
|
use Daaner\NovaPoshta\NovaPoshta; |
6
|
|
|
use Daaner\NovaPoshta\Traits\Limit; |
7
|
|
|
|
8
|
|
|
class CommonGeneral extends NovaPoshta |
9
|
|
|
{ |
10
|
|
|
use Limit; |
11
|
|
|
|
12
|
|
|
protected $model = 'CommonGeneral'; |
13
|
|
|
protected $calledMethod; |
14
|
|
|
protected $methodProperties = null; |
15
|
|
|
|
16
|
|
|
/** |
17
|
|
|
* Список ошибок. |
18
|
|
|
* |
19
|
|
|
* @see https://developers.novaposhta.ua/view/model/a55b2c64-8512-11ec-8ced-005056b2dbe1/method/a6bce5a1-8512-11ec-8ced-005056b2dbe1 Список ошибок |
20
|
|
|
* |
21
|
|
|
* @return array |
22
|
|
|
*/ |
23
|
|
|
public function getMessageCodeText(): array |
24
|
|
|
{ |
25
|
|
|
$this->calledMethod = 'getMessageCodeText'; |
26
|
|
|
|
27
|
|
|
return $this->getResponse($this->model, $this->calledMethod, $this->methodProperties); |
28
|
|
|
} |
29
|
|
|
|
30
|
|
|
/** |
31
|
|
|
* Продление даты действия API ключа. |
32
|
|
|
* |
33
|
|
|
* @param string $ApiKey API ключ |
34
|
|
|
* @param int|null $month Кол-во месяцев продления |
35
|
|
|
* @return array |
36
|
|
|
*/ |
37
|
|
|
public function prolongateKey(string $ApiKey, ?int $month = 12): array |
38
|
|
|
{ |
39
|
|
|
$this->calledMethod = 'prolongateApiKey'; |
40
|
|
|
|
41
|
|
|
$this->methodProperties['ApiKey'] = $ApiKey; |
42
|
|
|
$this->methodProperties['prolongateMounthCount'] = $month; |
43
|
|
|
|
44
|
|
|
return $this->getResponse($this->model, $this->calledMethod, $this->methodProperties); |
45
|
|
|
} |
46
|
|
|
|
47
|
|
|
/** |
48
|
|
|
* Получение списка API ключей. |
49
|
|
|
* |
50
|
|
|
* @return array |
51
|
|
|
*/ |
52
|
|
|
public function getApiKeysList(): array |
53
|
|
|
{ |
54
|
|
|
$this->calledMethod = 'getApiKeysList'; |
55
|
|
|
|
56
|
|
|
return $this->getResponse($this->model, $this->calledMethod, $this->methodProperties); |
57
|
|
|
} |
58
|
|
|
|
59
|
|
|
/** |
60
|
|
|
* Получение доверенных устройств. |
61
|
|
|
* |
62
|
|
|
* @return array |
63
|
|
|
*/ |
64
|
|
|
public function getTrustedDevicesList(): array |
65
|
|
|
{ |
66
|
|
|
$this->calledMethod = 'getTrustedDevicesList'; |
67
|
|
|
|
68
|
|
|
$this->addLimit(); |
69
|
|
|
$this->getPage(); |
70
|
|
|
|
71
|
|
|
return $this->getResponse($this->model, $this->calledMethod, $this->methodProperties); |
72
|
|
|
} |
73
|
|
|
|
74
|
|
|
/** |
75
|
|
|
* Удаление доверенного устройства со списка. |
76
|
|
|
* |
77
|
|
|
* @param string $Ref Ref устройства |
78
|
|
|
* @return array |
79
|
|
|
*/ |
80
|
|
|
public function deleteTrustedDevice(string $Ref): array |
81
|
|
|
{ |
82
|
|
|
$this->calledMethod = 'deleteTrustedDevice'; |
83
|
|
|
|
84
|
|
|
$this->methodProperties['Ref'] = $Ref; |
85
|
|
|
|
86
|
|
|
return $this->getResponse($this->model, $this->calledMethod, $this->methodProperties); |
87
|
|
|
} |
88
|
|
|
} |
89
|
|
|
|