Passed
Pull Request — master (#21)
by
unknown
04:31
created
Controller/Payment/Index.php 2 patches
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -360,9 +360,9 @@
 block discarded – undo
360 360
         $magentoVersion = $this->productMetadataInterface->getVersion();
361 361
         $moduleInfo = $this->moduleList->getOne('Pagantis_Pagantis');
362 362
         return array(  'magento' => $magentoVersion,
363
-                       'pagantis' => $moduleInfo['setup_version'],
364
-                       'php' => phpversion(),
365
-                       'curl' => $curlVersion);
363
+                        'pagantis' => $moduleInfo['setup_version'],
364
+                        'php' => phpversion(),
365
+                        'curl' => $curlVersion);
366 366
     }
367 367
 
368 368
     /**
Please login to merge, or discard this patch.
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -125,12 +125,12 @@  discard block
 block discarded – undo
125 125
             $customer = $quote->getCustomer();
126 126
             $shippingAddress = $quote->getShippingAddress();
127 127
 
128
-            if (isset($params['email']) && $params['email']!='') {
128
+            if (isset($params['email']) && $params['email'] != '') {
129 129
                 $this->session->setEmail($params['email']); //Get guest email after refresh page
130 130
                 $customer->setEmail($params['email']);
131 131
                 $quote->setCheckoutMethod('guest');
132 132
                 $quote->getBillingAddress()->setEmail($params['email']);
133
-            } elseif ($customer->getEmail()=='') {
133
+            } elseif ($customer->getEmail() == '') {
134 134
                 $customer->setEmail($this->session->getEmail());
135 135
                 $quote->setCheckoutMethod('guest');
136 136
                 $quote->getBillingAddress()->setEmail($this->session->getEmail());
@@ -141,7 +141,7 @@  discard block
 block discarded – undo
141 141
             $currentQuote->setCustomerEmail($customer->getEmail());
142 142
             $this->quoteRepository->save($currentQuote);
143 143
 
144
-            $userAddress =  new Address();
144
+            $userAddress = new Address();
145 145
             $userAddress
146 146
                 ->setZipCode($shippingAddress->getPostcode())
147 147
                 ->setFullName($shippingAddress->getFirstname()." ".$shippingAddress->getLastname())
@@ -163,7 +163,7 @@  discard block
 block discarded – undo
163 163
                 ->setTaxId($tax_id)
164 164
             ;
165 165
 
166
-            $orderBillingAddress =  new Address();
166
+            $orderBillingAddress = new Address();
167 167
             $billingAddress = $quote->getBillingAddress();
168 168
             $orderBillingAddress
169 169
                 ->setZipCode($billingAddress->getPostcode())
@@ -192,7 +192,7 @@  discard block
 block discarded – undo
192 192
             if ($customer->getDob()) {
193 193
                 $orderUser->setDateOfBirth($customer->getDob());
194 194
             }
195
-            if ($customer->getTaxvat()!='') {
195
+            if ($customer->getTaxvat() != '') {
196 196
                 $orderUser->setDni($customer->getTaxvat());
197 197
                 $orderBillingAddress->setDni($customer->getTaxvat());
198 198
                 $orderShippingAddress->setDni($customer->getTaxvat());
@@ -262,7 +262,7 @@  discard block
 block discarded – undo
262 262
                 ->setType(Channel::ONLINE)
263 263
             ;
264 264
             
265
-            $haystack  = $this->store->getLocale();
265
+            $haystack = $this->store->getLocale();
266 266
             $language = strstr($haystack, '_', true);
267 267
             $orderConfiguration = new Configuration();
268 268
             $orderConfiguration
@@ -280,7 +280,7 @@  discard block
 block discarded – undo
280 280
                 ->setUser($orderUser)
281 281
             ;
282 282
 
283
-            if ($this->config['pagantis_public_key']=='' || $this->config['pagantis_private_key']=='') {
283
+            if ($this->config['pagantis_public_key'] == '' || $this->config['pagantis_private_key'] == '') {
284 284
                 throw new \Exception('Public and Secret Key not found');
285 285
             }
286 286
 
@@ -306,7 +306,7 @@  discard block
 block discarded – undo
306 306
         }
307 307
 
308 308
         $displayMode = $this->extraConfig['PAGANTIS_FORM_DISPLAY_TYPE'];
309
-        if ($displayMode==='0') {
309
+        if ($displayMode === '0') {
310 310
             echo $url;
311 311
             exit;
312 312
         } else {
@@ -328,11 +328,11 @@  discard block
 block discarded – undo
328 328
     private function getOrders($customerId)
329 329
     {
330 330
         $orderCollection = array();
331
-        if ($customerId!='') {
331
+        if ($customerId != '') {
332 332
             $this->orderCollection->addAttributeToFilter('customer_id', $customerId)
333 333
                             ->addAttributeToFilter(
334 334
                                 'status',
335
-                                ['in' => ['processing','pending','complete']]
335
+                                ['in' => ['processing', 'pending', 'complete']]
336 336
                             )
337 337
                             ->load();
338 338
             $orderCollection = $this->orderCollection->getData();
@@ -375,7 +375,7 @@  discard block
 block discarded – undo
375 375
         $tableName = $this->dbObject->getTableName(self::ORDERS_TABLE);
376 376
         return $dbConnection->insertOnDuplicate(
377 377
             $tableName,
378
-            array('id'=>$quoteId,'order_id'=>$pagantisOrderId),
378
+            array('id'=>$quoteId, 'order_id'=>$pagantisOrderId),
379 379
             array('order_id')
380 380
         );
381 381
     }
@@ -389,7 +389,7 @@  discard block
 block discarded – undo
389 389
         $curlVersion = $curlInfo['version'];
390 390
         $magentoVersion = $this->productMetadataInterface->getVersion();
391 391
         $moduleInfo = $this->moduleList->getOne('Pagantis_Pagantis');
392
-        return array(  'magento' => $magentoVersion,
392
+        return array('magento' => $magentoVersion,
393 393
                        'pagantis' => $moduleInfo['setup_version'],
394 394
                        'php' => phpversion(),
395 395
                        'curl' => $curlVersion);
Please login to merge, or discard this patch.
Controller/Notify/IndexV2.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -262,7 +262,7 @@  discard block
 block discarded – undo
262 262
             $this->checkPagantisStatus(array('AUTHORIZED'));
263 263
         } catch (\Exception $e) {
264 264
             $this->getMagentoOrderId();
265
-            if ($this->magentoOrderId!='') {
265
+            if ($this->magentoOrderId != '') {
266 266
                 throw new AlreadyProcessedException();
267 267
             } else {
268 268
                 throw new WrongStatusException($this->pagantisOrder->getStatus());
@@ -275,7 +275,7 @@  discard block
 block discarded – undo
275 275
      */
