@@ -16,7 +16,7 @@ discard block |
||
| 16 | 16 | |
| 17 | 17 | /** |
| 18 | 18 | * Allow access, if the ip address is in the whitelist. |
| 19 | - * @param $ip |
|
| 19 | + * @param string $ip |
|
| 20 | 20 | * @return bool |
| 21 | 21 | */ |
| 22 | 22 | public function allowIP($ip) |
@@ -31,7 +31,7 @@ discard block |
||
| 31 | 31 | |
| 32 | 32 | /** |
| 33 | 33 | * Return JSON error message |
| 34 | - * @param $message |
|
| 34 | + * @param string $message |
|
| 35 | 35 | * @return mixed |
| 36 | 36 | */ |
| 37 | 37 | public function responseError($message) |
@@ -43,7 +43,7 @@ discard block |
||
| 43 | 43 | |
| 44 | 44 | /** |
| 45 | 45 | * Return JSON success message |
| 46 | - * @param $message |
|
| 46 | + * @param string $message |
|
| 47 | 47 | * @return mixed |
| 48 | 48 | */ |
| 49 | 49 | public function responseOK($message) |
@@ -55,8 +55,8 @@ discard block |
||
| 55 | 55 | |
| 56 | 56 | /** |
| 57 | 57 | * Fill event details to pass the title and request params as array. |
| 58 | - * @param $event_type |
|
| 59 | - * @param $event_title |
|
| 58 | + * @param string $event_type |
|
| 59 | + * @param string $event_title |
|
| 60 | 60 | * @param Request $request |
| 61 | 61 | */ |
| 62 | 62 | public function eventFillAndSend($event_type, $event_title, Request $request) |
@@ -325,7 +325,7 @@ discard block |
||
| 325 | 325 | /** |
| 326 | 326 | * Call PaidOrderFilter if order not paid. |
| 327 | 327 | * @param Request $request |
| 328 | - * @param $order |
|
| 328 | + * @param boolean $order |
|
| 329 | 329 | * @return mixed |
| 330 | 330 | * @throws InvalidConfiguration |
| 331 | 331 | */ |
@@ -144,7 +144,7 @@ discard block |
||
| 144 | 144 | ]; |
| 145 | 145 | |
| 146 | 146 | foreach ($required_fields as $key => $value) { |
| 147 | - if (! array_key_exists($value, $order) || empty($order[$value])) { |
|
| 147 | + if (!array_key_exists($value, $order) || empty($order[$value])) { |
|
| 148 | 148 | throw InvalidConfiguration::generatePaymentFormOrderParamsNotSet($value); |
| 149 | 149 | } |
| 150 | 150 | } |
@@ -157,7 +157,7 @@ discard block |
||
| 157 | 157 | 'USD', |
| 158 | 158 | ]; |
| 159 | 159 | |
| 160 | - if (! in_array($order['CURRENCY'], $currency_arr)) { |
|
| 160 | + if (!in_array($order['CURRENCY'], $currency_arr)) { |
|
| 161 | 161 | throw InvalidConfiguration::generatePaymentFormOrderInvalidCurrency($order['CURRENCY']); |
| 162 | 162 | } |
| 163 | 163 | } |
@@ -242,7 +242,7 @@ discard block |
||
| 242 | 242 | */ |
| 243 | 243 | public function validateOrderRequestFromGate(Request $request) |
| 244 | 244 | { |
| 245 | - if (! $this->AllowIP($request->ip()) || ! $this->validate($request) || ! $this->validateSignature($request)) { |
|
| 245 | + if (!$this->AllowIP($request->ip()) || !$this->validate($request) || !$this->validateSignature($request)) { |
|
| 246 | 246 | $this->eventFillAndSend('unitpay.error', 'validateOrderRequestFromGate', $request); |
| 247 | 247 | |
| 248 | 248 | return false; |
@@ -259,7 +259,7 @@ discard block |
||
| 259 | 259 | */ |
| 260 | 260 | public function validateSearchOrderRequiredAttributes(Request $request, $order) |
| 261 | 261 | { |
| 262 | - if (! $order) { |
|
| 262 | + if (!$order) { |
|
| 263 | 263 | $this->eventFillAndSend('unitpay.error', 'orderNotFound', $request); |
| 264 | 264 | |
| 265 | 265 | return false; |
@@ -269,7 +269,7 @@ discard block |
||
| 269 | 269 | $attr = ['orderStatus', 'orderSum', 'orderCurrency']; |
| 270 | 270 | |
| 271 | 271 | foreach ($attr as $k => $value) { |
| 272 | - if (! $order->getAttribute($value)) { |
|
| 272 | + if (!$order->getAttribute($value)) { |
|
| 273 | 273 | $this->eventFillAndSend('unitpay.error', $value.'Invalid', $request); |
| 274 | 274 | |
| 275 | 275 | return false; |
@@ -279,7 +279,7 @@ discard block |
||
| 279 | 279 | // compare order attributes vs request params |
| 280 | 280 | $attr = ['orderSum', 'orderCurrency']; |
| 281 | 281 | foreach ($attr as $k => $value) { |
| 282 | - if ( $order->getAttribute($value) != $request->input('params.'.$value) ) { |
|
| 282 | + if ($order->getAttribute($value) != $request->input('params.'.$value)) { |
|
| 283 | 283 | $this->eventFillAndSend('unitpay.error', $value.'Invalid', $request); |
| 284 | 284 | |
| 285 | 285 | return false; |
@@ -299,7 +299,7 @@ discard block |
||
| 299 | 299 | { |
| 300 | 300 | $callable = config('unitpay.searchOrderFilter'); |
| 301 | 301 | |
| 302 | - if (! is_callable($callable)) { |
|
| 302 | + if (!is_callable($callable)) { |
|
| 303 | 303 | throw InvalidConfiguration::searchOrderFilterInvalid(); |
| 304 | 304 | } |
| 305 | 305 | |
@@ -315,7 +315,7 @@ discard block |
||
| 315 | 315 | |
| 316 | 316 | $order = $callable($request, $request->input('params.account')); |
| 317 | 317 | |
| 318 | - if (! $this->validateSearchOrderRequiredAttributes($request, $order)) { |
|
| 318 | + if (!$this->validateSearchOrderRequiredAttributes($request, $order)) { |
|
| 319 | 319 | return false; |
| 320 | 320 | } |
| 321 | 321 | |
@@ -333,7 +333,7 @@ discard block |
||
| 333 | 333 | { |
| 334 | 334 | $callable = config('unitpay.paidOrderFilter'); |
| 335 | 335 | |
| 336 | - if (! is_callable($callable)) { |
|
| 336 | + if (!is_callable($callable)) { |
|
| 337 | 337 | throw InvalidConfiguration::orderPaidFilterInvalid(); |
| 338 | 338 | } |
| 339 | 339 | |
@@ -349,14 +349,14 @@ discard block |
||
| 349 | 349 | public function payOrderFromGate(Request $request) |
| 350 | 350 | { |
| 351 | 351 | // Validate request params from UnitPay server. |
| 352 | - if (! $this->validateOrderRequestFromGate($request)) { |
|
| 352 | + if (!$this->validateOrderRequestFromGate($request)) { |
|
| 353 | 353 | return $this->responseError('validateOrderRequestFromGate'); |
| 354 | 354 | } |
| 355 | 355 | |
| 356 | 356 | // Search and return order |
| 357 | 357 | $order = $this->callFilterSearchOrder($request); |
| 358 | 358 | |
| 359 | - if (! $order) { |
|
| 359 | + if (!$order) { |
|
| 360 | 360 | return $this->responseError('searchOrderFilter'); |
| 361 | 361 | } |
| 362 | 362 | |
@@ -386,7 +386,7 @@ discard block |
||
| 386 | 386 | |
| 387 | 387 | // PaidOrderFilter - update order into DB as paid & other actions |
| 388 | 388 | // if return false then error |
| 389 | - if (! $this->callFilterPaidOrder($request, $order)) { |
|
| 389 | + if (!$this->callFilterPaidOrder($request, $order)) { |
|
| 390 | 390 | $this->eventFillAndSend('unitpay.error', 'callFilterPaidOrder', $request); |
| 391 | 391 | |
| 392 | 392 | return $this->responseError('callFilterPaidOrder'); |