Passed
Pull Request — master (#46)
by
unknown
02:50
created
controllers/front/payment.php 1 patch
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -25,9 +25,9 @@  discard block
 block discarded – undo
25 25
     {
26 26
         if (_PS_VERSION_ < 1.6) {
27 27
             Logger::addLog(
28
-                'Pagantis Exception For user ' .
29
-                $customer->email .
30
-                ' : ' .
28
+                'Pagantis Exception For user '.
29
+                $customer->email.
30
+                ' : '.
31 31
                 $exception->getMessage(),
32 32
                 3,
33 33
                 $exception->getCode(),
@@ -37,9 +37,9 @@  discard block
 block discarded – undo
37 37
             );
38 38
         } else {
39 39
             PrestaShopLogger::addLog(
40
-                'Pagantis Exception For user ' .
41
-                $customer->email .
42
-                ' : ' .
40
+                'Pagantis Exception For user '.
41
+                $customer->email.
42
+                ' : '.
43 43
                 $exception->getMessage(),
44 44
                 3,
45 45
                 $exception->getCode(),
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
         if (count($langArray) != 2 && isset($lang['locale'])) {
63 63
             $langArray = explode("-", $lang['locale']);
64 64
         }
65
-        $this->language = Tools::strtoupper($langArray[count($langArray)-1]);
65
+        $this->language = Tools::strtoupper($langArray[count($langArray) - 1]);
66 66
         // Prevent null language detection
67 67
         $this->language = ($this->language) ? $this->language : 'ES';
68 68
 
@@ -108,24 +108,24 @@  discard block
 block discarded – undo
108 108
         );
109 109
 
110 110
         try {
111
-            $userAddress =  new \Pagantis\OrdersApiClient\Model\Order\User\Address();
111
+            $userAddress = new \Pagantis\OrdersApiClient\Model\Order\User\Address();
112 112
             $userAddress
113 113
                 ->setZipCode($shippingAddress->postcode)
114
-                ->setFullName($shippingAddress->firstname . ' ' . $shippingAddress->lastname)
114
+                ->setFullName($shippingAddress->firstname.' '.$shippingAddress->lastname)
115 115
                 ->setCountryCode($this->language)
116 116
                 ->setCity($shippingAddress->city)
117
-                ->setAddress($shippingAddress->address1 . ' ' . $shippingAddress->address2)
117
+                ->setAddress($shippingAddress->address1.' '.$shippingAddress->address2)
118 118
                 ->setTaxId($this->getTaxId($customer, $shippingAddress, $billingAddress))
119 119
                 ->setNationalId($this->getNationalId($customer, $shippingAddress, $billingAddress))
120 120
             ;
121 121
 
122
-            $orderShippingAddress =  new \Pagantis\OrdersApiClient\Model\Order\User\Address();
122
+            $orderShippingAddress = new \Pagantis\OrdersApiClient\Model\Order\User\Address();
123 123
             $orderShippingAddress
124 124
                 ->setZipCode($shippingAddress->postcode)
125
-                ->setFullName($shippingAddress->firstname . ' ' . $shippingAddress->lastname)
125
+                ->setFullName($shippingAddress->firstname.' '.$shippingAddress->lastname)
126 126
                 ->setCountryCode($this->language)
127 127
                 ->setCity($shippingAddress->city)
128
-                ->setAddress($shippingAddress->address1 . ' ' . $shippingAddress->address2)
128
+                ->setAddress($shippingAddress->address1.' '.$shippingAddress->address2)
129 129
                 ->setTaxId($this->getTaxId($customer, $shippingAddress, $billingAddress))
130 130
                 ->setNationalId($this->getNationalId($customer, $shippingAddress, $billingAddress))
131 131
                 ->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($this->language)
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,12 +192,12 @@  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
                     $finalPrice = Product::getPriceStatic($item['id_product']);
197
-                    $promotedMessage = 'Promoted Item: ' . $product->getDescription() .
198
-                         ' Price: ' . $finalPrice .
199
-                         ' Qty: ' . $product->getQuantity() .
200
-                         ' Item ID: ' . $item['id_product'];
197
+                    $promotedMessage = 'Promoted Item: '.$product->getDescription().
198
+                         ' Price: '.$finalPrice.
199
+                         ' Qty: '.$product->getQuantity().
200
+                         ' Item ID: '.$item['id_product'];
201 201
                     $metadataOrder->addMetadata('promotedProduct', $promotedMessage);
202 202
                 }
203 203
                 $details->addProduct($product);
@@ -247,7 +247,7 @@  discard block
 block discarded – undo
247 247
             Tools::redirect($cancelUrl);
248 248
         }
249 249
 
250
-        $url ='';
250
+        $url = '';
251 251
         try {
252 252
             $orderClient = new \Pagantis\OrdersApiClient\Client(
253 253
                 $pagantisPublicKey,
@@ -258,12 +258,12 @@  discard block
 block discarded – undo
258 258
             if ($order instanceof \Pagantis\OrdersApiClient\Model\Order) {
259 259
                 $url = $order->getActionUrls()->getForm();
260 260
                 $orderId = $order->getId();
261
-                $sql = "INSERT INTO `" . _DB_PREFIX_ . "pagantis_order` (`id`, `order_id`)
261
+                $sql = "INSERT INTO `"._DB_PREFIX_."pagantis_order` (`id`, `order_id`)
262 262
                      VALUES ('$cart->id','$orderId') 
263 263
                      ON DUPLICATE KEY UPDATE `order_id` = '$orderId'";
264 264
                 $result = Db::getInstance()->execute($sql);
265 265
                 if (!$result) {
266
-                    throw new UnknownException('Unable to save pagantis-order-id in database: '. $sql);
266
+                    throw new UnknownException('Unable to save pagantis-order-id in database: '.$sql);
267 267
                 }
268 268
             } else {
269 269
                 throw new OrderNotFoundException();
Please login to merge, or discard this patch.