276 276
     private function checkMerchantOrderStatus()
277 277
     {
278
-        if ($this->quote->getIsActive()=='0') {
278
+        if ($this->quote->getIsActive() == '0') {
279 279
             $this->getMagentoOrderId();
280 280
             throw new AlreadyProcessedException();
281 281
         }
@@ -397,7 +397,7 @@  discard block
 block discarded – undo
397 397
             $tableName    = $this->dbObject->getTableName(self::CONCURRENCY_TABLE);
398 398
             if ($mode == false) {
399 399
                 $dbConnection->delete($tableName, "timestamp<".(time() - 5));
400
-            } elseif ($this->quoteId!='') {
400
+            } elseif ($this->quoteId != '') {
401 401
                 $dbConnection->delete($tableName, "id=".$this->quoteId);
402 402
             }
403 403
         } catch (Exception $exception) {
@@ -452,7 +452,7 @@  discard block
 block discarded – undo
452 452
             /** @var \Magento\Framework\DB\Adapter\AdapterInterface $dbConnection */
453 453
             $dbConnection = $this->dbObject->getConnection();
454 454
             $tableName    = $this->dbObject->getTableName(self::ORDERS_TABLE);
455
-            $pagantisOrderId   = $this->pagantisOrderId;
455
+            $pagantisOrderId = $this->pagantisOrderId;
456 456
 
457 457
             $query        = "select mg_order_id from $tableName where id='$this->quoteId' and order_id='$pagantisOrderId'";
458 458
             $queryResult  = $dbConnection->fetchRow($query);
@@ -492,7 +492,7 @@  discard block
 block discarded – undo
492 492
             /** @var \Magento\Framework\DB\Adapter\AdapterInterface $dbConnection */
493 493
             $dbConnection = $this->dbObject->getConnection();
494 494
             $tableName    = $this->dbObject->getTableName(self::ORDERS_TABLE);
495
-            $pagantisOrderId   = $this->pagantisOrder->getId();
495
+            $pagantisOrderId = $this->pagantisOrder->getId();
496 496
             $dbConnection->update(
497 497
                 $tableName,
498 498
                 array('mg_order_id' => $this->magentoOrderId),
@@ -525,7 +525,7 @@  discard block
 block discarded – undo
525 525
     {
526 526
         //$returnUrl = 'checkout/#payment';
527 527
         $returnUrl = $this->_url->getUrl('checkout', ['_fragment' => 'payment']);
528
-        if ($this->magentoOrderId!='') {
528
+        if ($this->magentoOrderId != '') {
529 529
             /** @var Order $this->magentoOrder */
530 530
             $this->magentoOrder = $this->orderRepositoryInterface->get($this->magentoOrderId);
531 531
             if (!$this->_objectManager->get(\Magento\Checkout\Model\Session\SuccessValidator::class)->isValid()) {
@@ -542,7 +542,7 @@  discard block
 block discarded – undo
542 542
             $orderStatus    = strtolower($this->magentoOrder->getStatus());
543 543
             $acceptedStatus = array('processing', 'completed');
544 544
             if (in_array($orderStatus, $acceptedStatus)) {
545
-                if (isset($this->extraConfig['PAGANTIS_OK_URL']) &&  $this->extraConfig['PAGANTIS_OK_URL']!= '') {
545
+                if (isset($this->extraConfig['PAGANTIS_OK_URL']) && $this->extraConfig['PAGANTIS_OK_URL'] != '') {
546 546
                     $returnUrl = $this->extraConfig['PAGANTIS_OK_URL'];
547 547
                 } else {
548 548
                     $returnUrl = 'checkout/onepage/success';
Please login to merge, or discard this patch.
Test/PagantisMagentoTest.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -150,16 +150,16 @@  discard block
 block discarded – undo
150 150
         $faker = Factory::create();
151 151
         $this->configuration['dni'] = $this->getDNI();
152 152
         $this->configuration['birthdate'] =
153
-            $faker->numberBetween(1, 28) . '/' .
154
-            $faker->numberBetween(1, 12). '/1975'
153
+            $faker->numberBetween(1, 28).'/'.
154
+            $faker->numberBetween(1, 12).'/1975'
155 155
         ;
156 156
         $this->configuration['firstname'] = $faker->firstName;
157
-        $this->configuration['lastname'] = $faker->lastName . ' ' . $faker->lastName;
157
+        $this->configuration['lastname'] = $faker->lastName.' '.$faker->lastName;
158 158
         $this->configuration['company'] = $faker->company;
159 159
         $this->configuration['zip'] = '28'.$faker->randomNumber(3, true);
160 160
         $this->configuration['street'] = $faker->streetAddress;
161
-        $this->configuration['phone'] = '6' . $faker->randomNumber(8);
162
-        $this->configuration['email'] = date('ymd') . '@pagantis.com';
161
+        $this->configuration['phone'] = '6'.$faker->randomNumber(8);
162
+        $this->configuration['email'] = date('ymd').'@pagantis.com';
163 163
 
164 164
         if (!isset($_SERVER['argv']) ||
165 165
             !isset($_SERVER['argv'][4]) ||
@@ -183,12 +183,12 @@  discard block
 block discarded – undo
183 183
      */
184 184
     protected function getDNI()
185 185
     {
186
-        $dni = '0000' . rand(pow(10, 4-1), pow(10, 4)-1);
186
+        $dni = '0000'.rand(pow(10, 4 - 1), pow(10, 4) - 1);
187 187
         $value = (int) ($dni / 23);
188 188
         $value *= 23;
189
-        $value= $dni - $value;
190
-        $letter= "TRWAGMYFPDXBNJZSQVHLCKEO";
191
-        $dniLetter= substr($letter, $value, 1);
189
+        $value = $dni - $value;
190
+        $letter = "TRWAGMYFPDXBNJZSQVHLCKEO";
191
+        $dniLetter = substr($letter, $value, 1);
192 192
         return $dni.$dniLetter;
193 193
     }
194 194
 
Please login to merge, or discard this patch.
Setup/InstallData.php 1 patch
Indentation   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -16,21 +16,21 @@
 block discarded – undo
16 16
      * @var array $defaultConfigs
17 17
      */
18 18
     public $defaultConfigs = array('PAGANTIS_TITLE'=>'Instant Financing',
19
-                           'PAGANTIS_SIMULATOR_DISPLAY_TYPE'=>'pgSDK.simulator.types.SIMPLE',
20
-                           'PAGANTIS_SIMULATOR_DISPLAY_SKIN'=>'pgSDK.simulator.skins.BLUE',
21
-                           'PAGANTIS_SIMULATOR_DISPLAY_POSITION'=>'hookDisplayProductButtons',
22
-                           'PAGANTIS_SIMULATOR_START_INSTALLMENTS'=>3,
23
-                           'PAGANTIS_SIMULATOR_MAX_INSTALLMENTS'=>12,
24
-                           'PAGANTIS_SIMULATOR_CSS_POSITION_SELECTOR'=>'default',
25
-                           'PAGANTIS_SIMULATOR_DISPLAY_CSS_POSITION'=>'pgSDK.simulator.positions.INNER',
26
-                           'PAGANTIS_SIMULATOR_CSS_PRICE_SELECTOR'=>'default',
27
-                           'PAGANTIS_SIMULATOR_CSS_QUANTITY_SELECTOR'=>'default',
28
-                           'PAGANTIS_FORM_DISPLAY_TYPE'=>0,
29
-                           'PAGANTIS_DISPLAY_MIN_AMOUNT'=>1,
30
-                           'PAGANTIS_URL_OK'=>'',
31
-                           'PAGANTIS_URL_KO'=>'',
32
-                           'PAGANTIS_TITLE_EXTRA' => 'Pay up to 12 comfortable installments with Pagantis. Completely online and sympathetic request, and the answer is immediate!',
33
-                           'PAGANTIS_ALLOWED_COUNTRIES' => 'a:2:{i:0;s:2:"es";i:1;s:2:"it";}'
19
+                            'PAGANTIS_SIMULATOR_DISPLAY_TYPE'=>'pgSDK.simulator.types.SIMPLE',
20
+                            'PAGANTIS_SIMULATOR_DISPLAY_SKIN'=>'pgSDK.simulator.skins.BLUE',
21
+                            'PAGANTIS_SIMULATOR_DISPLAY_POSITION'=>'hookDisplayProductButtons',
22
+                            'PAGANTIS_SIMULATOR_START_INSTALLMENTS'=>3,
23
+                            'PAGANTIS_SIMULATOR_MAX_INSTALLMENTS'=>12,
24
+                            'PAGANTIS_SIMULATOR_CSS_POSITION_SELECTOR'=>'default',
25
+                            'PAGANTIS_SIMULATOR_DISPLAY_CSS_POSITION'=>'pgSDK.simulator.positions.INNER',
26
+                            'PAGANTIS_SIMULATOR_CSS_PRICE_SELECTOR'=>'default',
27
+                            'PAGANTIS_SIMULATOR_CSS_QUANTITY_SELECTOR'=>'default',
28
+                            'PAGANTIS_FORM_DISPLAY_TYPE'=>0,
29
+                            'PAGANTIS_DISPLAY_MIN_AMOUNT'=>1,
30
+                            'PAGANTIS_URL_OK'=>'',
31
+                            'PAGANTIS_URL_KO'=>'',
32
+                            'PAGANTIS_TITLE_EXTRA' => 'Pay up to 12 comfortable installments with Pagantis. Completely online and sympathetic request, and the answer is immediate!',
33
+                            'PAGANTIS_ALLOWED_COUNTRIES' => 'a:2:{i:0;s:2:"es";i:1;s:2:"it";}'
34 34
     );
35 35
 
36 36
     /**
Please login to merge, or discard this patch.
Observer/PaymentMethodAvailable.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@  discard block
 block discarded – undo
16 16
     public function execute(\Magento\Framework\Event\Observer $observer)
17 17
     {
18 18
         try {
19
-            if ($observer->getEvent()->getMethodInstance()->getCode()=="pagantis") {
19
+            if ($observer->getEvent()->getMethodInstance()->getCode() == "pagantis") {
20 20
                 $checkResult = $observer->getEvent()->getResult();
21 21
                 $objectManager = \Magento\Framework\App\ObjectManager::getInstance();
22 22
                 $config        = $objectManager->create('Pagantis\Pagantis\Helper\Config')->getConfig();
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
                 $availableCountry = (in_array(strtolower($locale), $allowedCountries));
28 28
                 if (!isset($config['pagantis_public_key']) || $config['pagantis_public_key'] == '' ||
29 29
                     !isset($config['pagantis_private_key']) || $config['pagantis_private_key'] == '' ||
30
-                    !$availableCountry ) {
30
+                    !$availableCountry) {
31 31
                     $checkResult->setData('is_available', false);
32 32
                 } else {
33 33
                     $checkResult->setData('is_available', true);
Please login to merge, or discard this patch.