Passed
Pull Request — master (#68)
by Raúl
04:13
created
controllers/front/payment.php 1 patch
Spacing   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -28,9 +28,9 @@  discard block
 block discarded – undo
28 28
     {
29 29
         if (_PS_VERSION_ < 1.6) {
30 30
             Logger::addLog(
31
-                'Pagantis Exception For user ' .
32
-                $customer->email .
33
-                ' : ' .
31
+                'Pagantis Exception For user '.
32
+                $customer->email.
33
+                ' : '.
34 34
                 $exception->getMessage(),
35 35
                 3,
36 36
                 $exception->getCode(),
@@ -40,9 +40,9 @@  discard block
 block discarded – undo
40 40
             );
41 41
         } else {
42 42
             PrestaShopLogger::addLog(
43
-                'Pagantis Exception For user ' .
44
-                $customer->email .
45
-                ' : ' .
43
+                'Pagantis Exception For user '.
44
+                $customer->email.
45
+                ' : '.
46 46
                 $exception->getMessage(),
47 47
                 3,
48 48
                 $exception->getCode(),
@@ -107,24 +107,24 @@  discard block
 block discarded – undo
107 107
 
108 108
         try {
109 109
             $shippingCountry = Country::getIsoById($shippingAddress->id_country);
110
-            $userAddress =  new \Pagantis\OrdersApiClient\Model\Order\User\Address();
110
+            $userAddress = new \Pagantis\OrdersApiClient\Model\Order\User\Address();
111 111
             $userAddress
112 112
                 ->setZipCode($shippingAddress->postcode)
113
-                ->setFullName($shippingAddress->firstname . ' ' . $shippingAddress->lastname)
113
+                ->setFullName($shippingAddress->firstname.' '.$shippingAddress->lastname)
114 114
                 ->setCountryCode($shippingCountry)
115 115
                 ->setCity($shippingAddress->city)
116
-                ->setAddress($shippingAddress->address1 . ' ' . $shippingAddress->address2)
116
+                ->setAddress($shippingAddress->address1.' '.$shippingAddress->address2)
117 117
                 ->setTaxId($this->getTaxId($customer, $shippingAddress, $billingAddress))
118 118
                 ->setNationalId($this->getNationalId($customer, $shippingAddress, $billingAddress))
119 119
             ;
120 120
 
121
-            $orderShippingAddress =  new \Pagantis\OrdersApiClient\Model\Order\User\Address();
121
+            $orderShippingAddress = new \Pagantis\OrdersApiClient\Model\Order\User\Address();
122 122
             $orderShippingAddress
123 123
                 ->setZipCode($shippingAddress->postcode)
124
-                ->setFullName($shippingAddress->firstname . ' ' . $shippingAddress->lastname)
124
+                ->setFullName($shippingAddress->firstname.' '.$shippingAddress->lastname)
125 125
                 ->setCountryCode($shippingCountry)
126 126
                 ->setCity($shippingAddress->city)
127
-                ->setAddress($shippingAddress->address1 . ' ' . $shippingAddress->address2)
127
+                ->setAddress($shippingAddress->address1.' '.$shippingAddress->address2)
128 128
                 ->setTaxId($this->getTaxId($customer, $shippingAddress, $billingAddress))
129 129
                 ->setNationalId($this->getNationalId($customer, $shippingAddress, $billingAddress))
130 130
                 ->setFixPhone($shippingAddress->phone)
@@ -135,10 +135,10 @@  discard block
 block discarded – undo
135 135
             $orderBillingAddress = new \Pagantis\OrdersApiClient\Model\Order\User\Address();
136 136
             $orderBillingAddress
137 137
                 ->setZipCode($billingAddress->postcode)
138
-                ->setFullName($billingAddress->firstname . ' ' . $billingAddress->lastname)
138
+                ->setFullName($billingAddress->firstname.' '.$billingAddress->lastname)
139 139
                 ->setCountryCode($billingCountry)
140 140
                 ->setCity($billingAddress->city)
141
-                ->setAddress($billingAddress->address1 . ' ' . $billingAddress->address2)
141
+                ->setAddress($billingAddress->address1.' '.$billingAddress->address2)
142 142
                 ->setTaxId($this->getTaxId($customer, $billingAddress, $shippingAddress))
143 143
                 ->setNationalId($this->getNationalId($customer, $billingAddress, $shippingAddress))
144 144
                 ->setFixPhone($billingAddress->phone)
@@ -158,7 +158,7 @@  discard block
 block discarded – undo
158 158
                 ->setNationalId($this->getNationalId($customer, $shippingAddress, $billingAddress))
159 159
             ;
160 160
 
161
-            if ($customer->birthday!='0000-00-00') {
161
+            if ($customer->birthday != '0000-00-00') {
162 162
                 $orderUser->setDateOfBirth($customer->birthday);
163 163
             }
164 164
 
@@ -192,13 +192,13 @@  discard block
 block discarded – undo
192 192
                     ->setQuantity($item['quantity'])
193 193
                     ->setDescription($item['name']);
194 194
                 if ($promotedProduct) {
195
-                    $promotedAmount+=$product->getAmount();
195
+                    $promotedAmount += $product->getAmount();
196 196
                     $productId = $item['id_product'];
197 197
                     $finalPrice = Product::getPriceStatic($productId);
198
-                    $promotedMessage = 'Promoted Item: ' . $product->getDescription() .
199
-                         ' Price: ' . $finalPrice .
200
-                         ' Qty: ' . $product->getQuantity() .
201
-                         ' Item ID: ' . $item['id_product'];
198
+                    $promotedMessage = 'Promoted Item: '.$product->getDescription().
199
+                         ' Price: '.$finalPrice.
200
+                         ' Qty: '.$product->getQuantity().
201
+                         ' Item ID: '.$item['id_product'];
202 202
                     $metadataOrder->addMetadata('promotedProduct', $promotedMessage);
203 203
                 }
204 204
                 $details->addProduct($product);
@@ -249,7 +249,7 @@  discard block
 block discarded – undo
249 249
             Tools::redirect($cancelUrl);
250 250
         }
251 251
 
252
-        $url ='';
252
+        $url = '';
253 253
         try {
254 254
             $orderClient = new \Pagantis\OrdersApiClient\Client(
255 255
                 $pagantisPublicKey,
@@ -260,12 +260,12 @@  discard block
 block discarded – undo
260 260
             if ($order instanceof \Pagantis\OrdersApiClient\Model\Order) {
261 261
                 $url = $order->getActionUrls()->getForm();
262 262
                 $orderId = $order->getId();
263
-                $sql = "INSERT INTO `" . _DB_PREFIX_ . "pagantis_order` (`id`, `order_id`)
263
+                $sql = "INSERT INTO `"._DB_PREFIX_."pagantis_order` (`id`, `order_id`)
264 264
                      VALUES ('$cart->id','$orderId') 
265 265
                      ON DUPLICATE KEY UPDATE `order_id` = '$orderId'";
266 266
                 $result = Db::getInstance()->execute($sql);
267 267
                 if (!$result) {
268
-                    throw new UnknownException('Unable to save pagantis-order-id in database: '. $sql);
268
+                    throw new UnknownException('Unable to save pagantis-order-id in database: '.$sql);
269 269
                 }
270 270
             } else {
271 271
                 throw new OrderNotFoundException();
@@ -388,13 +388,13 @@  discard block
 block discarded – undo
388 388
 
389 389
     private function getUserLanguage($shippingAddress = null, $billingAddress = null)
390 390
     {
391
-        $allowedCountries    = unserialize(Pagantis::getExtraConfig('PAGANTIS_ALLOWED_COUNTRIES'));
391
+        $allowedCountries = unserialize(Pagantis::getExtraConfig('PAGANTIS_ALLOWED_COUNTRIES'));
392 392
         $lang = Language::getLanguage($this->context->language->id);
393 393
         $langArray = explode("-", $lang['language_code']);
394 394
         if (count($langArray) != 2 && isset($lang['locale'])) {
395 395
             $langArray = explode("-", $lang['locale']);
396 396
         }
397
-        $language = Tools::strtoupper($langArray[count($langArray)-1]);
397
+        $language = Tools::strtoupper($langArray[count($langArray) - 1]);
398 398
         // Prevent null language detection
399 399
         if (in_array(Tools::strtolower($language), $allowedCountries)) {
400 400
             return $language;
Please login to merge, or discard this patch.