1 | <?php |
||
14 | class MobileHash implements QueryInterface |
||
15 | { |
||
16 | /** @var string user phone number */ |
||
17 | private $phone; |
||
18 | |||
19 | /** @var string user personal code */ |
||
20 | private $code; |
||
21 | |||
22 | /** @var string Hash to sign */ |
||
23 | private $hash; |
||
24 | |||
25 | /** @var string Hash algorithm */ |
||
26 | private $hashAlgorithm; |
||
27 | |||
28 | /** @var string Signature encryption type. */ |
||
29 | private $encryption; |
||
30 | |||
31 | /** @var string Message displayed on the phone screen. Attention: UTF-8 symbols are not allowed */ |
||
32 | private $message; |
||
33 | |||
34 | /** @var string Language for messages displayed on the phone screen */ |
||
35 | private $language; |
||
36 | |||
37 | /** |
||
38 | * @param string $phone |
||
39 | * @param string $code |
||
40 | * @param string $hash |
||
41 | * @param string $hashAlgorithm |
||
42 | * @param string $encryption |
||
43 | * @param string $message |
||
44 | * @param string $language |
||
45 | */ |
||
46 | 5 | public function __construct( |
|
63 | |||
64 | /** |
||
65 | * Field and values association used in query |
||
66 | * @return array |
||
67 | */ |
||
68 | 1 | public function getFields() |
|
69 | { |
||
70 | return [ |
||
71 | 1 | 'phone' => $this->phone, |
|
72 | 1 | 'code' => $this->code, |
|
73 | 1 | 'hash' => $this->hash, |
|
74 | 1 | 'hash_algorithm' => $this->hashAlgorithm, |
|
75 | 1 | 'encryption' => $this->encryption, |
|
76 | 1 | 'message' => $this->message, |
|
77 | 1 | 'language' => $this->language, |
|
78 | ]; |
||
79 | } |
||
80 | |||
81 | /** |
||
82 | * Validation constraints for request data validation |
||
83 | * @return Assert\Collection |
||
84 | */ |
||
85 | 1 | public function getValidationConstraints() |
|
86 | { |
||
87 | 1 | return new Assert\Collection([ |
|
88 | 1 | 'phone' => new Assert\Required([ |
|
89 | 1 | new Assert\NotBlank(), |
|
90 | 1 | new Phone(), |
|
91 | ]), |
||
92 | 1 | 'code' => new Assert\Required([ |
|
93 | 1 | new Assert\NotBlank(), |
|
94 | 1 | new Code() |
|
95 | ]), |
||
96 | 1 | 'hash' => new Assert\NotBlank(), |
|
97 | 1 | 'hash_algorithm' => new Assert\NotBlank(), |
|
98 | 1 | 'encryption' => new Assert\NotBlank(), |
|
99 | 1 | 'message' => new Assert\NotBlank(), |
|
100 | 1 | 'language' => new Assert\NotBlank(), |
|
101 | ]); |
||
102 | } |
||
103 | |||
104 | /** |
||
105 | * Result object for this query result |
||
106 | * @return MobileHashResult |
||
107 | */ |
||
108 | 1 | public function createResult() |
|
112 | |||
113 | /** |
||
114 | * API action name, part of full API request url |
||
115 | * @return string |
||
116 | */ |
||
117 | 1 | public function getAction() |
|
121 | |||
122 | /** |
||
123 | * HTTP method to use |
||
124 | * @return string |
||
125 | */ |
||
126 | 1 | public function getMethod() |
|
130 | } |
||
131 |