@@ -37,7 +37,7 @@ |
||
37 | 37 | */ |
38 | 38 | protected $transactionId = null; |
39 | 39 | |
40 | - protected $apiUrl = array('live'=>'https://api.klarna.com/','test'=>'https://api.playground.klarna.com/'); |
|
40 | + protected $apiUrl = array('live'=>'https://api.klarna.com/', 'test'=>'https://api.playground.klarna.com/'); |
|
41 | 41 | |
42 | 42 | /** |
43 | 43 | * Creates an instance of light connector |
@@ -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 |
@@ -22,7 +22,6 @@ |
||
22 | 22 | * our trademarks remain entirely with us. |
23 | 23 | */ |
24 | 24 | |
25 | -use Doctrine\DBAL\Connection; |
|
26 | 25 | use Shopware\Components\StreetSplitService; |
27 | 26 | |
28 | 27 | # Load dummy interface CSRFWhitelistAware for SW < 5.2 |
@@ -532,7 +532,7 @@ discard block |
||
532 | 532 | * |
533 | 533 | * @param array $orderDataRaw |
534 | 534 | * @param string $type |
535 | - * @return bool|KlarnaAddr |
|
535 | + * @return KlarnaAddr |
|
536 | 536 | */ |
537 | 537 | protected function getKlarnaAddrByRawOrderData($orderDataRaw, $type) |
538 | 538 | { |
@@ -1710,7 +1710,7 @@ discard block |
||
1710 | 1710 | /** |
1711 | 1711 | * Creates and returns the klarna client for an event. |
1712 | 1712 | * |
1713 | - * @return \Klarna_Checkout_Connector |
|
1713 | + * @return Klarna_Checkout_ConnectorInterface |
|
1714 | 1714 | */ |
1715 | 1715 | public function onInitResourceKlarnaCheckoutConnector() |
1716 | 1716 | { |
@@ -1760,7 +1760,7 @@ discard block |
||
1760 | 1760 | |
1761 | 1761 | /** |
1762 | 1762 | * @param string $requiredVersion |
1763 | - * @return bool|mixed |
|
1763 | + * @return boolean |
|
1764 | 1764 | */ |
1765 | 1765 | protected function assertMinimumVersion($requiredVersion) |
1766 | 1766 | { |
@@ -1867,7 +1867,7 @@ discard block |
||
1867 | 1867 | * Helper method to get the config whether or not to show the login-panel in the klarna-checkout. |
1868 | 1868 | * |
1869 | 1869 | * @param Enlight_Config $config |
1870 | - * @param $userLoggedIn |
|
1870 | + * @param boolean $userLoggedIn |
|
1871 | 1871 | * @return bool |
1872 | 1872 | */ |
1873 | 1873 | private function getShowLoginConfig($config, $userLoggedIn) |
@@ -1927,7 +1927,7 @@ discard block |
||
1927 | 1927 | * Helper method to get the correct order for the elements |
1928 | 1928 | * |
1929 | 1929 | * @param $config Enlight_Config |
1930 | - * @return array Array with the order of the elements |
|
1930 | + * @return string[] Array with the order of the elements |
|
1931 | 1931 | */ |
1932 | 1932 | private function getPositionOrder($config) |
1933 | 1933 | { |
@@ -2232,7 +2232,7 @@ discard block |
||
2232 | 2232 | /** |
2233 | 2233 | * @param Shopware\Models\Payment\Payment $payment |
2234 | 2234 | * @param $basket |
2235 | - * @return bool |
|
2235 | + * @return double |
|
2236 | 2236 | */ |
2237 | 2237 | private function getFee($payment, $basket) |
2238 | 2238 | { |
@@ -1359,12 +1359,12 @@ discard block |
||
1359 | 1359 | /** @var Enlight_Components_Session_Namespace $session */ |
1360 | 1360 | $session = $this->Application()->Session(); |
1361 | 1361 | |
1362 | - // Switch User to external PaymentId after registration |
|
1363 | - if (isset($session['KlarnaExternalPaymentId'])) { |
|
1362 | + // Switch User to external PaymentId after registration |
|
1363 | + if (isset($session['KlarnaExternalPaymentId'])) { |
|
1364 | 1364 | $this->savePayment($session['KlarnaExternalPaymentId']); |
1365 | 1365 | } |
1366 | 1366 | |
1367 | - $view->assign('klarnaRedirect', $request->has('klarnaRedirect') && $request->getParam('klarnaRedirect') == 1); |
|
1367 | + $view->assign('klarnaRedirect', $request->has('klarnaRedirect') && $request->getParam('klarnaRedirect') == 1); |
|
1368 | 1368 | } |
1369 | 1369 | |
1370 | 1370 | |
@@ -1455,7 +1455,7 @@ discard block |
||
1455 | 1455 | $userData['billingaddress']['country'] =$country; |
1456 | 1456 | $userData['shippingaddress']['countryID'] = $session['sChangedCountry']; |
1457 | 1457 | $userData['billingaddress']['countryID'] = $session['sChangedCountry']; |
1458 | - } |
|
1458 | + } |
|
1459 | 1459 | |
1460 | 1460 | $orderVariables['sUserData'] = $userData; |
1461 | 1461 | $testbreakpoint = 0; |
@@ -506,10 +506,10 @@ discard block |
||
506 | 506 | $elementId = Shopware()->Db()->fetchOne('SELECT id FROM s_core_config_elements WHERE name = ?', [$configname]); |
507 | 507 | $logLevelConfigSetting = Shopware()->Db()->fetchOne('SELECT value FROM s_core_config_values WHERE element_id = ?', [$elementId]); |
508 | 508 | $logLevelConfigSetting = unserialize($logLevelConfigSetting); |
509 | - $logLevelSetting = (is_numeric($logLevelConfigSetting) && $logLevelConfigSetting >=0 && $logLevelConfigSetting <=4) ? (int)$logLevelConfigSetting : 1; |
|
509 | + $logLevelSetting = (is_numeric($logLevelConfigSetting) && $logLevelConfigSetting >= 0 && $logLevelConfigSetting <= 4) ? (int) $logLevelConfigSetting : 1; |
|
510 | 510 | |
511 | 511 | if ($logLevelMessage <= $logLevelSetting) { |
512 | - $prefix = "[".date('Y-m-d H:i:s')."] "; |
|
512 | + $prefix = "[" . date('Y-m-d H:i:s') . "] "; |
|
513 | 513 | $debugBacktrace = ''; |
514 | 514 | if ($logLevelSetting >= 4) { |
515 | 515 | $debugBacktrace = print_r(debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS), true); |
@@ -518,9 +518,9 @@ discard block |
||
518 | 518 | if ($mPrintableElement !== null) { |
519 | 519 | $sPrintableElementMessage = print_r($mPrintableElement, true); |
520 | 520 | } |
521 | - $fullMessage = $prefix.$message."\n".$sPrintableElementMessage.$debugBacktrace; |
|
521 | + $fullMessage = $prefix . $message . "\n" . $sPrintableElementMessage . $debugBacktrace; |
|
522 | 522 | $shopPath = Shopware()->DocPath(); |
523 | - $logfilePath = $shopPath.'/var/log/klarnaTrace.log'; |
|
523 | + $logfilePath = $shopPath . '/var/log/klarnaTrace.log'; |
|
524 | 524 | $fileHandler = fopen($logfilePath, 'a'); |
525 | 525 | fwrite($fileHandler, $fullMessage); |
526 | 526 | fclose($fileHandler); |
@@ -549,7 +549,7 @@ discard block |
||
549 | 549 | $country = $repository->findOneBy(['id' => $baseData['countryId']]); |
550 | 550 | $countryiso = $country->getIso(); |
551 | 551 | |
552 | - $klarnaAddr = new KlarnaAddr(); |
|
552 | + $klarnaAddr = new KlarnaAddr(); |
|
553 | 553 | $klarnaAddr->setEmail($orderDataRaw['customerEmail']); |
554 | 554 | $klarnaAddr->setFirstName($baseData['firstName']); |
555 | 555 | $klarnaAddr->setLastName($baseData['lastName']); |
@@ -597,7 +597,7 @@ discard block |
||
597 | 597 | } |
598 | 598 | $streetnr .= (string) $addressPart; |
599 | 599 | } else { |
600 | - $street .= (string)' '.$addressPart; |
|
600 | + $street .= (string) ' ' . $addressPart; |
|
601 | 601 | } |
602 | 602 | } |
603 | 603 | |
@@ -606,7 +606,7 @@ discard block |
||
606 | 606 | $streetnr_extension .= $baseData['additionalAddressLine1']; |
607 | 607 | } |
608 | 608 | if (!empty($baseData['additionalAddressLine2'])) { |
609 | - $streetnr_extension .= "\n".$baseData['additionalAddressLine2']; |
|
609 | + $streetnr_extension .= "\n" . $baseData['additionalAddressLine2']; |
|
610 | 610 | } |
611 | 611 | |
612 | 612 | $return = [ |
@@ -1284,7 +1284,7 @@ discard block |
||
1284 | 1284 | |
1285 | 1285 | // just return in case kco payment is deactivated in backend |
1286 | 1286 | |
1287 | - if (!$this->isKcoPaymentActive()){ |
|
1287 | + if (!$this->isKcoPaymentActive()) { |
|
1288 | 1288 | return; |
1289 | 1289 | } |
1290 | 1290 | $user = $view->getAssign('sUserData'); |
@@ -1295,7 +1295,7 @@ discard block |
||
1295 | 1295 | && ($request->getActionName() == 'cart' || $request->getActionName() == 'ajaxCart') |
1296 | 1296 | ) { |
1297 | 1297 | $this->registerMyTemplateDir(); |
1298 | - $view->assign('KlarnaEnableButton', (bool)$config->get('showKlarnaButton')); |
|
1298 | + $view->assign('KlarnaEnableButton', (bool) $config->get('showKlarnaButton')); |
|
1299 | 1299 | $view->assign('KlarnaShowCheckoutButton', $this->getShowCheckoutButton($user)); |
1300 | 1300 | $view->assign('klarnaKcoPaymentActive', $this->isKlarnaKcoPaymentActive($user)); |
1301 | 1301 | $view->assign('KlarnaPaymentDescription', $this->getPayment()->getDescription()); |
@@ -1324,7 +1324,7 @@ discard block |
||
1324 | 1324 | $view->assign('KlarnaMerchantId', $config->get('merchantId')); |
1325 | 1325 | $view->assign('KlarnaHideCheckoutSteps', true); |
1326 | 1326 | |
1327 | - if (version_compare(Shopware::VERSION, '5.2.0', '<')){ |
|
1327 | + if (version_compare(Shopware::VERSION, '5.2.0', '<')) { |
|
1328 | 1328 | $view->assign('KlarnaSkipLoginFix', true); |
1329 | 1329 | } |
1330 | 1330 | if (!$this->isTemplateResponsive()) { |
@@ -1444,15 +1444,15 @@ discard block |
||
1444 | 1444 | $userData['additional'] |
1445 | 1445 | ); |
1446 | 1446 | |
1447 | - if (isset($session['sChangedCountry'])){ |
|
1447 | + if (isset($session['sChangedCountry'])) { |
|
1448 | 1448 | |
1449 | 1449 | /** @var \Shopware\Components\Model\ModelManager $em */ |
1450 | 1450 | $em = $this->get('models'); |
1451 | 1451 | |
1452 | 1452 | /** @var \Shopware\Models\Customer\Customer $customer */ |
1453 | 1453 | $country = $em->getRepository('Shopware\Models\Country\Country')->findOneBy(['id' => $session['sChangedCountry']]); |
1454 | - $userData['shippingaddress']['country'] =$country; |
|
1455 | - $userData['billingaddress']['country'] =$country; |
|
1454 | + $userData['shippingaddress']['country'] = $country; |
|
1455 | + $userData['billingaddress']['country'] = $country; |
|
1456 | 1456 | $userData['shippingaddress']['countryID'] = $session['sChangedCountry']; |
1457 | 1457 | $userData['billingaddress']['countryID'] = $session['sChangedCountry']; |
1458 | 1458 | } |
@@ -1472,10 +1472,10 @@ discard block |
||
1472 | 1472 | $this->klarnaLog("Entering Bootstrap::getCountryByShop", 3); |
1473 | 1473 | $locale = explode('_', $locale); |
1474 | 1474 | $locale = isset($locale[1]) ? $locale[1] : $locale[0]; |
1475 | - $this->klarnaLog("Bootstrap::getCountryByShop locale to request for:".$locale,3); |
|
1475 | + $this->klarnaLog("Bootstrap::getCountryByShop locale to request for:" . $locale, 3); |
|
1476 | 1476 | $sql = 'SELECT id FROM s_core_countries WHERE countryiso=?'; |
1477 | 1477 | $countryId = Shopware()->Db()->fetchOne($sql, [$locale]); |
1478 | - $countryId = ($countryId) ? (int)$countryId : null; |
|
1478 | + $countryId = ($countryId) ? (int) $countryId : null; |
|
1479 | 1479 | |
1480 | 1480 | return $countryId; |
1481 | 1481 | } |
@@ -1506,7 +1506,7 @@ discard block |
||
1506 | 1506 | $locale = $locale == 'nn-no' ? 'nb-no' : $locale; |
1507 | 1507 | |
1508 | 1508 | if ($locale == 'de-de') { |
1509 | - if($countryIso == 'CH') { |
|
1509 | + if ($countryIso == 'CH') { |
|
1510 | 1510 | $locale = 'de-ch'; |
1511 | 1511 | } elseif ($countryIso == 'AT') { |
1512 | 1512 | $locale = 'de-at'; |
@@ -1521,10 +1521,10 @@ discard block |
||
1521 | 1521 | $config = $this->Config(); |
1522 | 1522 | $options = $this->getColorConfigOptions($config); |
1523 | 1523 | |
1524 | - $options['allow_separate_shipping_address'] = (bool)$config->get('allowSeparateShippingAddress'); |
|
1525 | - $options['packstation_enabled'] = (bool)$config->get('supportPackstation') && $allowPackstation; |
|
1526 | - $options['phone_mandatory'] = (bool)$config->get('mandatoryPhone'); |
|
1527 | - $options['date_of_birth_mandatory'] = (bool)$config->get('mandatoryBirthday'); |
|
1524 | + $options['allow_separate_shipping_address'] = (bool) $config->get('allowSeparateShippingAddress'); |
|
1525 | + $options['packstation_enabled'] = (bool) $config->get('supportPackstation') && $allowPackstation; |
|
1526 | + $options['phone_mandatory'] = (bool) $config->get('mandatoryPhone'); |
|
1527 | + $options['date_of_birth_mandatory'] = (bool) $config->get('mandatoryBirthday'); |
|
1528 | 1528 | |
1529 | 1529 | if (!empty($dispatch)) { |
1530 | 1530 | $options['shipping_details'] = $dispatch['description']; |
@@ -1539,19 +1539,19 @@ discard block |
||
1539 | 1539 | foreach ($basket['content'] as $index=>$basketItem) { |
1540 | 1540 | // compatibility to shopware plugin custom products |
1541 | 1541 | if (isset($basketItem['custom_product_prices'])) { |
1542 | - $basketItemPrice = (double)$basketItem['custom_product_prices']['total']; |
|
1542 | + $basketItemPrice = (double) $basketItem['custom_product_prices']['total']; |
|
1543 | 1543 | } |
1544 | 1544 | else { |
1545 | - $basketItemPrice = (double)str_replace(',', '.', $basketItem['price']); |
|
1545 | + $basketItemPrice = (double) str_replace(',', '.', $basketItem['price']); |
|
1546 | 1546 | } |
1547 | 1547 | $unitPrice = round($basketItemPrice * 100); |
1548 | 1548 | $cart[] = [ |
1549 | 1549 | 'type' => $unitPrice >= 0 ? 'physical' : 'discount', |
1550 | 1550 | 'reference' => $basketItem['ordernumber'], |
1551 | 1551 | 'name' => $basketItem['articlename'], |
1552 | - 'quantity' => (int)$basketItem['quantity'], |
|
1553 | - 'unit_price' => (int)$unitPrice, |
|
1554 | - 'tax_rate' => (int)round($basketItem['tax_rate'] * 100) |
|
1552 | + 'quantity' => (int) $basketItem['quantity'], |
|
1553 | + 'unit_price' => (int) $unitPrice, |
|
1554 | + 'tax_rate' => (int) round($basketItem['tax_rate'] * 100) |
|
1555 | 1555 | ]; |
1556 | 1556 | } |
1557 | 1557 | if (!empty($basket['sShippingcosts'])) { |
@@ -1562,8 +1562,8 @@ discard block |
||
1562 | 1562 | 'reference' => 'SHIPPING', |
1563 | 1563 | 'name' => 'Shipping Fee', |
1564 | 1564 | 'quantity' => 1, |
1565 | - 'unit_price' => (int)round($shippingAmount * 100), |
|
1566 | - 'tax_rate' => (int)round($basket['sShippingcostsTax'] * 100), |
|
1565 | + 'unit_price' => (int) round($shippingAmount * 100), |
|
1566 | + 'tax_rate' => (int) round($basket['sShippingcostsTax'] * 100), |
|
1567 | 1567 | ]; |
1568 | 1568 | } |
1569 | 1569 | |
@@ -1649,7 +1649,7 @@ discard block |
||
1649 | 1649 | } |
1650 | 1650 | |
1651 | 1651 | // Make sure phone number is unset if empty |
1652 | - if ($address['phone'] === null){ |
|
1652 | + if ($address['phone'] === null) { |
|
1653 | 1653 | unset($address['phone']); |
1654 | 1654 | } |
1655 | 1655 | return $address; |
@@ -1838,9 +1838,9 @@ discard block |
||
1838 | 1838 | $view->assign('sPayments', $this->filterPayments($adminModule->sGetPaymentMeans())); |
1839 | 1839 | $view->assign('sCountryList', $adminModule->sGetCountryList()); |
1840 | 1840 | $view->assign('KlarnaHideCheckoutSteps', true); |
1841 | - $view->assign('KlarnaShowB2bSelect', (bool)$config->get('showB2bSelect')); |
|
1842 | - $view->assign('KlarnaShowBasket', (bool)$config->get('showMiniBasket')); |
|
1843 | - $view->assign('KlarnaShowDispatch', (bool)$config->get('showDispatch')); |
|
1841 | + $view->assign('KlarnaShowB2bSelect', (bool) $config->get('showB2bSelect')); |
|
1842 | + $view->assign('KlarnaShowBasket', (bool) $config->get('showMiniBasket')); |
|
1843 | + $view->assign('KlarnaShowDispatch', (bool) $config->get('showDispatch')); |
|
1844 | 1844 | $view->assign( |
1845 | 1845 | 'KlarnaCDNLink', |
1846 | 1846 | $this->buildCDNLink() |
@@ -1284,7 +1284,7 @@ discard block |
||
1284 | 1284 | |
1285 | 1285 | // just return in case kco payment is deactivated in backend |
1286 | 1286 | |
1287 | - if (!$this->isKcoPaymentActive()){ |
|
1287 | + if (!$this->isKcoPaymentActive()) { |
|
1288 | 1288 | return; |
1289 | 1289 | } |
1290 | 1290 | $user = $view->getAssign('sUserData'); |
@@ -1324,7 +1324,7 @@ discard block |
||
1324 | 1324 | $view->assign('KlarnaMerchantId', $config->get('merchantId')); |
1325 | 1325 | $view->assign('KlarnaHideCheckoutSteps', true); |
1326 | 1326 | |
1327 | - if (version_compare(Shopware::VERSION, '5.2.0', '<')){ |
|
1327 | + if (version_compare(Shopware::VERSION, '5.2.0', '<')) { |
|
1328 | 1328 | $view->assign('KlarnaSkipLoginFix', true); |
1329 | 1329 | } |
1330 | 1330 | if (!$this->isTemplateResponsive()) { |
@@ -1444,7 +1444,7 @@ discard block |
||
1444 | 1444 | $userData['additional'] |
1445 | 1445 | ); |
1446 | 1446 | |
1447 | - if (isset($session['sChangedCountry'])){ |
|
1447 | + if (isset($session['sChangedCountry'])) { |
|
1448 | 1448 | |
1449 | 1449 | /** @var \Shopware\Components\Model\ModelManager $em */ |
1450 | 1450 | $em = $this->get('models'); |
@@ -1540,8 +1540,7 @@ discard block |
||
1540 | 1540 | // compatibility to shopware plugin custom products |
1541 | 1541 | if (isset($basketItem['custom_product_prices'])) { |
1542 | 1542 | $basketItemPrice = (double)$basketItem['custom_product_prices']['total']; |
1543 | - } |
|
1544 | - else { |
|
1543 | + } else { |
|
1545 | 1544 | $basketItemPrice = (double)str_replace(',', '.', $basketItem['price']); |
1546 | 1545 | } |
1547 | 1546 | $unitPrice = round($basketItemPrice * 100); |
@@ -1649,7 +1648,7 @@ discard block |
||
1649 | 1648 | } |
1650 | 1649 | |
1651 | 1650 | // Make sure phone number is unset if empty |
1652 | - if ($address['phone'] === null){ |
|
1651 | + if ($address['phone'] === null) { |
|
1653 | 1652 | unset($address['phone']); |
1654 | 1653 | } |
1655 | 1654 | return $address; |
@@ -42,6 +42,7 @@ |
||
42 | 42 | |
43 | 43 | /** |
44 | 44 | * {@inheritdoc} |
45 | + * @param string $name |
|
45 | 46 | */ |
46 | 47 | public function get($name) |
47 | 48 | { |
@@ -112,13 +112,13 @@ discard block |
||
112 | 112 | } |
113 | 113 | |
114 | 114 | if ($this->Request()->getPost('sCountry')) { |
115 | - $this->session['sCountry'] = (int)$this->Request()->getPost('sCountry'); |
|
115 | + $this->session['sCountry'] = (int) $this->Request()->getPost('sCountry'); |
|
116 | 116 | $this->session["sState"] = 0; |
117 | 117 | $this->session["sArea"] = Shopware()->Db()->fetchOne(" |
118 | 118 | SELECT areaID FROM s_core_countries WHERE id = ? |
119 | 119 | ", [$this->session['sCountry']]); |
120 | 120 | unset($this->session->KlarnaOrder); |
121 | - $this->session['sChangedCountry'] = (int)$this->Request()->getPost('sCountry'); |
|
121 | + $this->session['sChangedCountry'] = (int) $this->Request()->getPost('sCountry'); |
|
122 | 122 | } |
123 | 123 | $this->forward('index'); |
124 | 124 | } |
@@ -158,7 +158,7 @@ discard block |
||
158 | 158 | $this->redirect(['controller' => 'payment_klarna', 'action' => 'otherPayment']); |
159 | 159 | return; |
160 | 160 | } |
161 | - $shopCountryId = (string)$shopCountryId; |
|
161 | + $shopCountryId = (string) $shopCountryId; |
|
162 | 162 | if ($shopCountryId != $postedCountry) { |
163 | 163 | $this->session['sCountry'] = $postedCountry; |
164 | 164 | // unset klarnaOrder so it will be created with new countryID |
@@ -313,10 +313,10 @@ discard block |
||
313 | 313 | |
314 | 314 | $this->basket['sAmountTax'] = 1.9; |
315 | 315 | $this->View()->sShippingcosts = $debugShipping['brutto']; |
316 | - $this->View()->sShippingcostsWithTax = $debugShipping['brutto']; |
|
316 | + $this->View()->sShippingcostsWithTax = $debugShipping['brutto']; |
|
317 | 317 | $this->View()->sShippingcostsNet = $debugShipping['netto']; |
318 | 318 | $this->View()->sShippingcostsTax = $debugShipping['tax']; |
319 | - $this->View()->sAmount = $this->basket['AmountWithTaxNumeric'] ; |
|
319 | + $this->View()->sAmount = $this->basket['AmountWithTaxNumeric']; |
|
320 | 320 | |
321 | 321 | $this->View()->sAmountNet = $this->basket['sAmountNet']; |
322 | 322 | $this->View()->sAmountTax = $this->basket['sAmountTax']; |
@@ -790,7 +790,7 @@ discard block |
||
790 | 790 | ); |
791 | 791 | } |
792 | 792 | } catch (\Exception $ex) { /* do nothing */ |
793 | - $this->plugin->klarnaLog("ERROR while creating User. Exception information:". $ex->getMessage(), 1); |
|
793 | + $this->plugin->klarnaLog("ERROR while creating User. Exception information:" . $ex->getMessage(), 1); |
|
794 | 794 | } |
795 | 795 | } |
796 | 796 | } |
@@ -1036,8 +1036,8 @@ discard block |
||
1036 | 1036 | |
1037 | 1037 | $update['status'] = 'created'; |
1038 | 1038 | $update['merchant_reference'] = [ |
1039 | - 'orderid1' => (string)$orderNumber, |
|
1040 | - 'orderid2' => (string)$order['reference'] |
|
1039 | + 'orderid1' => (string) $orderNumber, |
|
1040 | + 'orderid2' => (string) $order['reference'] |
|
1041 | 1041 | ]; |
1042 | 1042 | $order->update($update); |
1043 | 1043 | } |
@@ -1366,8 +1366,8 @@ discard block |
||
1366 | 1366 | |
1367 | 1367 | $update['status'] = 'created'; |
1368 | 1368 | $update['merchant_reference'] = [ |
1369 | - 'orderid1' => (string)$orderNumber, |
|
1370 | - 'orderid2' => (string)$order['reference'] |
|
1369 | + 'orderid1' => (string) $orderNumber, |
|
1370 | + 'orderid2' => (string) $order['reference'] |
|
1371 | 1371 | ]; |
1372 | 1372 | $order->update($update); |
1373 | 1373 | } |
@@ -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 | } |
@@ -130,7 +130,7 @@ discard block |
||
130 | 130 | public function showIframeAction() |
131 | 131 | { |
132 | 132 | $this->basket = $this->get('modules')->Basket()->sGetBasket(); |
133 | - $preFill = $this->config['preFillCheckout']; |
|
133 | + $preFill = $this->config['preFillCheckout']; |
|
134 | 134 | if ($this->isUserLoggedIn()) { |
135 | 135 | $user = Shopware()->Modules()->Admin()->sGetUserData(); |
136 | 136 | } |
@@ -289,7 +289,7 @@ discard block |
||
289 | 289 | |
290 | 290 | // Klarna Prefill checkBox |
291 | 291 | if ($this->isUserLoggedIn()) { |
292 | - $this->View()->assign('KlarnaPreFillSelect', !$this->session['klarnaPreFill']); |
|
292 | + $this->View()->assign('KlarnaPreFillSelect', !$this->session['klarnaPreFill']); |
|
293 | 293 | } |
294 | 294 | |
295 | 295 | // Iframe Backend Config |
@@ -703,8 +703,8 @@ discard block |
||
703 | 703 | } |
704 | 704 | $module->sSYSTEM->_POST = $data['billing']; |
705 | 705 | if ($this->plugin->isShopwareVersionNew()) { |
706 | - $userId = $session->offsetGet('sUserId'); |
|
707 | - $this->updateBilling($userId, $data['billing']); |
|
706 | + $userId = $session->offsetGet('sUserId'); |
|
707 | + $this->updateBilling($userId, $data['billing']); |
|
708 | 708 | } else { |
709 | 709 | $module->sUpdateBilling(); |
710 | 710 | } |
@@ -822,7 +822,7 @@ discard block |
||
822 | 822 | $plainbilling['birthday'] = null; |
823 | 823 | } else { |
824 | 824 | $plainbilling['birthday'] = new \DateTime( |
825 | - $plainbilling['birthyear'] . '-' . |
|
825 | + $plainbilling['birthyear'] . '-' . |
|
826 | 826 | $plainbilling['birthmonth'] . '-' . |
827 | 827 | $plainbilling['birthday']); |
828 | 828 | } |
@@ -893,12 +893,12 @@ discard block |
||
893 | 893 | } |
894 | 894 | |
895 | 895 | |
896 | - /** |
|
897 | - * Updates the shipping address |
|
898 | - * |
|
899 | - * @param int $userId |
|
900 | - * @param array $shippingData |
|
901 | - */ |
|
896 | + /** |
|
897 | + * Updates the shipping address |
|
898 | + * |
|
899 | + * @param int $userId |
|
900 | + * @param array $shippingData |
|
901 | + */ |
|
902 | 902 | private function updateShipping($userId, $shippingData) |
903 | 903 | { |
904 | 904 | /** @var \Shopware\Components\Model\ModelManager $em */ |
@@ -911,7 +911,7 @@ discard block |
||
911 | 911 | $addressold = $customer->getDefaultShippingAddress(); |
912 | 912 | $address = new \Shopware\Models\Customer\Address(); |
913 | 913 | |
914 | - /** @var \Shopware\Models\Country\Country $country */ |
|
914 | + /** @var \Shopware\Models\Country\Country $country */ |
|
915 | 915 | $country = $addressold->getCountry(); |
916 | 916 | $shippingData['country'] = $country; |
917 | 917 | if ($shippingData['phone'] === null) { |
@@ -947,7 +947,7 @@ discard block |
||
947 | 947 | /** @var \Shopware\Models\Customer\Address $address */ |
948 | 948 | $address = $customer->getDefaultBillingAddress(); |
949 | 949 | |
950 | - /** @var \Shopware\Models\Country\Country $country */ |
|
950 | + /** @var \Shopware\Models\Country\Country $country */ |
|
951 | 951 | $country = $address->getCountry(); |
952 | 952 | $billingData['country'] = $country; |
953 | 953 | $address->fromArray($billingData); |
@@ -1522,7 +1522,7 @@ discard block |
||
1522 | 1522 | */ |
1523 | 1523 | protected function isUserLoggedIn() |
1524 | 1524 | { |
1525 | - return (isset($this->session->sUserId) && !empty($this->session->sUserId)); |
|
1525 | + return (isset($this->session->sUserId) && !empty($this->session->sUserId)); |
|
1526 | 1526 | } |
1527 | 1527 | |
1528 | 1528 | /** |
@@ -116,20 +116,20 @@ |
||
116 | 116 | public function toHTML() |
117 | 117 | { |
118 | 118 | $html |
119 | - = "<p style='display: none; ". |
|
120 | - "background:url($this->proto://$this->host/fp/clear.png?org_id=". |
|
121 | - "$this->orgID&session_id=$this->sessionID&m=1)'></p>". |
|
122 | - "<script src='$this->proto://$this->host/fp/check.js?org_id=". |
|
123 | - "$this->orgID&session_id=$this->sessionID' ". |
|
124 | - "type='text/javascript'></script>". |
|
125 | - "<img src='$this->proto://$this->host/fp/clear.png?org_id=". |
|
126 | - "$this->orgID&session_id=$this->sessionID&m=2' alt='' >". |
|
127 | - "<object type='application/x-shockwave-flash' style='display: none' ". |
|
128 | - "data='$this->proto://$this->host/fp/fp.swf?org_id=$this->orgID&". |
|
129 | - "session_id=$this->sessionID' width='1' height='1' id='obj_id'>". |
|
130 | - "<param name='movie' value='$this->proto://$this->host/fp/fp.swf?". |
|
131 | - "org_id=$this->orgID&session_id=$this->sessionID' />". |
|
132 | - "<div></div>". |
|
119 | + = "<p style='display: none; " . |
|
120 | + "background:url($this->proto://$this->host/fp/clear.png?org_id=" . |
|
121 | + "$this->orgID&session_id=$this->sessionID&m=1)'></p>" . |
|
122 | + "<script src='$this->proto://$this->host/fp/check.js?org_id=" . |
|
123 | + "$this->orgID&session_id=$this->sessionID' " . |
|
124 | + "type='text/javascript'></script>" . |
|
125 | + "<img src='$this->proto://$this->host/fp/clear.png?org_id=" . |
|
126 | + "$this->orgID&session_id=$this->sessionID&m=2' alt='' >" . |
|
127 | + "<object type='application/x-shockwave-flash' style='display: none' " . |
|
128 | + "data='$this->proto://$this->host/fp/fp.swf?org_id=$this->orgID&" . |
|
129 | + "session_id=$this->sessionID' width='1' height='1' id='obj_id'>" . |
|
130 | + "<param name='movie' value='$this->proto://$this->host/fp/fp.swf?" . |
|
131 | + "org_id=$this->orgID&session_id=$this->sessionID' />" . |
|
132 | + "<div></div>" . |
|
133 | 133 | "</object>"; |
134 | 134 | return $html; |
135 | 135 | } |
@@ -226,7 +226,7 @@ |
||
226 | 226 | $xpath = new DOMXpath($this->dom); |
227 | 227 | |
228 | 228 | foreach ($this->pclasses as $eid => $pclasses) { |
229 | - $estore = $xpath->query('/klarna/estore[@id="'.$eid.'"]'); |
|
229 | + $estore = $xpath->query('/klarna/estore[@id="' . $eid . '"]'); |
|
230 | 230 | |
231 | 231 | if ($estore === false || $estore->length === 0) { |
232 | 232 | //No estore with matching eid, create it. |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | $this->link = mysql_connect($this->addr, $this->user, $this->passwd); |
121 | 121 | if ($this->link === false) { |
122 | 122 | throw new Klarna_DatabaseException( |
123 | - 'Failed to connect to database! ('.mysql_error().')' |
|
123 | + 'Failed to connect to database! (' . mysql_error() . ')' |
|
124 | 124 | ); |
125 | 125 | } |
126 | 126 | } |
@@ -140,7 +140,7 @@ discard block |
||
140 | 140 | ) |
141 | 141 | ) { |
142 | 142 | throw new Klarna_DatabaseException( |
143 | - 'Failed to create! ('.mysql_error().')' |
|
143 | + 'Failed to create! (' . mysql_error() . ')' |
|
144 | 144 | ); |
145 | 145 | } |
146 | 146 | |
@@ -163,7 +163,7 @@ discard block |
||
163 | 163 | |
164 | 164 | if (!$create) { |
165 | 165 | throw new Klarna_DatabaseException( |
166 | - 'Table not existing, failed to create! ('.mysql_error().')' |
|
166 | + 'Table not existing, failed to create! (' . mysql_error() . ')' |
|
167 | 167 | ); |
168 | 168 | } |
169 | 169 | } |
@@ -247,7 +247,7 @@ discard block |
||
247 | 247 | ); |
248 | 248 | if ($result === false) { |
249 | 249 | throw new Klarna_DatabaseException( |
250 | - 'SELECT query failed! ('.mysql_error().')' |
|
250 | + 'SELECT query failed! (' . mysql_error() . ')' |
|
251 | 251 | ); |
252 | 252 | } |
253 | 253 | while ($row = mysql_fetch_assoc($result)) { |
@@ -311,7 +311,7 @@ discard block |
||
311 | 311 | ); |
312 | 312 | if ($result === false) { |
313 | 313 | throw new Klarna_DatabaseException( |
314 | - 'INSERT INTO query failed! ('.mysql_error().')' |
|
314 | + 'INSERT INTO query failed! (' . mysql_error() . ')' |
|
315 | 315 | ); |
316 | 316 | } |
317 | 317 | } |
@@ -337,7 +337,7 @@ discard block |
||
337 | 337 | "DELETE FROM `{$this->dbName}`.`{$this->dbTable}`", |
338 | 338 | $this->link |
339 | 339 | ); |
340 | - } catch(Exception $e) { |
|
340 | + } catch (Exception $e) { |
|
341 | 341 | throw new Klarna_DatabaseException( |
342 | 342 | $e->getMessage(), $e->getCode() |
343 | 343 | ); |
@@ -3,6 +3,8 @@ |
||
3 | 3 | namespace Shopware\Components; |
4 | 4 | |
5 | 5 | if (!interface_exists('\Shopware\Components\CSRFWhitelistAware')) { |
6 | - interface CSRFWhitelistAware {} |
|
6 | + interface CSRFWhitelistAware |
|
7 | + { |
|
8 | +} |
|
7 | 9 | } |
8 | 10 |
@@ -449,7 +449,7 @@ |
||
449 | 449 | $orderId = $this->Request()->getParam('orderId'); |
450 | 450 | $this->registerShopByOrderId($orderId); |
451 | 451 | $order = $this->getOrderById($orderId); |
452 | - $value = (float)str_replace(',', '.', $this->Request()->getParam('value')); |
|
452 | + $value = (float) str_replace(',', '.', $this->Request()->getParam('value')); |
|
453 | 453 | $service = $this->getService($order); |
454 | 454 | |
455 | 455 | /** @noinspection PhpUndefinedMethodInspection */ |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | |
102 | 102 | $order = $this->orderRepository->find($orderId); |
103 | 103 | if ($order === null) { |
104 | - throw new \Exception("Order {$orderId} not found"); |
|
104 | + throw new \Exception("order {$orderId} not found"); |
|
105 | 105 | } |
106 | 106 | $shopId = $order->getLanguageIso(); |
107 | 107 | if ($shopId === null) { |
@@ -110,7 +110,7 @@ discard block |
||
110 | 110 | $shop = $repository->getActiveById($shopId); |
111 | 111 | } |
112 | 112 | if ($shop === null) { |
113 | - throw new \Exception("Shop {$shopId} not found"); |
|
113 | + throw new \Exception("shop {$shopId} not found"); |
|
114 | 114 | } |
115 | 115 | $shop->registerResources(Shopware()->Bootstrap()); |
116 | 116 | $this->modelManager->clear(); |
@@ -43,6 +43,7 @@ discard block |
||
43 | 43 | |
44 | 44 | /** |
45 | 45 | * {@inheritdoc} |
46 | + * @param string $name |
|
46 | 47 | */ |
47 | 48 | public function get($name) |
48 | 49 | { |
@@ -117,6 +118,9 @@ discard block |
||
117 | 118 | return $shop; |
118 | 119 | } |
119 | 120 | |
121 | + /** |
|
122 | + * @param string $statusType |
|
123 | + */ |
|
120 | 124 | private function getOrderPaymentStatus($statusType) |
121 | 125 | { |
122 | 126 | $paymentStatus = $this->plugin->Config()->get($statusType); |
@@ -633,7 +637,7 @@ discard block |
||
633 | 637 | |
634 | 638 | |
635 | 639 | /** |
636 | - * @return array |
|
640 | + * @return string[] |
|
637 | 641 | */ |
638 | 642 | public function getWhitelistedCSRFActions() |
639 | 643 | { |