@@ -5,7 +5,8 @@ discard block |
||
5 | 5 | * |
6 | 6 | * @author andre |
7 | 7 | */ |
8 | -class lightConnector { |
|
8 | +class lightConnector |
|
9 | +{ |
|
9 | 10 | |
10 | 11 | /** |
11 | 12 | * Connecting method |
@@ -45,7 +46,8 @@ discard block |
||
45 | 46 | * @param type $config |
46 | 47 | * @param type $method |
47 | 48 | */ |
48 | - public function __construct($config, $method = null) { |
|
49 | + public function __construct($config, $method = null) |
|
50 | + { |
|
49 | 51 | parent::__construct(); |
50 | 52 | $this->method = $method; |
51 | 53 | $this->config = $config; |
@@ -57,7 +59,8 @@ discard block |
||
57 | 59 | * @param string $method |
58 | 60 | * @return void |
59 | 61 | */ |
60 | - public function setMethod($method) { |
|
62 | + public function setMethod($method) |
|
63 | + { |
|
61 | 64 | $this->method = $method; |
62 | 65 | } |
63 | 66 | |
@@ -67,7 +70,8 @@ discard block |
||
67 | 70 | * @param string $klarnaOrderId |
68 | 71 | * @return void |
69 | 72 | */ |
70 | - public function setKlarnaOrderId($klarnaOrderId) { |
|
73 | + public function setKlarnaOrderId($klarnaOrderId) |
|
74 | + { |
|
71 | 75 | $this->klarnaOrderId = $klarnaOrderId; |
72 | 76 | } |
73 | 77 | |
@@ -76,7 +80,8 @@ discard block |
||
76 | 80 | * |
77 | 81 | * @param string $transactionId |
78 | 82 | */ |
79 | - public function setTransactionId($transactionId) { |
|
83 | + public function setTransactionId($transactionId) |
|
84 | + { |
|
80 | 85 | $this->transactionId = $transactionId; |
81 | 86 | } |
82 | 87 | |
@@ -87,7 +92,8 @@ discard block |
||
87 | 92 | * @param array $shippingAddress |
88 | 93 | * @return void |
89 | 94 | */ |
90 | - public function updateCustomerAddress($billingAddress, $shippingAddress = false) { |
|
95 | + public function updateCustomerAddress($billingAddress, $shippingAddress = false) |
|
96 | + { |
|
91 | 97 | $aAddressParts = array(''); |
92 | 98 | } |
93 | 99 | |
@@ -96,7 +102,8 @@ discard block |
||
96 | 102 | * |
97 | 103 | * @param array $data |
98 | 104 | */ |
99 | - protected function setCall($data) { |
|
105 | + protected function setCall($data) |
|
106 | + { |
|
100 | 107 | $testdrive = $this->config->get('testDrive'); |
101 | 108 | $url = ($testdrive) ? $this->apiUrl['test'] : $this->apiUrl['live']; |
102 | 109 |
@@ -250,7 +250,8 @@ discard block |
||
250 | 250 | * @param void |
251 | 251 | * @return \Klarna |
252 | 252 | */ |
253 | - public function getKLarnaService() { |
|
253 | + public function getKLarnaService() |
|
254 | + { |
|
254 | 255 | if ($this->klarnaService === null) { |
255 | 256 | require_once __DIR__ . '/Components/Klarna/Klarna.php'; |
256 | 257 | require_once __DIR__ . '/Components/Klarna/transport/xmlrpc-3.0.0.beta/lib/xmlrpc.inc'; |
@@ -266,7 +267,8 @@ discard block |
||
266 | 267 | * @param void |
267 | 268 | * @return object |
268 | 269 | */ |
269 | - public function getKlarnaAddr() { |
|
270 | + public function getKlarnaAddr() |
|
271 | + { |
|
270 | 272 | if ($this->klarnaAddr === null) { |
271 | 273 | $this->klarnaAddr = new KlarnaAddr(); |
272 | 274 | } |
@@ -380,7 +382,8 @@ discard block |
||
380 | 382 | * @param Enlight_Hook_HookArgs $args |
381 | 383 | * @return void |
382 | 384 | */ |
383 | - public function onBackendOrderSaveAfter(Enlight_Hook_HookArgs $args) { |
|
385 | + public function onBackendOrderSaveAfter(Enlight_Hook_HookArgs $args) |
|
386 | + { |
|
384 | 387 | $orderDataRaw = $args->getSubject()->Request()->getPost(); |
385 | 388 | $orderId = $orderDataRaw['id']; |
386 | 389 | $paymentName = $orderDataRaw['payment'][0]['name']; |
@@ -433,7 +436,8 @@ discard block |
||
433 | 436 | * @param Enlight_Hook_HookArgs $args |
434 | 437 | * @return void |
435 | 438 | */ |
436 | - public function onBackendOrderDeleteAfter(Enlight_Hook_HookArgs $args) { |
|
439 | + public function onBackendOrderDeleteAfter(Enlight_Hook_HookArgs $args) |
|
440 | + { |
|
437 | 441 | $orderDataRaw = $args->getSubject()->Request()->getPost(); |
438 | 442 | $paymentName = $orderDataRaw['payment'][0]['name']; |
439 | 443 | |
@@ -492,7 +496,7 @@ discard block |
||
492 | 496 | } |
493 | 497 | |
494 | 498 | public function onGetStreetSplitService() |
495 | - { |
|
499 | + { |
|
496 | 500 | $this->Application()->Loader()->registerNamespace( |
497 | 501 | 'Shopware\Components', |
498 | 502 | __DIR__ . '/Components/' |
@@ -509,7 +513,8 @@ discard block |
||
509 | 513 | * @param mixed $mPrintableElement |
510 | 514 | * @return void |
511 | 515 | */ |
512 | - public function klarnaLog($message, $logLevelMessage=1, $mPrintableElement=null) { |
|
516 | + public function klarnaLog($message, $logLevelMessage=1, $mPrintableElement=null) |
|
517 | + { |
|
513 | 518 | $configname = 'klarnaLogLevel'; |
514 | 519 | $elementId = Shopware()->Db()->fetchOne('SELECT id FROM s_core_config_elements WHERE name = ?', [$configname]); |
515 | 520 | $logLevelConfigSetting = Shopware()->Db()->fetchOne('SELECT value FROM s_core_config_values WHERE element_id = ?', [$elementId]); |
@@ -541,7 +546,8 @@ discard block |
||
541 | 546 | * @param array $orderDataRaw |
542 | 547 | * @param string $type |
543 | 548 | */ |
544 | - protected function getKlarnaAddrByRawOrderData($orderDataRaw, $type) { |
|
549 | + protected function getKlarnaAddrByRawOrderData($orderDataRaw, $type) |
|
550 | + { |
|
545 | 551 | $klarnaAddr = false; |
546 | 552 | $baseData = (isset($orderDataRaw[$type][0])) ? $orderDataRaw[$type][0] : false; |
547 | 553 | $baseData = $this->convertEncoding($baseData); |
@@ -581,7 +587,8 @@ discard block |
||
581 | 587 | * @param array $baseData |
582 | 588 | * @return array |
583 | 589 | */ |
584 | - protected function fetchStreetAndHouseNumber($baseData) { |
|
590 | + protected function fetchStreetAndHouseNumber($baseData) |
|
591 | + { |
|
585 | 592 | |
586 | 593 | $addressParts = explode(' ', $baseData['street']); |
587 | 594 | $index = 0; |
@@ -597,10 +604,11 @@ discard block |
||
597 | 604 | $index++; |
598 | 605 | if ($index == count($addressParts) || $houseNumberFound) { |
599 | 606 | // at least last element should be streetnr |
600 | - if (!empty($streetnr)) $streetnr .= ' '; |
|
607 | + if (!empty($streetnr)) { |
|
608 | + $streetnr .= ' '; |
|
609 | + } |
|
601 | 610 | $streetnr .= (string)$addressPart; |
602 | - } |
|
603 | - else { |
|
611 | + } else { |
|
604 | 612 | $street .= (string)' '.$addressPart; |
605 | 613 | } |
606 | 614 | } |
@@ -629,7 +637,8 @@ discard block |
||
629 | 637 | * @param array $data |
630 | 638 | * @return array |
631 | 639 | */ |
632 | - protected function convertEncoding($data) { |
|
640 | + protected function convertEncoding($data) |
|
641 | + { |
|
633 | 642 | $out = array(); |
634 | 643 | foreach ($data as $key=>$value) { |
635 | 644 | if (is_string($value)) { |
@@ -1289,7 +1298,7 @@ discard block |
||
1289 | 1298 | |
1290 | 1299 | // just return in case kco payment is deactivated in backend |
1291 | 1300 | |
1292 | - if (!$this->isKcoPaymentActive()){ |
|
1301 | + if (!$this->isKcoPaymentActive()) { |
|
1293 | 1302 | return; |
1294 | 1303 | } |
1295 | 1304 | $user = $view->getAssign('sUserData'); |
@@ -1329,7 +1338,7 @@ discard block |
||
1329 | 1338 | $view->assign('KlarnaMerchantId', $config->get('merchantId')); |
1330 | 1339 | $view->assign('KlarnaHideCheckoutSteps', true); |
1331 | 1340 | |
1332 | - if (version_compare(Shopware::VERSION, '5.2.0', '<')){ |
|
1341 | + if (version_compare(Shopware::VERSION, '5.2.0', '<')) { |
|
1333 | 1342 | $view->assign('KlarnaSkipLoginFix', true); |
1334 | 1343 | } |
1335 | 1344 | if (!$this->isTemplateResponsive()) { |
@@ -1449,7 +1458,7 @@ discard block |
||
1449 | 1458 | $userData['additional'] |
1450 | 1459 | ); |
1451 | 1460 | |
1452 | - if (isset($session['sChangedCountry'])){ |
|
1461 | + if (isset($session['sChangedCountry'])) { |
|
1453 | 1462 | |
1454 | 1463 | /** @var \Shopware\Components\Model\ModelManager $em */ |
1455 | 1464 | $em = $this->get('models'); |
@@ -1545,8 +1554,7 @@ discard block |
||
1545 | 1554 | // compatibility to shopware plugin custom products |
1546 | 1555 | if (isset($basketItem['custom_product_prices'])) { |
1547 | 1556 | $basketItemPrice = (double)$basketItem['custom_product_prices']['total']; |
1548 | - } |
|
1549 | - else { |
|
1557 | + } else { |
|
1550 | 1558 | $basketItemPrice = (double)str_replace(',', '.', $basketItem['price']); |
1551 | 1559 | } |
1552 | 1560 | $unitPrice = round($basketItemPrice * 100); |
@@ -1654,7 +1662,7 @@ discard block |
||
1654 | 1662 | } |
1655 | 1663 | |
1656 | 1664 | // Make sure phone number is unset if empty |
1657 | - if ($address['phone'] === null){ |
|
1665 | + if ($address['phone'] === null) { |
|
1658 | 1666 | unset($address['phone']); |
1659 | 1667 | } |
1660 | 1668 | return $address; |
@@ -2295,13 +2303,13 @@ discard block |
||
2295 | 2303 | /** @var Shopware\Models\Attribute\Payment $payment */ |
2296 | 2304 | foreach ($payments as $payment) { |
2297 | 2305 | $paymentObj = $payment->getPayment(); |
2298 | - if (is_null($paymentObj)){ |
|
2306 | + if (is_null($paymentObj)) { |
|
2299 | 2307 | $paymentName = false; |
2300 | 2308 | } else { |
2301 | 2309 | $paymentName = $paymentObj->getName(); |
2302 | 2310 | } |
2303 | 2311 | |
2304 | - if(!$paymentName){ |
|
2312 | + if(!$paymentName) { |
|
2305 | 2313 | continue; |
2306 | 2314 | } |
2307 | 2315 |
@@ -789,7 +789,8 @@ |
||
789 | 789 | $session->offsetGet('sRegisterFinished') |
790 | 790 | ); |
791 | 791 | } |
792 | - } catch (\Exception $ex) { /* do nothing */ |
|
792 | + } catch (\Exception $ex) { |
|
793 | +/* do nothing */ |
|
793 | 794 | $this->plugin->klarnaLog("ERROR while creating User. Exception information:". $ex->getMessage(), 1); |
794 | 795 | } |
795 | 796 | } |