Passed
Pull Request — master (#59)
by Raúl
05:19 queued 01:21
created
vendor/pagantis/orders-api-client/test/Method/ConfirmOrderMethodTest.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -97,11 +97,11 @@
 block discarded – undo
97 97
         $this->assertInstanceOf('Httpful\Request', $request);
98 98
         $this->assertSame(Http::PUT, $request->method);
99 99
         $uri =
100
-            $url .
101
-            ConfirmOrderMethod::ENDPOINT .
102
-            ConfirmOrderMethod::SLASH .
103
-            $orderId .
104
-            ConfirmOrderMethod::SLASH .
100
+            $url.
101
+            ConfirmOrderMethod::ENDPOINT.
102
+            ConfirmOrderMethod::SLASH.
103
+            $orderId.
104
+            ConfirmOrderMethod::SLASH.
105 105
             ConfirmOrderMethod::CONFIRM_ENDPOINT
106 106
         ;
107 107
         $this->assertSame($uri, $request->uri);
Please login to merge, or discard this patch.
vendor/pagantis/orders-api-client/test/Method/RefundOrderMethodTest.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -120,11 +120,11 @@
 block discarded – undo
120 120
         $this->assertInstanceOf('Httpful\Request', $request);
121 121
         $this->assertSame(Http::POST, $request->method);
122 122
         $uri =
123
-            $url .
124
-            RefundOrderMethod::ENDPOINT .
125
-            RefundOrderMethod::SLASH .
126
-            $orderId .
127
-            RefundOrderMethod::SLASH .
123
+            $url.
124
+            RefundOrderMethod::ENDPOINT.
125
+            RefundOrderMethod::SLASH.
126
+            $orderId.
127
+            RefundOrderMethod::SLASH.
128 128
             RefundOrderMethod::REFUND_ENDPOINT
129 129
         ;
130 130
         $this->assertSame($uri, $request->uri);
Please login to merge, or discard this patch.
vendor/pagantis/orders-api-client/test/Method/GetOrderMethodTest.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -96,7 +96,7 @@
 block discarded – undo
96 96
         $request = $property->getValue($getOrderMethod);
97 97
         $this->assertInstanceOf('Httpful\Request', $request);
98 98
         $this->assertSame(Http::GET, $request->method);
99
-        $uri = $url . GetOrderMethod::ENDPOINT . GetOrderMethod::SLASH . $orderId;
99
+        $uri = $url.GetOrderMethod::ENDPOINT.GetOrderMethod::SLASH.$orderId;
100 100
         $this->assertSame($uri, $request->uri);
101 101
     }
102 102
 
Please login to merge, or discard this patch.
vendor/pagantis/orders-api-client/test/Method/CreateOrderMethodTest.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -97,7 +97,7 @@
 block discarded – undo
97 97
         $this->assertInstanceOf('Httpful\Request', $request);
98 98
         $this->assertSame(Http::POST, $request->method);
99 99
         $uri =
100
-            $url .
100
+            $url.
101 101
             CreateOrderMethod::ENDPOINT
102 102
         ;
103 103
         $this->assertSame($uri, $request->uri);
Please login to merge, or discard this patch.
pagantis/vendor/pagantis/orders-api-client/test/AbstractTest.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@
 block discarded – undo
24 24
      */
25 25
     public function __construct($name = null, array $data = array(), $dataName = '')
26 26
     {
27
-        $this->resourcePath = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'Resources' . DIRECTORY_SEPARATOR;
27
+        $this->resourcePath = dirname(__FILE__).DIRECTORY_SEPARATOR.'Resources'.DIRECTORY_SEPARATOR;
28 28
         parent::__construct($name, $data, $dataName);
29 29
     }
30 30
 }
Please login to merge, or discard this patch.
pagantis/orders-api-client/test/Model/Order/Configuration/UrlsTest.php 1 patch
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -70,8 +70,8 @@
 block discarded – undo
70 70
     }
71 71
 
72 72
     /**
73
- * testSetOk
74
- */
73
+     * testSetOk
74
+     */
75 75
     public function testSetAuthorizedNotificationCallback()
