1 | <?php |
||
8 | class Purchase |
||
9 | { |
||
10 | /** |
||
11 | * Generate the encoded string with parameters. |
||
12 | * |
||
13 | * @param \Omnipay\Paysera\Message\PurchaseRequest $request |
||
14 | * @return string |
||
15 | * |
||
16 | * @throws \Omnipay\Common\Exception\InvalidRequestException |
||
17 | */ |
||
18 | 5 | public static function generate(PurchaseRequest $request) |
|
30 | |||
31 | /** |
||
32 | * Get the parameters from the request. |
||
33 | * |
||
34 | * @param \Omnipay\Paysera\Message\PurchaseRequest $request |
||
35 | * @return array |
||
36 | */ |
||
37 | 5 | protected static function parameters(PurchaseRequest $request) |
|
53 | |||
54 | /** |
||
55 | * Get the customer from card. |
||
56 | * |
||
57 | * @param \Omnipay\Common\CreditCard $card |
||
58 | * @return array |
||
59 | */ |
||
60 | 4 | protected static function customer($card) |
|
73 | |||
74 | /** |
||
75 | * Get the filtered parameters. |
||
76 | * |
||
77 | * @param array $parameters |
||
78 | * @return array |
||
79 | */ |
||
80 | protected static function filterParameters(array $parameters) |
||
86 | |||
87 | /** |
||
88 | * Validate the data. |
||
89 | * |
||
90 | * @param array $data |
||
91 | * @return void |
||
92 | * @throws \Omnipay\Common\Exception\InvalidRequestException |
||
93 | */ |
||
94 | 5 | public static function validate(array $data) |
|
121 | |||
122 | /** |
||
123 | * Get the request specifications. |
||
124 | * |
||
125 | * Array structure: |
||
126 | * name – request parameter name |
||
127 | * maxLength – max allowed length for parameter |
||
128 | * required – is this parameter required |
||
129 | * regexp – regexp to test parameter value |
||
130 | * |
||
131 | * @return array |
||
132 | */ |
||
133 | 5 | protected static function getRequestSpecifications() |
|
156 | |||
157 | /** |
||
158 | * Determine the parameter is required but missing. |
||
159 | * |
||
160 | * @param bool $isRequired |
||
161 | * @param array $data |
||
162 | * @param string $name |
||
163 | * @return bool |
||
164 | */ |
||
165 | 5 | protected static function isRequiredButMissing($isRequired, $data, $name) |
|
169 | |||
170 | /** |
||
171 | * Determine the parameter exists. |
||
172 | * |
||
173 | * @param array $data |
||
174 | * @param string $name |
||
175 | * @return bool |
||
176 | */ |
||
177 | 4 | protected static function exists($data, $name) |
|
181 | |||
182 | /** |
||
183 | * Determine the parameter value is too long. |
||
184 | * |
||
185 | * @param mixed $maxLength |
||
186 | * @param string $value |
||
187 | * @return bool |
||
188 | */ |
||
189 | 4 | protected static function isTooLong($maxLength, $value) |
|
193 | |||
194 | /** |
||
195 | * Determine the parameter value is invalid. |
||
196 | * |
||
197 | * @param string $regexp |
||
198 | * @param string $value |
||
199 | * @return bool |
||
200 | */ |
||
201 | 3 | protected static function isInvalid($regexp, $value) |
|
205 | } |
||
206 |