@@ -14,10 +14,10 @@ discard block |
||
| 14 | 14 | public function subscribe(Dispatcher $events) |
| 15 | 15 | { |
| 16 | 16 | // Listen events and send notification |
| 17 | - $events->listen(UnitPayEvent::class, function ($event) { |
|
| 17 | + $events->listen(UnitPayEvent::class, function($event) { |
|
| 18 | 18 | $event->type = str_replace('unitpay.', '', $event->type); |
| 19 | 19 | |
| 20 | - if (! in_array($event->type, ['info', 'success', 'error'])) { |
|
| 20 | + if (!in_array($event->type, ['info', 'success', 'error'])) { |
|
| 21 | 21 | $event->type = 'error'; |
| 22 | 22 | } |
| 23 | 23 | |
@@ -26,7 +26,7 @@ discard block |
||
| 26 | 26 | $notification = app(config('unitpay.notification')); |
| 27 | 27 | $notification->setEvent($event); |
| 28 | 28 | |
| 29 | - if (! $this->isValidNotificationClass($notification)) { |
|
| 29 | + if (!$this->isValidNotificationClass($notification)) { |
|
| 30 | 30 | throw InvalidConfiguration::notificationClassInvalid(get_class($notification)); |
| 31 | 31 | } |
| 32 | 32 | |
@@ -53,7 +53,7 @@ discard block |
||
| 53 | 53 | { |
| 54 | 54 | $callable = config('unitpay.notificationFilter'); |
| 55 | 55 | |
| 56 | - if (! is_callable($callable)) { |
|
| 56 | + if (!is_callable($callable)) { |
|
| 57 | 57 | return true; |
| 58 | 58 | } |
| 59 | 59 | |
@@ -15,7 +15,7 @@ discard block |
||
| 15 | 15 | /* |
| 16 | 16 | * locale for payment form |
| 17 | 17 | */ |
| 18 | - 'locale' => 'ru', // ru || en |
|
| 18 | + 'locale' => 'ru', // ru || en |
|
| 19 | 19 | |
| 20 | 20 | /* |
| 21 | 21 | * Hide other payment methods |
@@ -81,7 +81,7 @@ discard block |
||
| 81 | 81 | 'channels' => ['mail', 'slack'], |
| 82 | 82 | |
| 83 | 83 | 'mail' => [ |
| 84 | - 'to' => '', // your email |
|
| 84 | + 'to' => '', // your email |
|
| 85 | 85 | ], |
| 86 | 86 | |
| 87 | 87 | 'slack' => [ |
@@ -47,7 +47,7 @@ |
||
| 47 | 47 | |
| 48 | 48 | return $slack_message |
| 49 | 49 | ->content('UnitPay payment message from '.config('app.url')) |
| 50 | - ->attachment(function (SlackAttachment $attachment) { |
|
| 50 | + ->attachment(function(SlackAttachment $attachment) { |
|
| 51 | 51 | $attachment->fields([ |
| 52 | 52 | 'Title' => $this->event->title, |
| 53 | 53 | 'IP' => $this->event->ip, |
@@ -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 = ['UNITPAY_orderStatus', 'UNITPAY_orderSum', 'UNITPAY_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; |
@@ -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 | |
@@ -352,14 +352,14 @@ discard block |
||
| 352 | 352 | public function payOrderFromGate(Request $request) |
| 353 | 353 | { |
| 354 | 354 | // Validate request params from UnitPay server. |
| 355 | - if (! $this->validateOrderRequestFromGate($request)) { |
|
| 355 | + if (!$this->validateOrderRequestFromGate($request)) { |
|
| 356 | 356 | return $this->responseError('validateOrderRequestFromGate'); |
| 357 | 357 | } |
| 358 | 358 | |
| 359 | 359 | // Search and return order |
| 360 | 360 | $order = $this->callFilterSearchOrder($request); |
| 361 | 361 | |
| 362 | - if (! $order) { |
|
| 362 | + if (!$order) { |
|
| 363 | 363 | return $this->responseError('searchOrderFilter'); |
| 364 | 364 | } |
| 365 | 365 | |
@@ -389,7 +389,7 @@ discard block |
||
| 389 | 389 | |
| 390 | 390 | // PaidOrderFilter - update order into DB as paid & other actions |
| 391 | 391 | // if return false then error |
| 392 | - if (! $this->callFilterPaidOrder($request, $order)) { |
|
| 392 | + if (!$this->callFilterPaidOrder($request, $order)) { |
|
| 393 | 393 | $this->eventFillAndSend('unitpay.error', 'callFilterPaidOrder', $request); |
| 394 | 394 | |
| 395 | 395 | return $this->responseError('callFilterPaidOrder'); |
@@ -15,7 +15,7 @@ discard block |
||
| 15 | 15 | |
| 16 | 16 | /** |
| 17 | 17 | * Allow access, if the ip address is in the whitelist. |
| 18 | - * @param $ip |
|
| 18 | + * @param string|null $ip |
|
| 19 | 19 | * @return bool |
| 20 | 20 | */ |
| 21 | 21 | public function allowIP($ip) |
@@ -30,7 +30,7 @@ discard block |
||
| 30 | 30 | |
| 31 | 31 | /** |
| 32 | 32 | * Return JSON error message. |
| 33 | - * @param $message |
|
| 33 | + * @param string $message |
|
| 34 | 34 | * @return mixed |
| 35 | 35 | */ |
| 36 | 36 | public function responseError($message) |
@@ -42,7 +42,7 @@ discard block |
||
| 42 | 42 | |
| 43 | 43 | /** |
| 44 | 44 | * Return JSON success message. |
| 45 | - * @param $message |
|
| 45 | + * @param string $message |
|
| 46 | 46 | * @return mixed |
| 47 | 47 | */ |
| 48 | 48 | public function responseOK($message) |
@@ -54,8 +54,8 @@ discard block |
||
| 54 | 54 | |
| 55 | 55 | /** |
| 56 | 56 | * Fill event details to pass the title and request params as array. |
| 57 | - * @param $event_type |
|
| 58 | - * @param $event_title |
|
| 57 | + * @param string $event_type |
|
| 58 | + * @param string $event_title |
|
| 59 | 59 | * @param Request $request |
| 60 | 60 | */ |
| 61 | 61 | 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 | */ |
@@ -34,7 +34,7 @@ |
||
| 34 | 34 | |
| 35 | 35 | $this->app['events']->subscribe(UnitPayNotifier::class); |
| 36 | 36 | |
| 37 | - $this->app->singleton('unitpay', function () { |
|
| 37 | + $this->app->singleton('unitpay', function() { |
|
| 38 | 38 | return $this->app->make('ActionM\UnitPay\UnitPay'); |
| 39 | 39 | }); |
| 40 | 40 | |