76 76
     {
77 77
         $urls = new Urls();
Please login to merge, or discard this patch.
pagantis/vendor/pagantis/orders-api-client/test/Model/Order/UserTest.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -103,7 +103,7 @@
 block discarded – undo
103 103
     {
104 104
         $faker = Factory::create();
105 105
         $user = new User();
106
-        $fullName = $faker->name . ' ' . $faker->lastName;
106
+        $fullName = $faker->name.' '.$faker->lastName;
107 107
         $user->setFullName($fullName);
108 108
         $this->assertSame($fullName, $user->getFullName());
109 109
     }
Please login to merge, or discard this patch.
pagantis/vendor/pagantis/orders-api-client/examples/simpleTest.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
     //1. User Object
34 34
     writeLog('Creating User object');
35 35
     writeLog('Adding the address of the user');
36
-    $userAddress =  new \Pagantis\OrdersApiClient\Model\Order\User\Address();
36
+    $userAddress = new \Pagantis\OrdersApiClient\Model\Order\User\Address();
37 37
     $userAddress
38 38
         ->setZipCode('28031')
39 39
         ->setFullName('María Sanchez Escudero')
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
 
47 47
     $orderBillingAddress = $userAddress;
48 48
 
49
-    $orderShippingAddress =  new \Pagantis\OrdersApiClient\Model\Order\User\Address();
49
+    $orderShippingAddress = new \Pagantis\OrdersApiClient\Model\Order\User\Address();
50 50
     $orderShippingAddress
51 51
         ->setZipCode('08029')
52 52
         ->setFullName('Alberto Escudero Sanchez')
@@ -131,7 +131,7 @@  discard block
 block discarded – undo
131 131
         ->setUser($orderUser);
132 132
 
133 133
     writeLog('Creating OrdersApiClient');
134
-    if (PUBLIC_KEY=='' || PRIVATE_KEY == '') {
134
+    if (PUBLIC_KEY == '' || PRIVATE_KEY == '') {
135 135
         throw new \Exception('You need set the public and private key');
136 136
     }
137 137
     $orderClient = new \Pagantis\OrdersApiClient\Client(PUBLIC_KEY, PRIVATE_KEY);
@@ -152,7 +152,7 @@  discard block
 block discarded – undo
152 152
 
153 153
     // You can use our test credit cards to fill the Pagantis form
154 154
     writeLog("Redirecting to Pagantis form => $url");
155
-    header('Location:'. $url);
155
+    header('Location:'.$url);
156 156
 }
157 157
 
158 158
 /**
Please login to merge, or discard this patch.
pagantis/controllers/front/notify.php 1 patch
Spacing   +30 added lines, -30 removed lines patch added patch discarded remove patch
@@ -207,7 +207,7 @@  discard block
 block discarded – undo
207 207
     private function getPagantisOrderId()
208 208
     {
209 209
         try {
210
-            $this->pagantisOrderId= Db::getInstance()->getValue(
210
+            $this->pagantisOrderId = Db::getInstance()->getValue(
211 211
                 'select order_id from '._DB_PREFIX_.'pagantis_order where id = '.$this->merchantOrderId
212 212
             );
213 213
 
@@ -269,20 +269,20 @@  discard block
 block discarded – undo
269 269
         $merchantAmount = explode('.', explode(',', $merchantAmount)[0])[0];
270 270
         if ($totalAmount != $merchantAmount) {
271 271
             try {
272
-                $psTotalAmount = substr_replace($merchantAmount, '.', (Tools::strlen($merchantAmount) -2), 0);
272
+                $psTotalAmount = substr_replace($merchantAmount, '.', (Tools::strlen($merchantAmount) - 2), 0);
273 273
 
274 274
                 $pgTotalAmountInCents = (string) $this->pagantisOrder->getShoppingCart()->getTotalAmount();
275 275
                 $pgTotalAmount = substr_replace(
276 276
                     $pgTotalAmountInCents,
277 277
                     '.',
278
-                    (Tools::strlen($pgTotalAmountInCents) -2),
278
+                    (Tools::strlen($pgTotalAmountInCents) - 2),
279 279
                     0
280 280
                 );
281 281
 
282
-                $this->amountMismatchError = '. Amount mismatch in PrestaShop Order #'. $this->merchantOrderId .
283
-                    ' compared with Pagantis Order: ' . $this->pagantisOrderId .
284
-                    '. The order in PrestaShop has an amount of ' . $psTotalAmount . ' and in Pagantis ' .
285
-                    $pgTotalAmount . ' PLEASE REVIEW THE ORDER';
282
+                $this->amountMismatchError = '. Amount mismatch in PrestaShop Order #'.$this->merchantOrderId.
283
+                    ' compared with Pagantis Order: '.$this->pagantisOrderId.
284
+                    '. The order in PrestaShop has an amount of '.$psTotalAmount.' and in Pagantis '.
285
+                    $pgTotalAmount.' PLEASE REVIEW THE ORDER';
286 286
                 $this->saveLog(array(
287 287
                     'message' => $this->amountMismatchError
288 288
                 ));
@@ -302,20 +302,20 @@  discard block
 block discarded – undo
302 302
         try {
303 303
             if ($this->merchantOrder->orderExists() !== false) {
304 304
                 throw new WrongStatusException('PS->orderExists() cart_id = '
305
-                    . $this->merchantOrderId . ' pagantis_id = '
306
-                    . $this->pagantisOrderId . '): already_processed');
305
+                    . $this->merchantOrderId.' pagantis_id = '
306
+                    . $this->pagantisOrderId.'): already_processed');
307 307
             }
308 308
 
309 309
             // Double check
310
-            $tableName = _DB_PREFIX_ . 'pagantis_order';
311
-            $sql = ('select ps_order_id from `' . $tableName . '` where `id` = ' . $this->merchantOrderId
312
-                . ' and `order_id` = \'' . $this->pagantisOrderId . '\''
310
+            $tableName = _DB_PREFIX_.'pagantis_order';
311
+            $sql = ('select ps_order_id from `'.$tableName.'` where `id` = '.$this->merchantOrderId
312
+                . ' and `order_id` = \''.$this->pagantisOrderId.'\''
313 313
                 . ' and `ps_order_id` is not null');
314 314
             $results = Db::getInstance()->ExecuteS($sql);
315 315
             if (is_array($results) && count($results) === 1) {
316
-                throw new WrongStatusException('PS->record found in ' . $tableName
317
-                    . ' (cart_id = ' . $this->merchantOrderId . ' pagantis_id = '
318
-                    . $this->pagantisOrderId . '): already_processed');
316
+                throw new WrongStatusException('PS->record found in '.$tableName
317
+                    . ' (cart_id = '.$this->merchantOrderId.' pagantis_id = '
318
+                    . $this->pagantisOrderId.'): already_processed');
319 319
             }
320 320
         } catch (\Exception $exception) {
321 321
             throw new UnknownException($exception->getMessage());
@@ -344,9 +344,9 @@  discard block
 block discarded – undo
344 344
                 Configuration::get('PS_OS_PAYMENT'),
345 345
                 $this->merchantOrder->getOrderTotal(true),
346 346
                 $this->module->displayName,
347
-                'pagantisOrderId: ' . $this->pagantisOrder->getId() . ' ' .
348
-                'pagantisOrderStatus: '. $this->pagantisOrder->getStatus() .
349
-                $this->amountMismatchError .
347
+                'pagantisOrderId: '.$this->pagantisOrder->getId().' '.
348
+                'pagantisOrderStatus: '.$this->pagantisOrder->getStatus().
349
+                $this->amountMismatchError.
350 350
                 $metadataInfo,
351 351
                 array('transaction_id' => $this->pagantisOrderId),
352 352
                 null,
@@ -360,7 +360,7 @@  discard block
 block discarded – undo
360 360
             Db::getInstance()->update(
361 361
                 'pagantis_order',
362 362
                 array('ps_order_id' => $this->module->currentOrder),
363
-                'id = \''. $this->merchantOrderId . '\' and order_id = \'' . $this->pagantisOrderId . '\''
363
+                'id = \''.$this->merchantOrderId.'\' and order_id = \''.$this->pagantisOrderId.'\''
364 364
             );
365 365
         } catch (\Exception $exception) {
366 366
             // Do nothing
@@ -378,9 +378,9 @@  discard block
 block discarded – undo
378 378
             $this->orderClient->confirmOrder($this->pagantisOrderId);
379 379
             try {
380 380
                 $mode = ($_SERVER['REQUEST_METHOD'] == 'POST') ? 'NOTIFICATION' : 'REDIRECTION';
381
-                $message = 'Order CONFIRMED. The order was confirmed by a ' . $mode .
382
-                    '. Pagantis OrderId=' . $this->pagantisOrderId .
383
-                    '. Prestashop OrderId=' . $this->module->currentOrder;
381
+                $message = 'Order CONFIRMED. The order was confirmed by a '.$mode.
382
+                    '. Pagantis OrderId='.$this->pagantisOrderId.
383
+                    '. Prestashop OrderId='.$this->module->currentOrder;
384 384
                 $this->saveLog(array(
385 385
                     'message' => $message
386 386
                 ));
@@ -427,7 +427,7 @@  discard block
 block discarded – undo
427 427
             );
428 428
             $resultSeconds = Db::getInstance()->getValue($query);
429 429
             $restSeconds = isset($resultSeconds) ? ($resultSeconds) : 0;
430
-            $secondsToExpire = ($restSeconds>self::CONCURRENCY_TIMEOUT) ? self::CONCURRENCY_TIMEOUT : $restSeconds;
430
+            $secondsToExpire = ($restSeconds > self::CONCURRENCY_TIMEOUT) ? self::CONCURRENCY_TIMEOUT : $restSeconds;
431 431
 
432 432
             $logMessage = sprintf(
433 433
                 "Redirect concurrency, User have to wait %s seconds, default seconds %s, bd time to expire %s seconds",
@@ -439,7 +439,7 @@  discard block
 block discarded – undo
439 439
             $this->saveLog(array(
440 440
                 'message' => $logMessage
441 441
             ));
442
-            sleep($secondsToExpire+1);
442
+            sleep($secondsToExpire + 1);
443 443
             // After waiting...user continue the confirmation, hoping that previous call have finished.
444 444
             return true;
445 445
         }
@@ -456,12 +456,12 @@  discard block
 block discarded – undo
456 456
             if (is_null($orderId)) {
457 457
                 Db::getInstance()->delete(
458 458
                     'pagantis_cart_process',
459
-                    'timestamp < ' . (time() - self::CONCURRENCY_TIMEOUT
459
+                    'timestamp < '.(time() - self::CONCURRENCY_TIMEOUT
460 460
                     )
461 461
                 );
462 462
                 return;
463 463
             }
464
-            Db::getInstance()->delete('pagantis_cart_process', 'id = \'' . $orderId . '\'');
464
+            Db::getInstance()->delete('pagantis_cart_process', 'id = \''.$orderId.'\'');
465 465
         } catch (\Exception $exception) {
466 466
             throw new ConcurrencyException();
467 467
         }
@@ -483,8 +483,8 @@  discard block
 block discarded – undo
483 483
         $data = array(
484 484
             'merchantOrderId' => $this->merchantOrderId,
485 485
             'pagantisOrderId' => $this->pagantisOrderId,
486
-            'message' => ($exception)? $exception->getMessage() : 'Unable to get Exception message',
487
-            'statusCode' => ($exception)? $exception->getCode() : 'Unable to get Exception statusCode',
486
+            'message' => ($exception) ? $exception->getMessage() : 'Unable to get Exception message',
487
+            'statusCode' => ($exception) ? $exception->getCode() : 'Unable to get Exception statusCode',
488 488
             'method' => $method,
489 489
             'file' => __FILE__,
490 490
             'line' => $line,
@@ -508,9 +508,9 @@  discard block
 block discarded – undo
508 508
             'id_cart' => $this->merchantOrderId,
509 509
             'key' => $this->config['secureKey'],
510 510
             'id_module' => $this->module->id,
511
-            'id_order' => ($this->pagantisOrder)?$this->pagantisOrder->getId(): null,
511
+            'id_order' => ($this->pagantisOrder) ? $this->pagantisOrder->getId() : null,
512 512
         );
513
-        $url = ($error)? $this->config['urlKO'] : $this->config['urlOK'];
513
+        $url = ($error) ? $this->config['urlKO'] : $this->config['urlOK'];
514 514
         return $this->redirect($url, $parameters);
515 515
     }
516 516
 }
517 517
\ No newline at end of file
Please login to merge, or discard this patch.