@@ -28,9 +28,9 @@ discard block |
||
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 |
||
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(), |
@@ -102,24 +102,24 @@ discard block |
||
102 | 102 | ); |
103 | 103 | |
104 | 104 | try { |
105 | - $userAddress = new \Pagantis\OrdersApiClient\Model\Order\User\Address(); |
|
105 | + $userAddress = new \Pagantis\OrdersApiClient\Model\Order\User\Address(); |
|
106 | 106 | $userAddress |
107 | 107 | ->setZipCode($shippingAddress->postcode) |
108 | - ->setFullName($shippingAddress->firstname . ' ' . $shippingAddress->lastname) |
|
108 | + ->setFullName($shippingAddress->firstname.' '.$shippingAddress->lastname) |
|
109 | 109 | ->setCountryCode($this->language) |
110 | 110 | ->setCity($shippingAddress->city) |
111 | - ->setAddress($shippingAddress->address1 . ' ' . $shippingAddress->address2) |
|
111 | + ->setAddress($shippingAddress->address1.' '.$shippingAddress->address2) |
|
112 | 112 | ->setTaxId($this->getTaxId($customer, $shippingAddress, $billingAddress)) |
113 | 113 | ->setNationalId($this->getNationalId($customer, $shippingAddress, $billingAddress)) |
114 | 114 | ; |
115 | 115 | |
116 | - $orderShippingAddress = new \Pagantis\OrdersApiClient\Model\Order\User\Address(); |
|
116 | + $orderShippingAddress = new \Pagantis\OrdersApiClient\Model\Order\User\Address(); |
|
117 | 117 | $orderShippingAddress |
118 | 118 | ->setZipCode($shippingAddress->postcode) |
119 | - ->setFullName($shippingAddress->firstname . ' ' . $shippingAddress->lastname) |
|
119 | + ->setFullName($shippingAddress->firstname.' '.$shippingAddress->lastname) |
|
120 | 120 | ->setCountryCode($this->language) |
121 | 121 | ->setCity($shippingAddress->city) |
122 | - ->setAddress($shippingAddress->address1 . ' ' . $shippingAddress->address2) |
|
122 | + ->setAddress($shippingAddress->address1.' '.$shippingAddress->address2) |
|
123 | 123 | ->setTaxId($this->getTaxId($customer, $shippingAddress, $billingAddress)) |
124 | 124 | ->setNationalId($this->getNationalId($customer, $shippingAddress, $billingAddress)) |
125 | 125 | ->setFixPhone($shippingAddress->phone) |
@@ -129,10 +129,10 @@ discard block |
||
129 | 129 | $orderBillingAddress = new \Pagantis\OrdersApiClient\Model\Order\User\Address(); |
130 | 130 | $orderBillingAddress |
131 | 131 | ->setZipCode($billingAddress->postcode) |
132 | - ->setFullName($billingAddress->firstname . ' ' . $billingAddress->lastname) |
|
132 | + ->setFullName($billingAddress->firstname.' '.$billingAddress->lastname) |
|
133 | 133 | ->setCountryCode($this->language) |
134 | 134 | ->setCity($billingAddress->city) |
135 | - ->setAddress($billingAddress->address1 . ' ' . $billingAddress->address2) |
|
135 | + ->setAddress($billingAddress->address1.' '.$billingAddress->address2) |
|
136 | 136 | ->setTaxId($this->getTaxId($customer, $billingAddress, $shippingAddress)) |
137 | 137 | ->setNationalId($this->getNationalId($customer, $billingAddress, $shippingAddress)) |
138 | 138 | ->setFixPhone($billingAddress->phone) |
@@ -152,7 +152,7 @@ discard block |
||
152 | 152 | ->setNationalId($this->getNationalId($customer, $shippingAddress, $billingAddress)) |
153 | 153 | ; |
154 | 154 | |
155 | - if ($customer->birthday!='0000-00-00') { |
|
155 | + if ($customer->birthday != '0000-00-00') { |
|
156 | 156 | $orderUser->setDateOfBirth($customer->birthday); |
157 | 157 | } |
158 | 158 | |
@@ -186,13 +186,13 @@ discard block |
||
186 | 186 | ->setQuantity($item['quantity']) |
187 | 187 | ->setDescription($item['name']); |
188 | 188 | if ($promotedProduct) { |
189 | - $promotedAmount+=$product->getAmount(); |
|
189 | + $promotedAmount += $product->getAmount(); |
|
190 | 190 | $productId = $item['id_product']; |
191 | 191 | $finalPrice = Product::getPriceStatic($productId); |
192 | - $promotedMessage = 'Promoted Item: ' . $product->getDescription() . |
|
193 | - ' Price: ' . $finalPrice . |
|
194 | - ' Qty: ' . $product->getQuantity() . |
|
195 | - ' Item ID: ' . $item['id_product']; |
|
192 | + $promotedMessage = 'Promoted Item: '.$product->getDescription(). |
|
193 | + ' Price: '.$finalPrice. |
|
194 | + ' Qty: '.$product->getQuantity(). |
|
195 | + ' Item ID: '.$item['id_product']; |
|
196 | 196 | $metadataOrder->addMetadata('promotedProduct', $promotedMessage); |
197 | 197 | } |
198 | 198 | $details->addProduct($product); |
@@ -242,7 +242,7 @@ discard block |
||
242 | 242 | Tools::redirect($cancelUrl); |
243 | 243 | } |
244 | 244 | |
245 | - $url =''; |
|
245 | + $url = ''; |
|
246 | 246 | try { |
247 | 247 | $orderClient = new \Pagantis\OrdersApiClient\Client( |
248 | 248 | $pagantisPublicKey, |
@@ -253,12 +253,12 @@ discard block |
||
253 | 253 | if ($order instanceof \Pagantis\OrdersApiClient\Model\Order) { |
254 | 254 | $url = $order->getActionUrls()->getForm(); |
255 | 255 | $orderId = $order->getId(); |
256 | - $sql = "INSERT INTO `" . _DB_PREFIX_ . "pagantis_order` (`id`, `order_id`) |
|
256 | + $sql = "INSERT INTO `"._DB_PREFIX_."pagantis_order` (`id`, `order_id`) |
|
257 | 257 | VALUES ('$cart->id','$orderId') |
258 | 258 | ON DUPLICATE KEY UPDATE `order_id` = '$orderId'"; |
259 | 259 | $result = Db::getInstance()->execute($sql); |
260 | 260 | if (!$result) { |
261 | - throw new UnknownException('Unable to save pagantis-order-id in database: '. $sql); |
|
261 | + throw new UnknownException('Unable to save pagantis-order-id in database: '.$sql); |
|
262 | 262 | } |
263 | 263 | } else { |
264 | 264 | throw new OrderNotFoundException(); |
@@ -86,8 +86,8 @@ discard block |
||
86 | 86 | $pagantisPublicKey = Configuration::get('pagantis_public_key'); |
87 | 87 | $pagantisPrivateKey = Configuration::get('pagantis_private_key'); |
88 | 88 | $okUrl = _PS_BASE_URL_SSL_.__PS_BASE_URI__ |
89 | - .'index.php?canonical=true&fc=module&module=pagantis&controller=notify&origin=redirect' |
|
90 | - .http_build_query($query) |
|
89 | + .'index.php?canonical=true&fc=module&module=pagantis&controller=notify&origin=redirect' |
|
90 | + .http_build_query($query) |
|
91 | 91 | ; |
92 | 92 | $notificationOkUrl = _PS_BASE_URL_SSL_.__PS_BASE_URI__ |
93 | 93 | .'index.php?canonical=true&fc=module&module=pagantis&controller=notify&origin=notification' |
@@ -194,9 +194,9 @@ discard block |
||
194 | 194 | $productId = $item['id_product']; |
195 | 195 | $finalPrice = Product::getPriceStatic($productId); |
196 | 196 | $promotedMessage = 'Promoted Item: ' . $product->getDescription() . |
197 | - ' Price: ' . $finalPrice . |
|
198 | - ' Qty: ' . $product->getQuantity() . |
|
199 | - ' Item ID: ' . $item['id_product']; |
|
197 | + ' Price: ' . $finalPrice . |
|
198 | + ' Qty: ' . $product->getQuantity() . |
|
199 | + ' Item ID: ' . $item['id_product']; |
|
200 | 200 | $metadataOrder->addMetadata('promotedProduct', $promotedMessage); |
201 | 201 | } |
202 | 202 | $details->addProduct($product); |
@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | exit; |
12 | 12 | } |
13 | 13 | |
14 | -define('_PS_PAGANTIS_DIR', _PS_MODULE_DIR_. '/pagantis'); |
|
14 | +define('_PS_PAGANTIS_DIR', _PS_MODULE_DIR_.'/pagantis'); |
|
15 | 15 | define('PROMOTIONS_CATEGORY', 'pagantis-promotion-product'); |
16 | 16 | define('PROMOTIONS_CATEGORY_NAME', 'Pagantis Promoted Product'); |
17 | 17 | |
@@ -133,7 +133,7 @@ discard block |
||
133 | 133 | Configuration::updateValue('pagantis_public_key', ''); |
134 | 134 | Configuration::updateValue('pagantis_private_key', ''); |
135 | 135 | |
136 | - $return = (parent::install() |
|
136 | + $return = (parent::install() |
|
137 | 137 | && $this->registerHook('displayShoppingCart') |
138 | 138 | && $this->registerHook('paymentOptions') |
139 | 139 | && $this->registerHook('displayRightColumn') |
@@ -215,18 +215,18 @@ discard block |
||
215 | 215 | public function checkHooks() |
216 | 216 | { |
217 | 217 | try { |
218 | - $sql_content = 'select * from ' . _DB_PREFIX_. 'hook_module where |
|
219 | - id_module = \'' . Module::getModuleIdByName($this->name) . '\' and |
|
220 | - id_shop = \'' . Shop::getContextShopID() . '\' and |
|
221 | - id_hook = \'' . Hook::getIdByName('header') . '\''; |
|
218 | + $sql_content = 'select * from '._DB_PREFIX_.'hook_module where |
|
219 | + id_module = \'' . Module::getModuleIdByName($this->name).'\' and |
|
220 | + id_shop = \'' . Shop::getContextShopID().'\' and |
|
221 | + id_hook = \'' . Hook::getIdByName('header').'\''; |
|
222 | 222 | $hook_exists = Db::getInstance()->ExecuteS($sql_content); |
223 | 223 | if (empty($hook_exists)) { |
224 | - $sql_insert = 'insert into ' . _DB_PREFIX_. 'hook_module |
|
224 | + $sql_insert = 'insert into '._DB_PREFIX_.'hook_module |
|
225 | 225 | (id_module, id_shop, id_hook, position) |
226 | 226 | values |
227 | - (\''. Module::getModuleIdByName($this->name) . '\', |
|
228 | - \''. Shop::getContextShopID() . '\', |
|
229 | - \''. Hook::getIdByName('header') . '\', |
|
227 | + (\''. Module::getModuleIdByName($this->name).'\', |
|
228 | + \''. Shop::getContextShopID().'\', |
|
229 | + \''. Hook::getIdByName('header').'\', |
|
230 | 230 | 150)'; |
231 | 231 | Db::getInstance()->execute($sql_insert); |
232 | 232 | } |
@@ -240,7 +240,7 @@ discard block |
||
240 | 240 | */ |
241 | 241 | public function checkEnvVariables() |
242 | 242 | { |
243 | - $sql_content = 'select * from ' . _DB_PREFIX_. 'pagantis_config'; |
|
243 | + $sql_content = 'select * from '._DB_PREFIX_.'pagantis_config'; |
|
244 | 244 | $dbConfigs = Db::getInstance()->executeS($sql_content); |
245 | 245 | |
246 | 246 | // Convert a multimple dimension array for SQL insert statements into a simple key/value |
@@ -358,7 +358,7 @@ discard block |
||
358 | 358 | } else { |
359 | 359 | $this->context->controller->addJS($url); |
360 | 360 | } |
361 | - $this->context->controller->addJS($this->getPathUri(). 'views/js/simulator.js'); |
|
361 | + $this->context->controller->addJS($this->getPathUri().'views/js/simulator.js'); |
|
362 | 362 | } |
363 | 363 | |
364 | 364 | /** |
@@ -456,7 +456,7 @@ discard block |
||
456 | 456 | 'input' => array( |
457 | 457 | array( |
458 | 458 | 'name' => 'pagantis_is_enabled', |
459 | - 'type' => (version_compare(_PS_VERSION_, '1.6')<0) ?'radio' :'switch', |
|
459 | + 'type' => (version_compare(_PS_VERSION_, '1.6') < 0) ? 'radio' : 'switch', |
|
460 | 460 | 'label' => $this->l('Module is enabled'), |
461 | 461 | 'prefix' => '<i class="icon icon-key"></i>', |
462 | 462 | 'class' => 't', |
@@ -496,7 +496,7 @@ discard block |
||
496 | 496 | ), |
497 | 497 | array( |
498 | 498 | 'name' => 'pagantis_simulator_is_enabled', |
499 | - 'type' => (version_compare(_PS_VERSION_, '1.6')<0) ?'radio' :'switch', |
|
499 | + 'type' => (version_compare(_PS_VERSION_, '1.6') < 0) ? 'radio' : 'switch', |
|
500 | 500 | 'label' => $this->l('Simulator is enabled'), |
501 | 501 | 'prefix' => '<i class="icon icon-key"></i>', |
502 | 502 | 'class' => 't', |
@@ -850,16 +850,16 @@ discard block |
||
850 | 850 | if (!in_array(PROMOTIONS_CATEGORY_NAME, $categories)) { |
851 | 851 | /** @var CategoryCore $category */ |
852 | 852 | $category = new Category(); |
853 | - $categoryArray = array((int)Configuration::get('PS_LANG_DEFAULT')=> PROMOTIONS_CATEGORY ); |
|
853 | + $categoryArray = array((int) Configuration::get('PS_LANG_DEFAULT')=> PROMOTIONS_CATEGORY); |
|
854 | 854 | $category->is_root_category = false; |
855 | 855 | $category->link_rewrite = $categoryArray; |
856 | 856 | $category->meta_description = $categoryArray; |
857 | 857 | $category->meta_keywords = $categoryArray; |
858 | 858 | $category->meta_title = $categoryArray; |
859 | - $category->name = array((int)Configuration::get('PS_LANG_DEFAULT')=> PROMOTIONS_CATEGORY_NAME); |
|
859 | + $category->name = array((int) Configuration::get('PS_LANG_DEFAULT')=> PROMOTIONS_CATEGORY_NAME); |
|
860 | 860 | $category->id_parent = Configuration::get('PS_HOME_CATEGORY'); |
861 | - $category->active=0; |
|
862 | - $description = 'Pagantis: Products with this category have free financing assumed by the merchant. ' . |
|
861 | + $category->active = 0; |
|
862 | + $description = 'Pagantis: Products with this category have free financing assumed by the merchant. '. |
|
863 | 863 | 'Use it to promote your products or brands.'; |
864 | 864 | $category->description = $this->l($description); |
865 | 865 | $category->save(); |
@@ -873,7 +873,7 @@ discard block |
||
873 | 873 | return ''; |
874 | 874 | } |
875 | 875 | |
876 | - $sql = 'SELECT value FROM '._DB_PREFIX_.'pagantis_config where config = \'' . pSQL($config) . '\' limit 1'; |
|
876 | + $sql = 'SELECT value FROM '._DB_PREFIX_.'pagantis_config where config = \''.pSQL($config).'\' limit 1'; |
|
877 | 877 | if ($results = Db::getInstance()->ExecuteS($sql)) { |
878 | 878 | if (is_array($results) && count($results) === 1 && isset($results[0]['value'])) { |
879 | 879 | return $results[0]['value']; |
@@ -888,10 +888,10 @@ discard block |
||
888 | 888 | */ |
889 | 889 | public function checkLogoExists() |
890 | 890 | { |
891 | - $logoPg = _PS_MODULE_DIR_ . '/onepagecheckoutps/views/img/payments/pagantis.png'; |
|
892 | - if (!file_exists($logoPg) && is_dir(_PS_MODULE_DIR_ . '/onepagecheckoutps/views/img/payments')) { |
|
891 | + $logoPg = _PS_MODULE_DIR_.'/onepagecheckoutps/views/img/payments/pagantis.png'; |
|
892 | + if (!file_exists($logoPg) && is_dir(_PS_MODULE_DIR_.'/onepagecheckoutps/views/img/payments')) { |
|
893 | 893 | copy( |
894 | - _PS_PAGANTIS_DIR . '/logo.png', |
|
894 | + _PS_PAGANTIS_DIR.'/logo.png', |
|
895 | 895 | $logoPg |
896 | 896 | ); |
897 | 897 | } |
@@ -907,7 +907,7 @@ discard block |
||
907 | 907 | if (count($langArray) != 2 && isset($lang['locale'])) { |
908 | 908 | $langArray = explode("-", $lang['locale']); |
909 | 909 | } |
910 | - $this->language = Tools::strtoupper($langArray[count($langArray)-1]); |
|
910 | + $this->language = Tools::strtoupper($langArray[count($langArray) - 1]); |
|
911 | 911 | // Prevent null language detection |
912 | 912 | if (in_array(Tools::strtolower($this->language), $this->allowedCountries)) { |
913 | 913 | return; |
@@ -213,7 +213,7 @@ discard block |
||
213 | 213 | private function getPagantisOrderId() |
214 | 214 | { |
215 | 215 | try { |
216 | - $this->pagantisOrderId= Db::getInstance()->getValue( |
|
216 | + $this->pagantisOrderId = Db::getInstance()->getValue( |
|
217 | 217 | 'select order_id from '._DB_PREFIX_.'pagantis_order where id = '.$this->merchantOrderId |
218 | 218 | ); |
219 | 219 | |
@@ -275,20 +275,20 @@ discard block |
||
275 | 275 | $merchantAmount = explode('.', explode(',', $merchantAmount)[0])[0]; |
276 | 276 | if ($totalAmount != $merchantAmount) { |
277 | 277 | try { |
278 | - $psTotalAmount = substr_replace($merchantAmount, '.', (Tools::strlen($merchantAmount) -2), 0); |
|
278 | + $psTotalAmount = substr_replace($merchantAmount, '.', (Tools::strlen($merchantAmount) - 2), 0); |
|
279 | 279 | |
280 | 280 | $pgTotalAmountInCents = (string) $this->pagantisOrder->getShoppingCart()->getTotalAmount(); |
281 | 281 | $pgTotalAmount = substr_replace( |
282 | 282 | $pgTotalAmountInCents, |
283 | 283 | '.', |
284 | - (Tools::strlen($pgTotalAmountInCents) -2), |
|
284 | + (Tools::strlen($pgTotalAmountInCents) - 2), |
|
285 | 285 | 0 |
286 | 286 | ); |
287 | 287 | |
288 | - $this->amountMismatchError = '. Amount mismatch in PrestaShop Order #'. $this->merchantOrderId . |
|
289 | - ' compared with Pagantis Order: ' . $this->pagantisOrderId . |
|
290 | - '. The order in PrestaShop has an amount of ' . $psTotalAmount . ' and in Pagantis ' . |
|
291 | - $pgTotalAmount . ' PLEASE REVIEW THE ORDER'; |
|
288 | + $this->amountMismatchError = '. Amount mismatch in PrestaShop Order #'.$this->merchantOrderId. |
|
289 | + ' compared with Pagantis Order: '.$this->pagantisOrderId. |
|
290 | + '. The order in PrestaShop has an amount of '.$psTotalAmount.' and in Pagantis '. |
|
291 | + $pgTotalAmount.' PLEASE REVIEW THE ORDER'; |
|
292 | 292 | $this->saveLog(array( |
293 | 293 | 'message' => $this->amountMismatchError |
294 | 294 | )); |
@@ -308,20 +308,20 @@ discard block |
||
308 | 308 | try { |
309 | 309 | if ($this->merchantOrder->orderExists() !== false) { |
310 | 310 | throw new WrongStatusException('PS->orderExists() cart_id = ' |
311 | - . $this->merchantOrderId . ' pagantis_id = ' |
|
312 | - . $this->pagantisOrderId . '): already_processed'); |
|
311 | + . $this->merchantOrderId.' pagantis_id = ' |
|
312 | + . $this->pagantisOrderId.'): already_processed'); |
|
313 | 313 | } |
314 | 314 | |
315 | 315 | // Double check |
316 | - $tableName = _DB_PREFIX_ . 'pagantis_order'; |
|
317 | - $sql = ('select ps_order_id from `' . $tableName . '` where `id` = ' . $this->merchantOrderId |
|
318 | - . ' and `order_id` = \'' . $this->pagantisOrderId . '\'' |
|
316 | + $tableName = _DB_PREFIX_.'pagantis_order'; |
|
317 | + $sql = ('select ps_order_id from `'.$tableName.'` where `id` = '.$this->merchantOrderId |
|
318 | + . ' and `order_id` = \''.$this->pagantisOrderId.'\'' |
|
319 | 319 | . ' and `ps_order_id` is not null'); |
320 | 320 | $results = Db::getInstance()->ExecuteS($sql); |
321 | 321 | if (is_array($results) && count($results) === 1) { |
322 | - throw new WrongStatusException('PS->record found in ' . $tableName |
|
323 | - . ' (cart_id = ' . $this->merchantOrderId . ' pagantis_id = ' |
|
324 | - . $this->pagantisOrderId . '): already_processed'); |
|
322 | + throw new WrongStatusException('PS->record found in '.$tableName |
|
323 | + . ' (cart_id = '.$this->merchantOrderId.' pagantis_id = ' |
|
324 | + . $this->pagantisOrderId.'): already_processed'); |
|
325 | 325 | } |
326 | 326 | } catch (\Exception $exception) { |
327 | 327 | throw new UnknownException($exception->getMessage()); |
@@ -350,9 +350,9 @@ discard block |
||
350 | 350 | Configuration::get('PS_OS_PAYMENT'), |
351 | 351 | $this->merchantOrder->getOrderTotal(true), |
352 | 352 | $this->module->displayName, |
353 | - 'pagantisOrderId: ' . $this->pagantisOrder->getId() . ' ' . |
|
354 | - 'pagantisOrderStatus: '. $this->pagantisOrder->getStatus() . |
|
355 | - $this->amountMismatchError . |
|
353 | + 'pagantisOrderId: '.$this->pagantisOrder->getId().' '. |
|
354 | + 'pagantisOrderStatus: '.$this->pagantisOrder->getStatus(). |
|
355 | + $this->amountMismatchError. |
|
356 | 356 | $metadataInfo, |
357 | 357 | array('transaction_id' => $this->pagantisOrderId), |
358 | 358 | null, |
@@ -366,7 +366,7 @@ discard block |
||
366 | 366 | Db::getInstance()->update( |
367 | 367 | 'pagantis_order', |
368 | 368 | array('ps_order_id' => $this->module->currentOrder), |
369 | - 'id = \''. $this->merchantOrderId . '\' and order_id = \'' . $this->pagantisOrderId . '\'' |
|
369 | + 'id = \''.$this->merchantOrderId.'\' and order_id = \''.$this->pagantisOrderId.'\'' |
|
370 | 370 | ); |
371 | 371 | } catch (\Exception $exception) { |
372 | 372 | // Do nothing |
@@ -384,9 +384,9 @@ discard block |
||
384 | 384 | $this->orderClient->confirmOrder($this->pagantisOrderId); |
385 | 385 | try { |
386 | 386 | $mode = ($_SERVER['REQUEST_METHOD'] == 'POST') ? 'NOTIFICATION' : 'REDIRECTION'; |
387 | - $message = 'Order CONFIRMED. The order was confirmed by a ' . $mode . |
|
388 | - '. Pagantis OrderId=' . $this->pagantisOrderId . |
|
389 | - '. Prestashop OrderId=' . $this->module->currentOrder; |
|
387 | + $message = 'Order CONFIRMED. The order was confirmed by a '.$mode. |
|
388 | + '. Pagantis OrderId='.$this->pagantisOrderId. |
|
389 | + '. Prestashop OrderId='.$this->module->currentOrder; |
|
390 | 390 | $this->saveLog(array('message' => $message)); |
391 | 391 | } catch (\Exception $exception) { |
392 | 392 | // Do nothing |
@@ -405,9 +405,9 @@ discard block |
||
405 | 405 | { |
406 | 406 | // Do nothing because the order is created only when the purchase was successfully |
407 | 407 | try { |
408 | - $message = 'Roolback method: ' . |
|
409 | - '. Pagantis OrderId=' . $this->pagantisOrderId . |
|
410 | - '. Prestashop CartId=' . $this->merchantOrderId; |
|
408 | + $message = 'Roolback method: '. |
|
409 | + '. Pagantis OrderId='.$this->pagantisOrderId. |
|
410 | + '. Prestashop CartId='.$this->merchantOrderId; |
|
411 | 411 | $this->saveLog(array('message' => $message)); |
412 | 412 | } |
413 | 413 | } catch (\Exception $exception) { |
@@ -439,10 +439,10 @@ discard block |
||
439 | 439 | ); |
440 | 440 | $resultSeconds = Db::getInstance()->getValue($query); |
441 | 441 | $restSeconds = isset($resultSeconds) ? ($resultSeconds) : 0; |
442 | - $secondsToExpire = ($restSeconds>self::CONCURRENCY_TIMEOUT) ? self::CONCURRENCY_TIMEOUT : $restSeconds; |
|
442 | + $secondsToExpire = ($restSeconds > self::CONCURRENCY_TIMEOUT) ? self::CONCURRENCY_TIMEOUT : $restSeconds; |
|
443 | 443 | |
444 | 444 | $logMessage = sprintf( |
445 | - "Redirect concurrency, User have to wait %s seconds, default seconds %s, bd time to expire %s seconds. CartId=" . $orderId, |
|
445 | + "Redirect concurrency, User have to wait %s seconds, default seconds %s, bd time to expire %s seconds. CartId=".$orderId, |
|
446 | 446 | $secondsToExpire, |
447 | 447 | self::CONCURRENCY_TIMEOUT, |
448 | 448 | $restSeconds |
@@ -451,7 +451,7 @@ discard block |
||
451 | 451 | $this->saveLog(array( |
452 | 452 | 'message' => $logMessage |
453 | 453 | )); |
454 | - sleep($secondsToExpire+1); |
|
454 | + sleep($secondsToExpire + 1); |
|
455 | 455 | // After waiting...user continue the confirmation, hoping that previous call have finished. |
456 | 456 | return true; |
457 | 457 | } |
@@ -471,11 +471,11 @@ discard block |
||
471 | 471 | if (is_null($orderId)) { |
472 | 472 | Db::getInstance()->delete( |
473 | 473 | 'pagantis_cart_process', |
474 | - 'timestamp < ' . (time() - self::CONCURRENCY_TIMEOUT) |
|
474 | + 'timestamp < '.(time() - self::CONCURRENCY_TIMEOUT) |
|
475 | 475 | ); |
476 | 476 | return; |
477 | 477 | } |
478 | - Db::getInstance()->delete('pagantis_cart_process', 'id = \'' . $orderId . '\''); |
|
478 | + Db::getInstance()->delete('pagantis_cart_process', 'id = \''.$orderId.'\''); |
|
479 | 479 | } catch (\Exception $exception) { |
480 | 480 | throw new ConcurrencyException(); |
481 | 481 | } |
@@ -497,8 +497,8 @@ discard block |
||
497 | 497 | $data = array( |
498 | 498 | 'merchantOrderId' => $this->merchantOrderId, |
499 | 499 | 'pagantisOrderId' => $this->pagantisOrderId, |
500 | - 'message' => ($exception)? $exception->getMessage() : 'Unable to get Exception message', |
|
501 | - 'statusCode' => ($exception)? $exception->getCode() : 'Unable to get Exception statusCode', |
|
500 | + 'message' => ($exception) ? $exception->getMessage() : 'Unable to get Exception message', |
|
501 | + 'statusCode' => ($exception) ? $exception->getCode() : 'Unable to get Exception statusCode', |
|
502 | 502 | 'method' => $method, |
503 | 503 | 'file' => __FILE__, |
504 | 504 | 'line' => $line, |
@@ -522,9 +522,9 @@ discard block |
||
522 | 522 | 'id_cart' => $this->merchantOrderId, |
523 | 523 | 'key' => $this->config['secureKey'], |
524 | 524 | 'id_module' => $this->module->id, |
525 | - 'id_order' => ($this->pagantisOrder)?$this->pagantisOrder->getId(): null, |
|
525 | + 'id_order' => ($this->pagantisOrder) ? $this->pagantisOrder->getId() : null, |
|
526 | 526 | ); |
527 | - $url = ($error)? $this->config['urlKO'] : $this->config['urlOK']; |
|
527 | + $url = ($error) ? $this->config['urlKO'] : $this->config['urlOK']; |
|
528 | 528 | return $this->redirect($url, $parameters); |
529 | 529 | } |
530 | 530 | } |
531 | 531 | \ No newline at end of file |