Completed
Push — master ( cc5910...a6f872 )
by
unknown
14s queued 11s
created
catalog/ext/modules/payment/pagantis/notifyController.php 1 patch
Spacing   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -86,22 +86,22 @@  discard block
 block discarded – undo
86 86
             $jsonResponse->setException($exception);
87 87
             $this->insertLog($exception);
88 88
 
89
-            if ($this->extraConfig['PAGANTIS_URL_KO'] =! '') {
89
+            if ($this->extraConfig['PAGANTIS_URL_KO'] = !'') {
90 90
                 $koUrl = $this->extraConfig['PAGANTIS_URL_KO'];
91
-            } else {
91
+            }else {
92 92
                 $koUrl = trim(tep_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL', false));
93 93
             }
94 94
 
95 95
             if ($this->origin == 'notify') {
96 96
                 $jsonResponse->printResponse();
97
-            } else {
97
+            }else {
98 98
                 if ($exception->getMessage() == AlreadyProcessedException::ERROR_MESSAGE) {
99
-                    if ($this->extraConfig['PAGANTIS_URL_OK']!='') {
99
+                    if ($this->extraConfig['PAGANTIS_URL_OK'] != '') {
100 100
                         $confirmationUrl = $this->extraConfig['PAGANTIS_URL_OK'];
101
-                        $confirmationUrl.="?order_id=$this->merchantOrderId";
102
-                    } else {
101
+                        $confirmationUrl .= "?order_id=$this->merchantOrderId";
102
+                    }else {
103 103
                         $confirmationUrl = trim(tep_href_link(FILENAME_ACCOUNT_HISTORY_INFO, '', 'SSL', false));
104
-                        $confirmationUrl.="?order_id=$this->merchantOrderId";
104
+                        $confirmationUrl .= "?order_id=$this->merchantOrderId";
105 105
                     }
106 106
 
107 107
                     header("Location: $confirmationUrl");
@@ -136,7 +136,7 @@  discard block
 block discarded – undo
136 136
 
137 137
         if ($this->origin == 'notify') {
138 138
             $jsonResponse->printResponse();
139
-        } else {
139
+        }else {
140 140
             return $jsonResponse;
141 141
         }
142 142
     }
@@ -213,12 +213,12 @@  discard block
 block discarded – undo
213 213
         try {
214 214
             $this->checkPagantisStatus(array('AUTHORIZED'));
215 215
         } catch (\Exception $e) {
216
-            if ($this->findOscommerceOrderId()!='') {
216
+            if ($this->findOscommerceOrderId() != '') {
217 217
                 throw new AlreadyProcessedException();
218
-            } else {
218
+            }else {
219 219
                 if ($this->pagantisOrder instanceof \Pagantis\OrdersApiClient\Model\Order) {
220 220
                     $status = $this->pagantisOrder->getStatus();
221
-                } else {
221
+                }else {
222 222
                     $status = '-';
223 223
                 }
224 224
                 throw new WrongStatusException($status);
@@ -233,7 +233,7 @@  discard block
 block discarded – undo
233 233
     {
234 234
         global $order;
235 235
 
236
-        if ($order->info['order_status']!=='1') {
236
+        if ($order->info['order_status'] !== '1') {
237 237
             throw new AlreadyProcessedException();
238 238
         }
239 239
     }
@@ -264,7 +264,7 @@  discard block
 block discarded – undo
264 264
             $this->pagantisOrder = $this->orderClient->getOrder($this->pagantisOrderId);
265 265
             if ($this->pagantisOrder->getStatus() !== Order::STATUS_CONFIRMED) {
266 266
                 throw new UnknownException($e->getMessage());
267
-            } else {
267
+            }else {
268 268
                 $logMessage = 'Concurrency issue: Order_id '.$this->pagantisOrderId.' was confirmed by other process';
269 269
                 $this->insertLog(null, $logMessage);
270 270
             }
@@ -322,7 +322,7 @@  discard block
 block discarded – undo
322 322
                     self::CONCURRENCY_TIMEOUT
323 323
                 );
324 324
                 tep_db_query($query);
325
-            } elseif ($orderId!='') {
325
+            } elseif ($orderId != '') {
326 326
                 $query = "delete from ".TABLE_PAGANTIS_CONCURRENCY." where id='$orderId'";
327 327
                 tep_db_query($query);
328 328
             }
@@ -343,7 +343,7 @@  discard block
 block discarded – undo
343 343
             if (isset($orderRow['timestamp'])) {
344 344
                 if ($this->origin == 'notify') {
345 345
                     throw new ConcurrencyException();
346
-                } else {
346
+                }else {
347 347
                     $query = sprintf(
348 348
                         "SELECT TIMESTAMPDIFF(SECOND,NOW()-INTERVAL %s SECOND, timestamp) as rest FROM %s %s",
349 349
                         self::CONCURRENCY_TIMEOUT,
@@ -353,7 +353,7 @@  discard block
 block discarded – undo
353 353
                     $resultsSelect = tep_db_query($query);
354 354
                     $resultsArray = tep_db_fetch_array($resultsSelect);
355 355
                     $restSeconds = isset($resultsArray['rest']) ? ($resultsArray['rest']) : 0;
356
-                    $expirationSec = ($restSeconds>self::CONCURRENCY_TIMEOUT)? self::CONCURRENCY_TIMEOUT : $restSeconds;
356
+                    $expirationSec = ($restSeconds > self::CONCURRENCY_TIMEOUT) ? self::CONCURRENCY_TIMEOUT : $restSeconds;
357 357
                     if ($expirationSec > 0) {
358 358
                         sleep($expirationSec + 1);
359 359
                     }
@@ -368,8 +368,8 @@  discard block
 block discarded – undo
368 368
                     $os_order_id = tep_db_fetch_array($resultsSelect);
369 369
                     if (isset($os_order_id['os_order_id'])) {
370 370
                         $redirectUrl = trim(tep_href_link(FILENAME_ACCOUNT_HISTORY_INFO, '', 'SSL', false));
371
-                        $redirectUrl.="?order_id=$this->oscommerceOrderId";
372
-                    } else {
371
+                        $redirectUrl .= "?order_id=$this->oscommerceOrderId";
372
+                    }else {
373 373
                         $redirectUrl = trim(tep_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL', false));
374 374
                     }
375 375
 
@@ -385,7 +385,7 @@  discard block
 block discarded – undo
385 385
                     header("Location: $redirectUrl");
386 386
                     exit;
387 387
                 }
388
-            } else {
388
+            }else {
389 389
                 $query = "INSERT INTO ".TABLE_PAGANTIS_CONCURRENCY." (id) VALUES ('$this->oscommerceOrderId');";
390 390
                 tep_db_query($query);
391 391
             }
@@ -415,12 +415,12 @@  discard block
 block discarded – undo
415 415
             if (!$payed) {
416 416
                 if ($this->pagantisOrder instanceof \Pagantis\OrdersApiClient\Model\Order) {
417 417
                     $status = $this->pagantisOrder->getStatus();
418
-                } else {
418
+                }else {
419 419
                     $status = '-';
420 420
                 }
421 421
                 throw new WrongStatusException($status);
422 422
             }
423
-        } else {
423
+        }else {
424 424
             throw new OrderNotFoundException();
425 425
         }
426 426
     }
@@ -466,12 +466,12 @@  discard block
 block discarded – undo
466 466
         $metadataInfo = '';
467 467
         foreach ($metadataOrder as $metadataKey => $metadataValue) {
468 468
             if ($metadataKey == 'promotedProduct') {
469
-                $metadataInfo.= "/Producto promocionado = $metadataValue";
469
+                $metadataInfo .= "/Producto promocionado = $metadataValue";
470 470
             }
471 471
         }
472 472
 
473 473
         $comment = "Pagantis id=$this->pagantisOrderId/Via=".ucfirst($this->origin)."/".$metadataInfo;
474
-        $query = "insert into ".TABLE_ORDERS_STATUS_HISTORY ."(comments, orders_id, orders_status_id, customer_notified,
474
+        $query = "insert into ".TABLE_ORDERS_STATUS_HISTORY."(comments, orders_id, orders_status_id, customer_notified,
475 475
         date_added) values ('$comment', ".$insert_id.", '2', -1, now() )";
476 476
         tep_db_query($query);
477 477
 
@@ -501,10 +501,10 @@  discard block
 block discarded – undo
501 501
      */
502 502
     private function insertLog($exception = null, $message = null)
503 503
     {
504
-        $logEntry= new LogEntry();
504
+        $logEntry = new LogEntry();
505 505
         if ($exception instanceof \Exception) {
506 506
             $logEntryJson = $logEntry->error($exception)->toJson();
507
-        } else {
507
+        }else {
508 508
             $logEntryJson = $logEntry->info($message)->toJson();
509 509
         }
510 510
             $query = "insert into ".TABLE_PAGANTIS_LOG."(log) values ('$logEntryJson')";
Please login to merge, or discard this patch.