@@ -1678,7 +1678,7 @@ discard block |
||
1678 | 1678 | |
1679 | 1679 | /** |
1680 | 1680 | * |
1681 | - * @return array |
|
1681 | + * @return string |
|
1682 | 1682 | */ |
1683 | 1683 | public function getLabel() |
1684 | 1684 | { |
@@ -1715,7 +1715,7 @@ discard block |
||
1715 | 1715 | /** |
1716 | 1716 | * Creates and returns the klarna client for an event. |
1717 | 1717 | * |
1718 | - * @return \Klarna_Checkout_Connector |
|
1718 | + * @return Klarna_Checkout_ConnectorInterface |
|
1719 | 1719 | */ |
1720 | 1720 | public function onInitResourceKlarnaCheckoutConnector() |
1721 | 1721 | { |
@@ -1768,7 +1768,7 @@ discard block |
||
1768 | 1768 | |
1769 | 1769 | /** |
1770 | 1770 | * @param string $requiredVersion |
1771 | - * @return bool|mixed |
|
1771 | + * @return boolean |
|
1772 | 1772 | */ |
1773 | 1773 | protected function assertMinimumVersion($requiredVersion) |
1774 | 1774 | { |
@@ -1932,6 +1932,7 @@ discard block |
||
1932 | 1932 | * |
1933 | 1933 | * @param $config Enlight_Config |
1934 | 1934 | * @param $lastName string |
1935 | + * @param boolean $userLoggedIn |
|
1935 | 1936 | * @return bool |
1936 | 1937 | */ |
1937 | 1938 | private function getShowLoginConfig($config, $userLoggedIn) |
@@ -2035,7 +2036,7 @@ discard block |
||
2035 | 2036 | * Helper method to get the correct order for the elements |
2036 | 2037 | * |
2037 | 2038 | * @param $config Enlight_Config |
2038 | - * @return array Array with the order of the elements |
|
2039 | + * @return string[] Array with the order of the elements |
|
2039 | 2040 | */ |
2040 | 2041 | private function getPositionOrder($config) |
2041 | 2042 | { |
@@ -2334,7 +2335,7 @@ discard block |
||
2334 | 2335 | /** |
2335 | 2336 | * @param Shopware\Models\Payment\Payment $payment |
2336 | 2337 | * @param $basket |
2337 | - * @return bool |
|
2338 | + * @return double |
|
2338 | 2339 | */ |
2339 | 2340 | private function getFee($payment, $basket) |
2340 | 2341 | { |
@@ -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 |
@@ -491,7 +491,7 @@ discard block |
||
491 | 491 | $args->setReturn($builder); |
492 | 492 | } |
493 | 493 | |
494 | - public function onGetStreetSplitService() |
|
494 | + public function onGetStreetSplitService() |
|
495 | 495 | { |
496 | 496 | $this->Application()->Loader()->registerNamespace( |
497 | 497 | 'Shopware\Components', |
@@ -1364,12 +1364,12 @@ discard block |
||
1364 | 1364 | /** @var Enlight_Components_Session_Namespace $session */ |
1365 | 1365 | $session = $this->Application()->Session(); |
1366 | 1366 | |
1367 | - // Switch User to external PaymentId after registration |
|
1368 | - if (isset($session['KlarnaExternalPaymentId'])) { |
|
1367 | + // Switch User to external PaymentId after registration |
|
1368 | + if (isset($session['KlarnaExternalPaymentId'])) { |
|
1369 | 1369 | $this->savePayment($session['KlarnaExternalPaymentId']); |
1370 | 1370 | } |
1371 | 1371 | |
1372 | - $view->assign('klarnaRedirect', $request->has('klarnaRedirect') && $request->getParam('klarnaRedirect') == 1); |
|
1372 | + $view->assign('klarnaRedirect', $request->has('klarnaRedirect') && $request->getParam('klarnaRedirect') == 1); |
|
1373 | 1373 | } |
1374 | 1374 | |
1375 | 1375 | |
@@ -1460,7 +1460,7 @@ discard block |
||
1460 | 1460 | $userData['billingaddress']['country'] =$country; |
1461 | 1461 | $userData['shippingaddress']['countryID'] = $session['sChangedCountry']; |
1462 | 1462 | $userData['billingaddress']['countryID'] = $session['sChangedCountry']; |
1463 | - } |
|
1463 | + } |
|
1464 | 1464 | |
1465 | 1465 | $orderVariables['sUserData'] = $userData; |
1466 | 1466 | $testbreakpoint = 0; |
@@ -2385,14 +2385,14 @@ discard block |
||
2385 | 2385 | } else { |
2386 | 2386 | $url = $front->Router()->assemble(array('controller' => 'index', 'module' => 'frontend')); |
2387 | 2387 | } |
2388 | - if (version_compare(Shopware::VERSION, '5.2.0', '>=')) { |
|
2388 | + if (version_compare(Shopware::VERSION, '5.2.0', '>=')) { |
|
2389 | 2389 | # make sure me get only the image name, path is set in case of upgarde from SW.5.1 to 5.2 |
2390 | 2390 | $parts = explode('/', $media); |
2391 | 2391 | $end = end($parts); |
2392 | - $media = $url . 'media/image/' . $end; |
|
2393 | - } else { |
|
2394 | - $media = $url . $media; |
|
2395 | - } |
|
2392 | + $media = $url . 'media/image/' . $end; |
|
2393 | + } else { |
|
2394 | + $media = $url . $media; |
|
2395 | + } |
|
2396 | 2396 | } |
2397 | 2397 | |
2398 | 2398 | return $media; |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | use Shopware\Components\StreetSplitService; |
27 | 27 | |
28 | 28 | # Load dummy interface CSRFWhitelistAware for SW < 5.2 |
29 | -require_once __DIR__ . '/Components/CSRFWhitelistAware.php'; |
|
29 | +require_once __DIR__.'/Components/CSRFWhitelistAware.php'; |
|
30 | 30 | |
31 | 31 | /** |
32 | 32 | * Shopware Klarna Plugin |
@@ -252,8 +252,8 @@ discard block |
||
252 | 252 | */ |
253 | 253 | public function getKLarnaService() { |
254 | 254 | if ($this->klarnaService === null) { |
255 | - require_once __DIR__ . '/Components/Klarna/Klarna.php'; |
|
256 | - require_once __DIR__ . '/Components/Klarna/transport/xmlrpc-3.0.0.beta/lib/xmlrpc.inc'; |
|
255 | + require_once __DIR__.'/Components/Klarna/Klarna.php'; |
|
256 | + require_once __DIR__.'/Components/Klarna/transport/xmlrpc-3.0.0.beta/lib/xmlrpc.inc'; |
|
257 | 257 | $this->klarnaService = new Klarna(); |
258 | 258 | } |
259 | 259 | |
@@ -400,8 +400,8 @@ discard block |
||
400 | 400 | |
401 | 401 | $klarnaService = $this->getService(); |
402 | 402 | |
403 | - $klarnaAddrBilling = $this->getKlarnaAddrByRawOrderData($orderDataRaw,'billing'); |
|
404 | - $klarnaAddrShipping = $this->getKlarnaAddrByRawOrderData($orderDataRaw,'shipping'); |
|
403 | + $klarnaAddrBilling = $this->getKlarnaAddrByRawOrderData($orderDataRaw, 'billing'); |
|
404 | + $klarnaAddrShipping = $this->getKlarnaAddrByRawOrderData($orderDataRaw, 'shipping'); |
|
405 | 405 | |
406 | 406 | $transactionId = $orderDataRaw['transactionId']; |
407 | 407 | |
@@ -495,7 +495,7 @@ discard block |
||
495 | 495 | { |
496 | 496 | $this->Application()->Loader()->registerNamespace( |
497 | 497 | 'Shopware\Components', |
498 | - __DIR__ . '/Components/' |
|
498 | + __DIR__.'/Components/' |
|
499 | 499 | ); |
500 | 500 | |
501 | 501 | return new StreetSplitService(); |
@@ -509,27 +509,27 @@ discard block |
||
509 | 509 | * @param mixed $mPrintableElement |
510 | 510 | * @return void |
511 | 511 | */ |
512 | - public function klarnaLog($message, $logLevelMessage=1, $mPrintableElement=null) { |
|
512 | + public function klarnaLog($message, $logLevelMessage = 1, $mPrintableElement = null) { |
|
513 | 513 | $configname = 'klarnaLogLevel'; |
514 | 514 | $elementId = Shopware()->Db()->fetchOne('SELECT id FROM s_core_config_elements WHERE name = ?', [$configname]); |
515 | 515 | $logLevelConfigSetting = Shopware()->Db()->fetchOne('SELECT value FROM s_core_config_values WHERE element_id = ?', [$elementId]); |
516 | 516 | $logLevelConfigSetting = unserialize($logLevelConfigSetting); |
517 | - $logLevelSetting = (is_numeric($logLevelConfigSetting) && $logLevelConfigSetting >=0 && $logLevelConfigSetting <=4) ? (int)$logLevelConfigSetting : 1; |
|
517 | + $logLevelSetting = (is_numeric($logLevelConfigSetting) && $logLevelConfigSetting >= 0 && $logLevelConfigSetting <= 4) ? (int) $logLevelConfigSetting : 1; |
|
518 | 518 | |
519 | 519 | if ($logLevelMessage <= $logLevelSetting) { |
520 | 520 | $prefix = "[".date('Y-m-d H:i:s')."] "; |
521 | 521 | $debugBacktrace = ''; |
522 | 522 | if ($logLevelSetting >= 4) { |
523 | - $debugBacktrace = print_r(debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS),true); |
|
523 | + $debugBacktrace = print_r(debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS), true); |
|
524 | 524 | } |
525 | 525 | $sPrintableElementMessage = ''; |
526 | 526 | if ($mPrintableElement !== null) { |
527 | - $sPrintableElementMessage = print_r($mPrintableElement,true); |
|
527 | + $sPrintableElementMessage = print_r($mPrintableElement, true); |
|
528 | 528 | } |
529 | 529 | $fullMessage = $prefix.$message."\n".$sPrintableElementMessage.$debugBacktrace; |
530 | 530 | $shopPath = Shopware()->DocPath(); |
531 | 531 | $logfilePath = $shopPath.'/var/log/klarnaTrace.log'; |
532 | - $fileHandler = fopen($logfilePath,'a'); |
|
532 | + $fileHandler = fopen($logfilePath, 'a'); |
|
533 | 533 | fwrite($fileHandler, $fullMessage); |
534 | 534 | fclose($fileHandler); |
535 | 535 | } |
@@ -555,7 +555,7 @@ discard block |
||
555 | 555 | $country = $repository->findOneBy(array('id' => $baseData['countryId'])); |
556 | 556 | $countryiso = $country->getIso(); |
557 | 557 | |
558 | - $klarnaAddr = new KlarnaAddr(); |
|
558 | + $klarnaAddr = new KlarnaAddr(); |
|
559 | 559 | $klarnaAddr->setEmail($orderDataRaw['customerEmail']); |
560 | 560 | $klarnaAddr->setFirstName($baseData['firstName']); |
561 | 561 | $klarnaAddr->setLastName($baseData['lastName']); |
@@ -570,7 +570,7 @@ discard block |
||
570 | 570 | $klarnaAddr->setCountry($countryiso); |
571 | 571 | } |
572 | 572 | |
573 | - $this->klarnaLog('Update order address from backend with following address data:',3,$klarnaAddr); |
|
573 | + $this->klarnaLog('Update order address from backend with following address data:', 3, $klarnaAddr); |
|
574 | 574 | return $klarnaAddr; |
575 | 575 | } |
576 | 576 | |
@@ -598,10 +598,10 @@ discard block |
||
598 | 598 | if ($index == count($addressParts) || $houseNumberFound) { |
599 | 599 | // at least last element should be streetnr |
600 | 600 | if (!empty($streetnr)) $streetnr .= ' '; |
601 | - $streetnr .= (string)$addressPart; |
|
601 | + $streetnr .= (string) $addressPart; |
|
602 | 602 | } |
603 | - else { |
|
604 | - $street .= (string)' '.$addressPart; |
|
603 | + else { |
|
604 | + $street .= (string) ' '.$addressPart; |
|
605 | 605 | } |
606 | 606 | } |
607 | 607 | |
@@ -1218,11 +1218,11 @@ discard block |
||
1218 | 1218 | public function registerMyTemplateDir($isBackend = false) |
1219 | 1219 | { |
1220 | 1220 | if ($isBackend) { |
1221 | - $this->get('template')->addTemplateDir(__DIR__ . '/Views/', 'klarna'); |
|
1221 | + $this->get('template')->addTemplateDir(__DIR__.'/Views/', 'klarna'); |
|
1222 | 1222 | } elseif ($this->isTemplateResponsive()) { |
1223 | - $this->get('template')->addTemplateDir(__DIR__ . '/Views/responsive', 'klarna'); |
|
1223 | + $this->get('template')->addTemplateDir(__DIR__.'/Views/responsive', 'klarna'); |
|
1224 | 1224 | } else { |
1225 | - $this->get('template')->addTemplateDir(__DIR__ . '/Views/_emotion', 'klarna'); |
|
1225 | + $this->get('template')->addTemplateDir(__DIR__.'/Views/_emotion', 'klarna'); |
|
1226 | 1226 | } |
1227 | 1227 | } |
1228 | 1228 | |
@@ -1250,7 +1250,7 @@ discard block |
||
1250 | 1250 | { |
1251 | 1251 | $this->registerMyTemplateDir(); |
1252 | 1252 | |
1253 | - return __DIR__ . '/Controllers/Frontend/PaymentKlarna.php'; |
|
1253 | + return __DIR__.'/Controllers/Frontend/PaymentKlarna.php'; |
|
1254 | 1254 | } |
1255 | 1255 | |
1256 | 1256 | /** |
@@ -1262,10 +1262,10 @@ discard block |
||
1262 | 1262 | { |
1263 | 1263 | $this->registerMyTemplateDir(true); |
1264 | 1264 | $this->Application()->Snippets()->addConfigDir( |
1265 | - __DIR__ . '/Snippets/' |
|
1265 | + __DIR__.'/Snippets/' |
|
1266 | 1266 | ); |
1267 | 1267 | |
1268 | - return __DIR__ . '/Controllers/Backend/PaymentKlarna.php'; |
|
1268 | + return __DIR__.'/Controllers/Backend/PaymentKlarna.php'; |
|
1269 | 1269 | } |
1270 | 1270 | |
1271 | 1271 | /** |
@@ -1289,7 +1289,7 @@ discard block |
||
1289 | 1289 | |
1290 | 1290 | // just return in case kco payment is deactivated in backend |
1291 | 1291 | |
1292 | - if (!$this->isKcoPaymentActive()){ |
|
1292 | + if (!$this->isKcoPaymentActive()) { |
|
1293 | 1293 | return; |
1294 | 1294 | } |
1295 | 1295 | $user = $view->getAssign('sUserData'); |
@@ -1300,7 +1300,7 @@ discard block |
||
1300 | 1300 | && ($request->getActionName() == 'cart' || $request->getActionName() == 'ajaxCart') |
1301 | 1301 | ) { |
1302 | 1302 | $this->registerMyTemplateDir(); |
1303 | - $view->assign('KlarnaEnableButton', (bool)$config->get('showKlarnaButton')); |
|
1303 | + $view->assign('KlarnaEnableButton', (bool) $config->get('showKlarnaButton')); |
|
1304 | 1304 | $view->assign('KlarnaShowCheckoutButton', $this->getShowCheckoutButton($user)); |
1305 | 1305 | $view->assign('klarnaKcoPaymentActive', $this->isKlarnaKcoPaymentActive($user)); |
1306 | 1306 | $view->assign('KlarnaPaymentDescription', $this->getPayment()->getDescription()); |
@@ -1329,7 +1329,7 @@ discard block |
||
1329 | 1329 | $view->assign('KlarnaMerchantId', $config->get('merchantId')); |
1330 | 1330 | $view->assign('KlarnaHideCheckoutSteps', true); |
1331 | 1331 | |
1332 | - if (version_compare(Shopware::VERSION, '5.2.0', '<')){ |
|
1332 | + if (version_compare(Shopware::VERSION, '5.2.0', '<')) { |
|
1333 | 1333 | $view->assign('KlarnaSkipLoginFix', true); |
1334 | 1334 | } |
1335 | 1335 | if (!$this->isTemplateResponsive()) { |
@@ -1390,7 +1390,7 @@ discard block |
||
1390 | 1390 | public function addJsFiles() |
1391 | 1391 | { |
1392 | 1392 | $jsPath = array( |
1393 | - __DIR__ . '/Views/responsive/frontend/_public/src/js/jquery.klarna_checkout.js' |
|
1393 | + __DIR__.'/Views/responsive/frontend/_public/src/js/jquery.klarna_checkout.js' |
|
1394 | 1394 | ); |
1395 | 1395 | |
1396 | 1396 | return new Doctrine\Common\Collections\ArrayCollection($jsPath); |
@@ -1449,15 +1449,15 @@ discard block |
||
1449 | 1449 | $userData['additional'] |
1450 | 1450 | ); |
1451 | 1451 | |
1452 | - if (isset($session['sChangedCountry'])){ |
|
1452 | + if (isset($session['sChangedCountry'])) { |
|
1453 | 1453 | |
1454 | 1454 | /** @var \Shopware\Components\Model\ModelManager $em */ |
1455 | 1455 | $em = $this->get('models'); |
1456 | 1456 | |
1457 | 1457 | /** @var \Shopware\Models\Customer\Customer $customer */ |
1458 | 1458 | $country = $em->getRepository('Shopware\Models\Country\Country')->findOneBy(array('id' => $session['sChangedCountry'])); |
1459 | - $userData['shippingaddress']['country'] =$country; |
|
1460 | - $userData['billingaddress']['country'] =$country; |
|
1459 | + $userData['shippingaddress']['country'] = $country; |
|
1460 | + $userData['billingaddress']['country'] = $country; |
|
1461 | 1461 | $userData['shippingaddress']['countryID'] = $session['sChangedCountry']; |
1462 | 1462 | $userData['billingaddress']['countryID'] = $session['sChangedCountry']; |
1463 | 1463 | } |
@@ -1477,10 +1477,10 @@ discard block |
||
1477 | 1477 | $this->klarnaLog("Entering Bootstrap::getCountryByShop", 3); |
1478 | 1478 | $locale = explode('_', $locale); |
1479 | 1479 | $locale = isset($locale[1]) ? $locale[1] : $locale[0]; |
1480 | - $this->klarnaLog("Bootstrap::getCountryByShop locale to request for:".$locale,3); |
|
1480 | + $this->klarnaLog("Bootstrap::getCountryByShop locale to request for:".$locale, 3); |
|
1481 | 1481 | $sql = 'SELECT id FROM s_core_countries WHERE countryiso=?'; |
1482 | 1482 | $countryId = Shopware()->Db()->fetchOne($sql, array($locale)); |
1483 | - $countryId = ($countryId) ? (int)$countryId : null; |
|
1483 | + $countryId = ($countryId) ? (int) $countryId : null; |
|
1484 | 1484 | |
1485 | 1485 | return $countryId; |
1486 | 1486 | } |
@@ -1511,7 +1511,7 @@ discard block |
||
1511 | 1511 | $locale = $locale == 'nn-no' ? 'nb-no' : $locale; |
1512 | 1512 | |
1513 | 1513 | if ($locale == 'de-de') { |
1514 | - if($countryIso == 'CH') { |
|
1514 | + if ($countryIso == 'CH') { |
|
1515 | 1515 | $locale = 'de-ch'; |
1516 | 1516 | } elseif ($countryIso == 'AT') { |
1517 | 1517 | $locale = 'de-at'; |
@@ -1526,10 +1526,10 @@ discard block |
||
1526 | 1526 | $config = $this->Config(); |
1527 | 1527 | $options = $this->getColorConfigOptions($config); |
1528 | 1528 | |
1529 | - $options['allow_separate_shipping_address'] = (bool)$config->get('allowSeparateShippingAddress'); |
|
1530 | - $options['packstation_enabled'] = (bool)$config->get('supportPackstation') && $allowPackstation; |
|
1531 | - $options['phone_mandatory'] = (bool)$config->get('mandatoryPhone'); |
|
1532 | - $options['date_of_birth_mandatory'] = (bool)$config->get('mandatoryBirthday'); |
|
1529 | + $options['allow_separate_shipping_address'] = (bool) $config->get('allowSeparateShippingAddress'); |
|
1530 | + $options['packstation_enabled'] = (bool) $config->get('supportPackstation') && $allowPackstation; |
|
1531 | + $options['phone_mandatory'] = (bool) $config->get('mandatoryPhone'); |
|
1532 | + $options['date_of_birth_mandatory'] = (bool) $config->get('mandatoryBirthday'); |
|
1533 | 1533 | |
1534 | 1534 | if (!empty($dispatch)) { |
1535 | 1535 | $options['shipping_details'] = $dispatch['description']; |
@@ -1544,19 +1544,19 @@ discard block |
||
1544 | 1544 | foreach ($basket['content'] as $index=>$basketItem) { |
1545 | 1545 | // compatibility to shopware plugin custom products |
1546 | 1546 | if (isset($basketItem['custom_product_prices'])) { |
1547 | - $basketItemPrice = (double)$basketItem['custom_product_prices']['total']; |
|
1547 | + $basketItemPrice = (double) $basketItem['custom_product_prices']['total']; |
|
1548 | 1548 | } |
1549 | 1549 | else { |
1550 | - $basketItemPrice = (double)str_replace(',', '.', $basketItem['price']); |
|
1550 | + $basketItemPrice = (double) str_replace(',', '.', $basketItem['price']); |
|
1551 | 1551 | } |
1552 | 1552 | $unitPrice = round($basketItemPrice * 100); |
1553 | 1553 | $cart[] = array( |
1554 | 1554 | 'type' => $unitPrice >= 0 ? 'physical' : 'discount', |
1555 | 1555 | 'reference' => $basketItem['ordernumber'], |
1556 | 1556 | 'name' => $basketItem['articlename'], |
1557 | - 'quantity' => (int)$basketItem['quantity'], |
|
1558 | - 'unit_price' => (int)$unitPrice, |
|
1559 | - 'tax_rate' => (int)round($basketItem['tax_rate'] * 100) |
|
1557 | + 'quantity' => (int) $basketItem['quantity'], |
|
1558 | + 'unit_price' => (int) $unitPrice, |
|
1559 | + 'tax_rate' => (int) round($basketItem['tax_rate'] * 100) |
|
1560 | 1560 | ); |
1561 | 1561 | } |
1562 | 1562 | if (!empty($basket['sShippingcosts'])) { |
@@ -1567,8 +1567,8 @@ discard block |
||
1567 | 1567 | 'reference' => 'SHIPPING', |
1568 | 1568 | 'name' => 'Shipping Fee', |
1569 | 1569 | 'quantity' => 1, |
1570 | - 'unit_price' => (int)round($shippingAmount * 100), |
|
1571 | - 'tax_rate' => (int)round($basket['sShippingcostsTax'] * 100), |
|
1570 | + 'unit_price' => (int) round($shippingAmount * 100), |
|
1571 | + 'tax_rate' => (int) round($basket['sShippingcostsTax'] * 100), |
|
1572 | 1572 | ); |
1573 | 1573 | } |
1574 | 1574 | |
@@ -1599,7 +1599,7 @@ discard block |
||
1599 | 1599 | 'action' => 'return', |
1600 | 1600 | 'forceSecure' => true |
1601 | 1601 | ) |
1602 | - ) . "?transactionId={checkout.order.uri}"; |
|
1602 | + )."?transactionId={checkout.order.uri}"; |
|
1603 | 1603 | $merchant['push_uri'] = $router->assemble( |
1604 | 1604 | array( |
1605 | 1605 | 'controller' => 'payment_klarna', |
@@ -1607,7 +1607,7 @@ discard block |
||
1607 | 1607 | 'forceSecure' => true, |
1608 | 1608 | 'appendSession' => true |
1609 | 1609 | ) |
1610 | - ) . "&transactionId={checkout.order.uri}"; |
|
1610 | + )."&transactionId={checkout.order.uri}"; |
|
1611 | 1611 | $merchant['back_to_store_uri'] = $router->assemble( |
1612 | 1612 | array( |
1613 | 1613 | 'controller' => 'index', |
@@ -1620,41 +1620,41 @@ discard block |
||
1620 | 1620 | |
1621 | 1621 | public function getCheckoutAddress($user, $type = 'billing') |
1622 | 1622 | { |
1623 | - if (empty($user[$type . 'address']['zipcode']) || $user[$type . 'address']['zipcode'] == '00000') { |
|
1623 | + if (empty($user[$type.'address']['zipcode']) || $user[$type.'address']['zipcode'] == '00000') { |
|
1624 | 1624 | return array(); |
1625 | 1625 | } |
1626 | 1626 | |
1627 | 1627 | $address = array( |
1628 | - 'given_name' => $user[$type . 'address']['firstname'], |
|
1629 | - 'family_name' => $user[$type . 'address']['lastname'], |
|
1630 | - 'postal_code' => $user[$type . 'address']['zipcode'], |
|
1631 | - 'city' => $user[$type . 'address']['city'], |
|
1628 | + 'given_name' => $user[$type.'address']['firstname'], |
|
1629 | + 'family_name' => $user[$type.'address']['lastname'], |
|
1630 | + 'postal_code' => $user[$type.'address']['zipcode'], |
|
1631 | + 'city' => $user[$type.'address']['city'], |
|
1632 | 1632 | 'country' => $user['additional'][$type == 'billing' ? 'country' : 'countryShipping']['countryiso'], |
1633 | 1633 | 'email' => $user['additional']['user']['email'], |
1634 | 1634 | 'phone' => $user['billingaddress']['phone'], |
1635 | 1635 | ); |
1636 | 1636 | $address['country'] = strtolower($address['country']); |
1637 | 1637 | if ($address['country'] == 'de' || $address['country'] == 'nl') { |
1638 | - $address['title'] = $user[$type . 'address']['salutation'] == 'ms' ? 'Frau' : 'Herr'; |
|
1638 | + $address['title'] = $user[$type.'address']['salutation'] == 'ms' ? 'Frau' : 'Herr'; |
|
1639 | 1639 | if ($this->assertMinimumVersion('5.0.0')) { |
1640 | 1640 | /** @var StreetSplitService $streetSplitService */ |
1641 | 1641 | $streetSplitService = Shopware()->StreetSplitService(); |
1642 | - $streetAndNumber = $streetSplitService->split($user[$type . 'address']['street']); |
|
1642 | + $streetAndNumber = $streetSplitService->split($user[$type.'address']['street']); |
|
1643 | 1643 | |
1644 | 1644 | $address['street_name'] = $streetAndNumber['streetName']; |
1645 | 1645 | $address['street_number'] = $streetAndNumber['streetNumber']; |
1646 | 1646 | } else { |
1647 | - $address['street_name'] = $user[$type . 'address']['street']; |
|
1648 | - $address['street_number'] = $user[$type . 'address']['streetnumber']; |
|
1647 | + $address['street_name'] = $user[$type.'address']['street']; |
|
1648 | + $address['street_number'] = $user[$type.'address']['streetnumber']; |
|
1649 | 1649 | } |
1650 | 1650 | } else { |
1651 | 1651 | $address['street_address'] = trim( |
1652 | - $user[$type . 'address']['street'] . ' ' . $user[$type . 'address']['streetnumber'] |
|
1652 | + $user[$type.'address']['street'].' '.$user[$type.'address']['streetnumber'] |
|
1653 | 1653 | ); |
1654 | 1654 | } |
1655 | 1655 | |
1656 | 1656 | // Make sure phone number is unset if empty |
1657 | - if ($address['phone'] === null){ |
|
1657 | + if ($address['phone'] === null) { |
|
1658 | 1658 | unset($address['phone']); |
1659 | 1659 | } |
1660 | 1660 | return $address; |
@@ -1691,7 +1691,7 @@ discard block |
||
1691 | 1691 | */ |
1692 | 1692 | public function getVersion() |
1693 | 1693 | { |
1694 | - $info = json_decode(file_get_contents(__DIR__ . DIRECTORY_SEPARATOR . 'plugin.json'), true); |
|
1694 | + $info = json_decode(file_get_contents(__DIR__.DIRECTORY_SEPARATOR.'plugin.json'), true); |
|
1695 | 1695 | |
1696 | 1696 | if ($info) { |
1697 | 1697 | return $info['currentVersion']; |
@@ -1708,7 +1708,7 @@ discard block |
||
1708 | 1708 | return array( |
1709 | 1709 | 'version' => $this->getVersion(), |
1710 | 1710 | 'label' => $this->getLabel(), |
1711 | - 'description' => file_get_contents(__DIR__ . '/info.txt') |
|
1711 | + 'description' => file_get_contents(__DIR__.'/info.txt') |
|
1712 | 1712 | ); |
1713 | 1713 | } |
1714 | 1714 | |
@@ -1719,7 +1719,7 @@ discard block |
||
1719 | 1719 | */ |
1720 | 1720 | public function onInitResourceKlarnaCheckoutConnector() |
1721 | 1721 | { |
1722 | - require_once __DIR__ . '/Components/KlarnaCheckout/Checkout.php'; |
|
1722 | + require_once __DIR__.'/Components/KlarnaCheckout/Checkout.php'; |
|
1723 | 1723 | if ($this->Config()->get('testDrive')) { |
1724 | 1724 | Klarna_Checkout_Order::$baseUri = 'https://checkout.testdrive.klarna.com/checkout/orders'; |
1725 | 1725 | } else { |
@@ -1738,8 +1738,8 @@ discard block |
||
1738 | 1738 | */ |
1739 | 1739 | public function onInitResourceKlarnaService() |
1740 | 1740 | { |
1741 | - require_once __DIR__ . '/Components/Klarna/Klarna.php'; |
|
1742 | - require_once __DIR__ . '/Components/Klarna/transport/xmlrpc-3.0.0.beta/lib/xmlrpc.inc'; |
|
1741 | + require_once __DIR__.'/Components/Klarna/Klarna.php'; |
|
1742 | + require_once __DIR__.'/Components/Klarna/transport/xmlrpc-3.0.0.beta/lib/xmlrpc.inc'; |
|
1743 | 1743 | |
1744 | 1744 | $k = new Klarna(); |
1745 | 1745 | return $k; |
@@ -1757,7 +1757,7 @@ discard block |
||
1757 | 1757 | array(), |
1758 | 1758 | //less files to compile |
1759 | 1759 | array( |
1760 | - __DIR__ . '/Views/responsive/frontend/_public/src/less/all.less' |
|
1760 | + __DIR__.'/Views/responsive/frontend/_public/src/less/all.less' |
|
1761 | 1761 | ), |
1762 | 1762 | //import directory |
1763 | 1763 | __DIR__ |
@@ -1824,7 +1824,7 @@ discard block |
||
1824 | 1824 | |
1825 | 1825 | $salutation = $form['register']['personal']['salutation']; |
1826 | 1826 | if (!empty($salutation) && ($countryIso == 'DE' || $countryIso == 'NL')) { |
1827 | - $create['shipping_address']['title'] = ($salutation == 'ms' ? 'Frau' : 'Herr');//German names |
|
1827 | + $create['shipping_address']['title'] = ($salutation == 'ms' ? 'Frau' : 'Herr'); //German names |
|
1828 | 1828 | } |
1829 | 1829 | |
1830 | 1830 | $billingStreet = $form['register']['billing']['street']; |
@@ -1841,7 +1841,7 @@ discard block |
||
1841 | 1841 | $create['shipping_address']['street_number'] = $billingStreetNumber; |
1842 | 1842 | } |
1843 | 1843 | } else { |
1844 | - $create['shipping_address']['street_address'] = $billingStreet . ' ' . $billingStreetNumber; |
|
1844 | + $create['shipping_address']['street_address'] = $billingStreet.' '.$billingStreetNumber; |
|
1845 | 1845 | } |
1846 | 1846 | } |
1847 | 1847 | |
@@ -1900,9 +1900,9 @@ discard block |
||
1900 | 1900 | $view->assign('sPayments', $this->filterPayments($adminModule->sGetPaymentMeans())); |
1901 | 1901 | $view->assign('sCountryList', $adminModule->sGetCountryList()); |
1902 | 1902 | $view->assign('KlarnaHideCheckoutSteps', true); |
1903 | - $view->assign('KlarnaShowB2bSelect', (bool)$config->get('showB2bSelect')); |
|
1904 | - $view->assign('KlarnaShowBasket', (bool)$config->get('showMiniBasket')); |
|
1905 | - $view->assign('KlarnaShowDispatch', (bool)$config->get('showDispatch')); |
|
1903 | + $view->assign('KlarnaShowB2bSelect', (bool) $config->get('showB2bSelect')); |
|
1904 | + $view->assign('KlarnaShowBasket', (bool) $config->get('showMiniBasket')); |
|
1905 | + $view->assign('KlarnaShowDispatch', (bool) $config->get('showDispatch')); |
|
1906 | 1906 | $view->assign( |
1907 | 1907 | 'KlarnaCDNLink', |
1908 | 1908 | $this->buildCDNLink() |
@@ -1912,7 +1912,7 @@ discard block |
||
1912 | 1912 | $view->sUserData['billingaddress']['lastname'] == 'Klarna Checkout' |
1913 | 1913 | ); |
1914 | 1914 | $debugShowLogin = !empty($session->sUserId); |
1915 | - $debugShowLogin2 = $this->getShowLoginConfig($config,!empty($session->sUserId)); |
|
1915 | + $debugShowLogin2 = $this->getShowLoginConfig($config, !empty($session->sUserId)); |
|
1916 | 1916 | $view->assign( |
1917 | 1917 | 'KlarnaShowLogin', |
1918 | 1918 | $this->getShowLoginConfig($config, !empty($session->sUserId)) |
@@ -1936,7 +1936,7 @@ discard block |
||
1936 | 1936 | */ |
1937 | 1937 | private function getShowLoginConfig($config, $userLoggedIn) |
1938 | 1938 | { |
1939 | - return (bool)$config->get('showLoginPanel') && !($userLoggedIn); |
|
1939 | + return (bool) $config->get('showLoginPanel') && !($userLoggedIn); |
|
1940 | 1940 | } |
1941 | 1941 | |
1942 | 1942 | /**demo |
@@ -1978,7 +1978,7 @@ discard block |
||
1978 | 1978 | $result = Shopware()->Db()->fetchAssoc($sql, array()); |
1979 | 1979 | |
1980 | 1980 | // Load translations if available |
1981 | - $this->countries = array_map(function ($country) { |
|
1981 | + $this->countries = array_map(function($country) { |
|
1982 | 1982 | $country['id'] = $country['countryId']; |
1983 | 1983 | return Shopware()->Modules()->Admin()->sGetCountryTranslation($country); |
1984 | 1984 | }, $result); |
@@ -2099,7 +2099,7 @@ discard block |
||
2099 | 2099 | 'phone' => $billingAddress['phone'] |
2100 | 2100 | ), |
2101 | 2101 | 'billing' => array( |
2102 | - 'street' => $billingAddress['street_name'] . ' ' . $billingAddress['street_number'], |
|
2102 | + 'street' => $billingAddress['street_name'].' '.$billingAddress['street_number'], |
|
2103 | 2103 | 'zipcode' => $billingAddress['postal_code'], |
2104 | 2104 | 'city' => $billingAddress['city'] |
2105 | 2105 | ) |
@@ -2290,13 +2290,13 @@ discard block |
||
2290 | 2290 | /** @var Shopware\Models\Attribute\Payment $payment */ |
2291 | 2291 | foreach ($payments as $payment) { |
2292 | 2292 | $paymentObj = $payment->getPayment(); |
2293 | - if (is_null($paymentObj)){ |
|
2293 | + if (is_null($paymentObj)) { |
|
2294 | 2294 | $paymentName = false; |
2295 | 2295 | } else { |
2296 | 2296 | $paymentName = $paymentObj->getName(); |
2297 | 2297 | } |
2298 | 2298 | |
2299 | - if(!$paymentName){ |
|
2299 | + if (!$paymentName) { |
|
2300 | 2300 | continue; |
2301 | 2301 | } |
2302 | 2302 | |
@@ -2305,7 +2305,7 @@ discard block |
||
2305 | 2305 | } |
2306 | 2306 | $paymentArray = array( |
2307 | 2307 | 'name' => $payment->getPayment()->getDescription(), |
2308 | - 'redirect_uri' => $this->getRedirectUri() . '/paymentId/' . $payment->getPaymentId() |
|
2308 | + 'redirect_uri' => $this->getRedirectUri().'/paymentId/'.$payment->getPaymentId() |
|
2309 | 2309 | ); |
2310 | 2310 | |
2311 | 2311 | if ($fee = $this->getFee($payment->getPayment(), $basket)) { |
@@ -2316,7 +2316,7 @@ discard block |
||
2316 | 2316 | //Shorten the description to max. 500 characters |
2317 | 2317 | $description = strip_tags($description); |
2318 | 2318 | $description = preg_replace('#<!--.*-->#ms', '', $description); |
2319 | - $paymentArray['description'] = substr($description, 0, 497) . '...'; |
|
2319 | + $paymentArray['description'] = substr($description, 0, 497).'...'; |
|
2320 | 2320 | } |
2321 | 2321 | |
2322 | 2322 | //Only add to external checkouts if an image is set and if the shop supports SSL |
@@ -2374,14 +2374,14 @@ discard block |
||
2374 | 2374 | { |
2375 | 2375 | $media = $payment->getSwagKlarnaKlarnaMedia(); |
2376 | 2376 | if (!$payment->getSwagKlarnaShowInKlarnaIframe() || !empty($media)) { |
2377 | - if ($this->assertMinimumVersion('5.1') && version_compare(Shopware::VERSION, '5.2.0', '<=') ) { |
|
2377 | + if ($this->assertMinimumVersion('5.1') && version_compare(Shopware::VERSION, '5.2.0', '<=')) { |
|
2378 | 2378 | $media = $this->get('shopware_media.media_service')->getUrl($media); |
2379 | 2379 | } else { |
2380 | 2380 | /** @var Enlight_Controller_Front $front */ |
2381 | 2381 | $front = $this->get('front'); |
2382 | 2382 | $request = $front->Request(); |
2383 | 2383 | if ($request && $request->getHttpHost()) { |
2384 | - $url = ($request->isSecure() ? 'https' : 'http') . '://' . $request->getHttpHost() . $request->getBasePath() . "/"; |
|
2384 | + $url = ($request->isSecure() ? 'https' : 'http').'://'.$request->getHttpHost().$request->getBasePath()."/"; |
|
2385 | 2385 | } else { |
2386 | 2386 | $url = $front->Router()->assemble(array('controller' => 'index', 'module' => 'frontend')); |
2387 | 2387 | } |
@@ -2389,9 +2389,9 @@ discard block |
||
2389 | 2389 | # make sure me get only the image name, path is set in case of upgarde from SW.5.1 to 5.2 |
2390 | 2390 | $parts = explode('/', $media); |
2391 | 2391 | $end = end($parts); |
2392 | - $media = $url . 'media/image/' . $end; |
|
2392 | + $media = $url.'media/image/'.$end; |
|
2393 | 2393 | } else { |
2394 | - $media = $url . $media; |
|
2394 | + $media = $url.$media; |
|
2395 | 2395 | } |
2396 | 2396 | } |
2397 | 2397 |
@@ -597,10 +597,11 @@ discard block |
||
597 | 597 | $index++; |
598 | 598 | if ($index == count($addressParts) || $houseNumberFound) { |
599 | 599 | // at least last element should be streetnr |
600 | - if (!empty($streetnr)) $streetnr .= ' '; |
|
600 | + if (!empty($streetnr)) { |
|
601 | + $streetnr .= ' '; |
|
602 | + } |
|
601 | 603 | $streetnr .= (string)$addressPart; |
602 | - } |
|
603 | - else { |
|
604 | + } else { |
|
604 | 605 | $street .= (string)' '.$addressPart; |
605 | 606 | } |
606 | 607 | } |
@@ -1545,8 +1546,7 @@ discard block |
||
1545 | 1546 | // compatibility to shopware plugin custom products |
1546 | 1547 | if (isset($basketItem['custom_product_prices'])) { |
1547 | 1548 | $basketItemPrice = (double)$basketItem['custom_product_prices']['total']; |
1548 | - } |
|
1549 | - else { |
|
1549 | + } else { |
|
1550 | 1550 | $basketItemPrice = (double)str_replace(',', '.', $basketItem['price']); |
1551 | 1551 | } |
1552 | 1552 | $unitPrice = round($basketItemPrice * 100); |
@@ -290,7 +290,7 @@ discard block |
||
290 | 290 | |
291 | 291 | // Klarna Prefill checkBox |
292 | 292 | if ($this->isUserLoggedIn()) { |
293 | - $this->View()->assign('KlarnaPreFillSelect', !$this->session['klarnaPreFill']); |
|
293 | + $this->View()->assign('KlarnaPreFillSelect', !$this->session['klarnaPreFill']); |
|
294 | 294 | } |
295 | 295 | |
296 | 296 | // Iframe Backend Config |
@@ -436,7 +436,7 @@ discard block |
||
436 | 436 | if ($this->Request()->getParam('sArticle') && $this->Request()->getParam('sQuantity')) { |
437 | 437 | $this->View()->sBasketInfo = $basketObj->sUpdateArticle($this->Request()->getParam('sArticle'), $this->Request()->getParam('sQuantity')); |
438 | 438 | } |
439 | - $this->redirect(['action' => $this->Request()->getParam('sTargetAction', 'showIframe')]); |
|
439 | + $this->redirect(['action' => $this->Request()->getParam('sTargetAction', 'showIframe')]); |
|
440 | 440 | } |
441 | 441 | |
442 | 442 | /** |
@@ -610,7 +610,7 @@ discard block |
||
610 | 610 | return array("id" => $this->session['sState']); |
611 | 611 | } |
612 | 612 | |
613 | - /** |
|
613 | + /** |
|
614 | 614 | * @param Klarna_Checkout_Order $order |
615 | 615 | */ |
616 | 616 | public function createAccount($order = null, $checkLoginState=true) |
@@ -739,8 +739,8 @@ discard block |
||
739 | 739 | } |
740 | 740 | $module->sSYSTEM->_POST = $data['billing']; |
741 | 741 | if (Shopware::VERSION === '___VERSION___' || version_compare(Shopware::VERSION, '5.2.0', '>=')) { |
742 | - $userId = $session->offsetGet('sUserId'); |
|
743 | - $this->updateBilling($userId, $data['billing']); |
|
742 | + $userId = $session->offsetGet('sUserId'); |
|
743 | + $this->updateBilling($userId, $data['billing']); |
|
744 | 744 | } else{ |
745 | 745 | $module->sUpdateBilling(); |
746 | 746 | } |
@@ -851,13 +851,13 @@ discard block |
||
851 | 851 | |
852 | 852 | // get updated password; it is md5 randomized after register |
853 | 853 | $getUser = Shopware()->Models()->getRepository('Shopware\Models\Customer\Customer')->findOneBy( |
854 | - array('email' => $data['auth']['email']) |
|
855 | - ); |
|
854 | + array('email' => $data['auth']['email']) |
|
855 | + ); |
|
856 | 856 | |
857 | - $data['auth']['password']= $getUser->getPassword(); |
|
858 | - $data['auth']['passwordMD5']= $getUser->getPassword(); |
|
859 | - $data['auth']['encoderName'] = 'md5'; |
|
860 | - return $data; |
|
857 | + $data['auth']['password']= $getUser->getPassword(); |
|
858 | + $data['auth']['passwordMD5']= $getUser->getPassword(); |
|
859 | + $data['auth']['encoderName'] = 'md5'; |
|
860 | + return $data; |
|
861 | 861 | } |
862 | 862 | |
863 | 863 | |
@@ -875,19 +875,19 @@ discard block |
||
875 | 875 | unset ($data['billing']); |
876 | 876 | |
877 | 877 | $customer = Shopware()->Models()->getRepository('Shopware\Models\Customer\Customer')->findOneBy( |
878 | - array('id' => $userId) |
|
879 | - ); |
|
878 | + array('id' => $userId) |
|
879 | + ); |
|
880 | 880 | $customer->fromArray($data); |
881 | 881 | Shopware()->Container()->get('shopware_account.customer_service')->update($customer); |
882 | 882 | } |
883 | 883 | |
884 | 884 | |
885 | - /** |
|
886 | - * Updates the shipping address |
|
887 | - * |
|
888 | - * @param int $userId |
|
889 | - * @param array $shippingData |
|
890 | - */ |
|
885 | + /** |
|
886 | + * Updates the shipping address |
|
887 | + * |
|
888 | + * @param int $userId |
|
889 | + * @param array $shippingData |
|
890 | + */ |
|
891 | 891 | private function updateShipping($userId, $shippingData) |
892 | 892 | { |
893 | 893 | /** @var \Shopware\Components\Model\ModelManager $em */ |
@@ -900,7 +900,7 @@ discard block |
||
900 | 900 | $addressold = $customer->getDefaultShippingAddress(); |
901 | 901 | $address = new \Shopware\Models\Customer\Address(); |
902 | 902 | |
903 | - /** @var \Shopware\Models\Country\Country $country */ |
|
903 | + /** @var \Shopware\Models\Country\Country $country */ |
|
904 | 904 | $country = $addressold->getCountry(); |
905 | 905 | $shippingData['country'] = $country; |
906 | 906 | if ($shippingData['phone'] === null) { |
@@ -934,7 +934,7 @@ discard block |
||
934 | 934 | /** @var \Shopware\Models\Customer\Address $address */ |
935 | 935 | $address = $customer->getDefaultBillingAddress(); |
936 | 936 | |
937 | - /** @var \Shopware\Models\Country\Country $country */ |
|
937 | + /** @var \Shopware\Models\Country\Country $country */ |
|
938 | 938 | $country = $address->getCountry(); |
939 | 939 | $billingData['country'] = $country; |
940 | 940 | $address->fromArray($billingData); |
@@ -948,7 +948,7 @@ discard block |
||
948 | 948 | */ |
949 | 949 | public function loginAction() |
950 | 950 | { |
951 | - // Shopware()->Session()->offsetSet('KlarnaOrder', null); |
|
951 | + // Shopware()->Session()->offsetSet('KlarnaOrder', null); |
|
952 | 952 | $this->redirect(array('controller' => 'payment_klarna', 'action' => 'showIframe')); |
953 | 953 | } |
954 | 954 | |
@@ -997,14 +997,14 @@ discard block |
||
997 | 997 | |
998 | 998 | if ($order['status'] == 'checkout_complete') { |
999 | 999 | $this->plugin->klarnaLog("Entering Shopware_Controllers_Frontend_PaymentKlarna::returnAction: checkout_complete. Save oder if session values match.",3); |
1000 | - if (Shopware()->Session()->offsetGet('KlarnaTransactionId') == null){ |
|
1000 | + if (Shopware()->Session()->offsetGet('KlarnaTransactionId') == null){ |
|
1001 | 1001 | $this->plugin->klarnaLog("Entering Shopware_Controllers_Frontend_PaymentKlarna::returnAction: Session matches. Order will be saved",3); |
1002 | 1002 | Shopware()->Session()->offsetSet('KlarnaTransactionId', $transactionId ); |
1003 | 1003 | $orderNumber = $this->saveOrder( |
1004 | 1004 | $order['reservation'], |
1005 | 1005 | $order['reference'] |
1006 | 1006 | ); |
1007 | - Shopware()->Session()->offsetSet('KlarnaTransactionId', null ); |
|
1007 | + Shopware()->Session()->offsetSet('KlarnaTransactionId', null ); |
|
1008 | 1008 | } |
1009 | 1009 | } |
1010 | 1010 | |
@@ -1437,7 +1437,7 @@ discard block |
||
1437 | 1437 | |
1438 | 1438 | protected function isUserLoggedIn() |
1439 | 1439 | { |
1440 | - return (isset($this->session->sUserId) && !empty($this->session->sUserId)); |
|
1440 | + return (isset($this->session->sUserId) && !empty($this->session->sUserId)); |
|
1441 | 1441 | } |
1442 | 1442 | |
1443 | 1443 | /** |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | public function expressAction() |
102 | 102 | { |
103 | 103 | $this->plugin = $this->get('plugins')->Frontend()->SwagPaymentKlarna(); |
104 | - if (!empty($this->session->PaypalResponse)){ |
|
104 | + if (!empty($this->session->PaypalResponse)) { |
|
105 | 105 | $this->plugin->klarnaLog("Paypal Payment in Progress detected Redirecting To Index Page", 3); |
106 | 106 | $this->redirect( |
107 | 107 | array( |
@@ -113,13 +113,13 @@ discard block |
||
113 | 113 | } |
114 | 114 | |
115 | 115 | if ($this->Request()->getPost('sCountry')) { |
116 | - $this->session['sCountry'] = (int)$this->Request()->getPost('sCountry'); |
|
116 | + $this->session['sCountry'] = (int) $this->Request()->getPost('sCountry'); |
|
117 | 117 | $this->session["sState"] = 0; |
118 | 118 | $this->session["sArea"] = Shopware()->Db()->fetchOne(" |
119 | 119 | SELECT areaID FROM s_core_countries WHERE id = ? |
120 | 120 | ", array($this->session['sCountry'])); |
121 | 121 | unset($this->session->KlarnaOrder); |
122 | - $this->session['sChangedCountry'] = (int)$this->Request()->getPost('sCountry'); |
|
122 | + $this->session['sChangedCountry'] = (int) $this->Request()->getPost('sCountry'); |
|
123 | 123 | } |
124 | 124 | $this->forward('index'); |
125 | 125 | } |
@@ -135,7 +135,7 @@ discard block |
||
135 | 135 | $this->basket = $this->get('modules')->Basket()->sGetBasket(); |
136 | 136 | |
137 | 137 | $preFill = $this->config['preFillCheckout']; |
138 | - if ($this->isUserLoggedIn()){ |
|
138 | + if ($this->isUserLoggedIn()) { |
|
139 | 139 | $user = Shopware()->Modules()->Admin()->sGetUserData(); |
140 | 140 | } |
141 | 141 | |
@@ -151,7 +151,7 @@ discard block |
||
151 | 151 | |
152 | 152 | // set klarnaPrefill, in case User ovverides Setting with checkbox |
153 | 153 | |
154 | - if ($this->Request()->getParam('klarnaPreFill') == "on"){ |
|
154 | + if ($this->Request()->getParam('klarnaPreFill') == "on") { |
|
155 | 155 | $this->session['klarnaUserPreFill'] = true; |
156 | 156 | } |
157 | 157 | |
@@ -164,7 +164,7 @@ discard block |
||
164 | 164 | $this->redirect(array('controller' => 'payment_klarna', 'action' => 'otherPayment')); |
165 | 165 | return; |
166 | 166 | } |
167 | - $shopCountryId = (string)$shopCountryId; |
|
167 | + $shopCountryId = (string) $shopCountryId; |
|
168 | 168 | if ($shopCountryId != $postedCountry) { |
169 | 169 | $this->session['sCountry'] = $postedCountry; |
170 | 170 | // unset klarnaOrder so it will be created with new countryID |
@@ -177,22 +177,22 @@ discard block |
||
177 | 177 | } |
178 | 178 | // set shipping costs (Overwrites $session->sCountry!) |
179 | 179 | $debugShipping = $this->getShippingCosts(); |
180 | - if ($postedCountry){ |
|
180 | + if ($postedCountry) { |
|
181 | 181 | $this->session['sCountry'] = $postedCountry; |
182 | 182 | } else { |
183 | 183 | // set Default Country |
184 | 184 | $this->session['sCountry'] = $this->getCountryByShop(Shopware()->Shop()); |
185 | 185 | } |
186 | 186 | |
187 | - $this->basket['sShippingcosts'] = $debugShipping['brutto'];; |
|
187 | + $this->basket['sShippingcosts'] = $debugShipping['brutto']; ; |
|
188 | 188 | $this->basket['sShippingcostsWithTax'] = $debugShipping['brutto']; |
189 | 189 | $this->basket['sShippingcostsNet'] = $debugShipping['netto']; |
190 | 190 | $this->basket['sShippingcostsTax'] = $debugShipping['tax']; |
191 | 191 | |
192 | 192 | // set missing basket vars for use in view |
193 | 193 | // $this->basket['sAmount'] = $this->basket['Amount'] + $debugShipping['brutto']; |
194 | - $this->basket['AmountWithTaxNumeric'] = floatval(str_replace(',','.',$this->basket['Amount'])) + floatval(str_replace(',','.',$debugShipping['brutto'])); |
|
195 | - $this->basket['AmountNetNumeric'] = floatval(str_replace(',','.',$this->basket['AmountNet'])); |
|
194 | + $this->basket['AmountWithTaxNumeric'] = floatval(str_replace(',', '.', $this->basket['Amount'])) + floatval(str_replace(',', '.', $debugShipping['brutto'])); |
|
195 | + $this->basket['AmountNetNumeric'] = floatval(str_replace(',', '.', $this->basket['AmountNet'])); |
|
196 | 196 | |
197 | 197 | $klarnaConnector = $this->plugin->getConnector(); |
198 | 198 | $shop = $this->plugin->Application()->Shop(); |
@@ -239,7 +239,7 @@ discard block |
||
239 | 239 | } |
240 | 240 | |
241 | 241 | // In case Customer fills Iframe and then logs in do not update existing klarnaOrder |
242 | - if (!empty($this->session['KlarnaOrder']) && !$this->isUserLoggedIn()){ |
|
242 | + if (!empty($this->session['KlarnaOrder']) && !$this->isUserLoggedIn()) { |
|
243 | 243 | $klarnaOrder = new Klarna_Checkout_Order($klarnaConnector, $this->session['KlarnaOrder']); |
244 | 244 | $update = array(); |
245 | 245 | $update['cart']['items'] = $this->plugin->getCheckoutCart($this->basket); |
@@ -261,14 +261,14 @@ discard block |
||
261 | 261 | } catch (Exception $e) { |
262 | 262 | Shopware()->Plugins()->Controller()->ViewRenderer()->setNoRender(); |
263 | 263 | echo "Entschuldigung, Ein Verbindungsfehler ist aufgetreten, bitte aktualisieren Sie die Seite"; |
264 | - $this->plugin->klarnaLog("Verbindungsfehler in onPreDispatchCheckout\nCode:".$e->getCode()."Nachricht:\n".$e->getMessage(),1); |
|
264 | + $this->plugin->klarnaLog("Verbindungsfehler in onPreDispatchCheckout\nCode:".$e->getCode()."Nachricht:\n".$e->getMessage(), 1); |
|
265 | 265 | } |
266 | 266 | |
267 | 267 | $this->session->KlarnaOrder = $klarnaOrder->getLocation(); |
268 | 268 | |
269 | 269 | // Delete old perhaps cancelled Klarna Order |
270 | 270 | |
271 | - if ($klarnaOrder['status'] !== "checkout_incomplete"){ |
|
271 | + if ($klarnaOrder['status'] !== "checkout_incomplete") { |
|
272 | 272 | unset($this->session->KlarnaOrder); |
273 | 273 | } |
274 | 274 | |
@@ -301,7 +301,7 @@ discard block |
||
301 | 301 | //$debugDispatches = $this->getDispatches($paymentIdDebug); |
302 | 302 | $countryDebug = $this->session['sCountry']; |
303 | 303 | $this->View()->sDispatches = $this->getDispatches($paymentIdDebug); |
304 | - if ($postedCountry){ |
|
304 | + if ($postedCountry) { |
|
305 | 305 | $this->session['sCountry'] = $postedCountry; |
306 | 306 | } |
307 | 307 | |
@@ -312,28 +312,28 @@ discard block |
||
312 | 312 | // Neccessary if user is not logged in |
313 | 313 | $this->View()->sPayment = $testPayment; |
314 | 314 | |
315 | - $this->basket['sShippingcosts'] = $debugShipping['brutto'];; |
|
315 | + $this->basket['sShippingcosts'] = $debugShipping['brutto']; ; |
|
316 | 316 | $this->basket['sShippingcostsWithTax'] = $debugShipping['brutto']; |
317 | 317 | $this->basket['sShippingcostsNet'] = $debugShipping['netto']; |
318 | 318 | $this->basket['sShippingcostsTax'] = $debugShipping['tax']; |
319 | 319 | |
320 | - $this->basket['sAmount'] = floatval ($this->basket['Amount']) + floatval($this->basket['sShippingcosts']); |
|
320 | + $this->basket['sAmount'] = floatval($this->basket['Amount']) + floatval($this->basket['sShippingcosts']); |
|
321 | 321 | //$this->basket['AmountWithTaxNumeric'] = (int) $this->basket['Amount'] + $debugShipping['brutto']; |
322 | 322 | //$this->basket['AmountNumeric'] = floatval($this->basket['Amount']) + floatval($debugShipping['brutto']; |
323 | 323 | //$this->basket['AmountNetNumeric'] = (int) $this->basket['AmountNet'] + $debugShipping['netto']; |
324 | - $netto1 = $this->basket['AmountNet']; |
|
325 | - $netto2 = $debugShipping['netto']; |
|
326 | - $netto3 = (float)$this->basket['AmountNet']; |
|
327 | - $netto4 = (float)$debugShipping['netto']; |
|
328 | - $netto5 = (float)$this->basket['AmountNet'] + (float)$debugShipping['netto']; |
|
324 | + $netto1 = $this->basket['AmountNet']; |
|
325 | + $netto2 = $debugShipping['netto']; |
|
326 | + $netto3 = (float) $this->basket['AmountNet']; |
|
327 | + $netto4 = (float) $debugShipping['netto']; |
|
328 | + $netto5 = (float) $this->basket['AmountNet'] + (float) $debugShipping['netto']; |
|
329 | 329 | $this->basket['sAmountNet'] = floatval($this->basket['AmountNetNumeric']) + floatval($debugShipping['netto']); |
330 | 330 | |
331 | 331 | $this->basket['sAmountTax'] = 1.9; |
332 | 332 | $this->View()->sShippingcosts = $debugShipping['brutto']; |
333 | - $this->View()->sShippingcostsWithTax = $debugShipping['brutto']; |
|
333 | + $this->View()->sShippingcostsWithTax = $debugShipping['brutto']; |
|
334 | 334 | $this->View()->sShippingcostsNet = $debugShipping['netto']; |
335 | 335 | $this->View()->sShippingcostsTax = $debugShipping['tax']; |
336 | - $this->View()->sAmount = $this->basket['AmountWithTaxNumeric'] ; |
|
336 | + $this->View()->sAmount = $this->basket['AmountWithTaxNumeric']; |
|
337 | 337 | |
338 | 338 | |
339 | 339 | |
@@ -359,10 +359,10 @@ discard block |
||
359 | 359 | $this->plugin->klarnaLog("Entering Bootstrap::getCountryByShop", 3); |
360 | 360 | $locale = explode('_', $locale); |
361 | 361 | $locale = isset($locale[1]) ? $locale[1] : $locale[0]; |
362 | - $this->plugin->klarnaLog("Bootstrap::getCountryByShop locale to request for:".$locale,3); |
|
362 | + $this->plugin->klarnaLog("Bootstrap::getCountryByShop locale to request for:".$locale, 3); |
|
363 | 363 | $sql = 'SELECT id FROM s_core_countries WHERE countryiso=?'; |
364 | 364 | $countryId = Shopware()->Db()->fetchOne($sql, array($locale)); |
365 | - $countryId = ($countryId) ? (int)$countryId : null; |
|
365 | + $countryId = ($countryId) ? (int) $countryId : null; |
|
366 | 366 | |
367 | 367 | return $countryId; |
368 | 368 | } |
@@ -613,7 +613,7 @@ discard block |
||
613 | 613 | /** |
614 | 614 | * @param Klarna_Checkout_Order $order |
615 | 615 | */ |
616 | - public function createAccount($order = null, $checkLoginState=true) |
|
616 | + public function createAccount($order = null, $checkLoginState = true) |
|
617 | 617 | { |
618 | 618 | $this->plugin = $this->get('plugins')->Frontend()->SwagPaymentKlarna(); |
619 | 619 | $this->plugin->klarnaLog('Entering Shopware_Controllers_Frontend_PaymentKlarna::createAccount', 3); |
@@ -634,7 +634,7 @@ discard block |
||
634 | 634 | $sessionId = Shopware()->SessionID(); |
635 | 635 | // email is only varchar(70) so we cut the sessionid |
636 | 636 | //$sessionId = substr($sessionId, 0,49); |
637 | - $data['auth']['email'] = substr($sessionId, 0,49) . '@klarna.com'; |
|
637 | + $data['auth']['email'] = substr($sessionId, 0, 49).'@klarna.com'; |
|
638 | 638 | $data['auth']['password'] = $sessionId; |
639 | 639 | } |
640 | 640 | $data['auth']['accountmode'] = '1'; |
@@ -649,11 +649,11 @@ discard block |
||
649 | 649 | ); |
650 | 650 | } |
651 | 651 | |
652 | - $this->plugin->klarnaLog("Shopware_Controllers_Frontend_PaymentKlarna::createAccount->order:",4, $order); |
|
652 | + $this->plugin->klarnaLog("Shopware_Controllers_Frontend_PaymentKlarna::createAccount->order:", 4, $order); |
|
653 | 653 | |
654 | 654 | foreach (array('billing', 'shipping') as $type) { |
655 | - if (isset($order[$type . '_address'])) { |
|
656 | - $orderAddress = $order[$type . '_address']; |
|
655 | + if (isset($order[$type.'_address'])) { |
|
656 | + $orderAddress = $order[$type.'_address']; |
|
657 | 657 | if (isset($orderAddress['title'])) { |
658 | 658 | $data[$type]['salutation'] = $orderAddress['title'] == 'Frau' ? 'ms' : 'mr'; |
659 | 659 | } else { |
@@ -663,7 +663,7 @@ discard block |
||
663 | 663 | $data[$type]['lastname'] = $orderAddress['family_name']; |
664 | 664 | if (isset($orderAddress['street_name']) && $orderAddress['street_number']) { |
665 | 665 | if (version_compare(Shopware::VERSION, '5.0.0', '>=')) { |
666 | - $data[$type]['street'] = $orderAddress['street_name'] . ' ' . $orderAddress['street_number']; |
|
666 | + $data[$type]['street'] = $orderAddress['street_name'].' '.$orderAddress['street_number']; |
|
667 | 667 | } else { |
668 | 668 | $data[$type]['street'] = $orderAddress['street_name']; |
669 | 669 | $data[$type]['streetnumber'] = $orderAddress['street_number']; |
@@ -689,21 +689,21 @@ discard block |
||
689 | 689 | } |
690 | 690 | $data[$type]['department'] = ''; |
691 | 691 | |
692 | - if (!empty($order[$type . '_address']['country'])) { |
|
692 | + if (!empty($order[$type.'_address']['country'])) { |
|
693 | 693 | $sql = 'SELECT id FROM s_core_countries WHERE countryiso=?'; |
694 | - $countryId = Shopware()->Db()->fetchOne($sql, array($order[$type . '_address']['country'])); |
|
694 | + $countryId = Shopware()->Db()->fetchOne($sql, array($order[$type.'_address']['country'])); |
|
695 | 695 | } else { |
696 | 696 | $countryId = $session['sCountry']; |
697 | 697 | } |
698 | 698 | // make sure country is set in case of lost sessions defualt to germany |
699 | - if (empty($countryId)){ |
|
699 | + if (empty($countryId)) { |
|
700 | 700 | $countryId = 2; |
701 | 701 | } |
702 | 702 | |
703 | 703 | $data[$type]['country'] = $countryId; |
704 | 704 | } |
705 | 705 | |
706 | - $this->plugin->klarnaLog("Shopware_Controllers_Frontend_PaymentKlarna::createAccount->data AFTER ADDRESSES:",4,$data); |
|
706 | + $this->plugin->klarnaLog("Shopware_Controllers_Frontend_PaymentKlarna::createAccount->data AFTER ADDRESSES:", 4, $data); |
|
707 | 707 | $sql = 'SELECT id FROM s_core_paymentmeans WHERE name=?'; |
708 | 708 | $paymentId = Shopware()->Db()->fetchOne($sql, array('klarna_checkout')); |
709 | 709 | |
@@ -722,7 +722,7 @@ discard block |
||
722 | 722 | $session->offsetSet('sUserPassword', $user['password']); |
723 | 723 | $session->offsetSet('sUserId', $user['id']); |
724 | 724 | } else { |
725 | - $this->plugin->klarnaLog("Shopware_Controllers_Frontend_PaymentKlarna::createAccount->user Not Found in DB SQL was:" .$sql,1); |
|
725 | + $this->plugin->klarnaLog("Shopware_Controllers_Frontend_PaymentKlarna::createAccount->user Not Found in DB SQL was:".$sql, 1); |
|
726 | 726 | } |
727 | 727 | } |
728 | 728 | |
@@ -741,7 +741,7 @@ discard block |
||
741 | 741 | if (Shopware::VERSION === '___VERSION___' || version_compare(Shopware::VERSION, '5.2.0', '>=')) { |
742 | 742 | $userId = $session->offsetGet('sUserId'); |
743 | 743 | $this->updateBilling($userId, $data['billing']); |
744 | - } else{ |
|
744 | + } else { |
|
745 | 745 | $module->sUpdateBilling(); |
746 | 746 | } |
747 | 747 | unset($data['auth']['password']); |
@@ -749,10 +749,10 @@ discard block |
||
749 | 749 | if (Shopware::VERSION === '___VERSION___' || version_compare(Shopware::VERSION, '5.2.0', '>=')) { |
750 | 750 | $userId = $session->offsetGet('sUserId'); |
751 | 751 | $this->updateCustomer($data, $userId); |
752 | - $this->plugin->klarnaLog("Shopware_Controllers_Frontend_PaymentKlarna::createAccount->updateCustomer:",3, $data); |
|
753 | - } else{ |
|
752 | + $this->plugin->klarnaLog("Shopware_Controllers_Frontend_PaymentKlarna::createAccount->updateCustomer:", 3, $data); |
|
753 | + } else { |
|
754 | 754 | $module->sUpdateAccount(); |
755 | - $this->plugin->klarnaLog("Shopware_Controllers_Frontend_PaymentKlarna::createAccount->updateAccount:",3, $this->front->Request()->getPost()); |
|
755 | + $this->plugin->klarnaLog("Shopware_Controllers_Frontend_PaymentKlarna::createAccount->updateAccount:", 3, $this->front->Request()->getPost()); |
|
756 | 756 | } |
757 | 757 | } else { |
758 | 758 | /** @var Enlight_Controller_Front $front */ |
@@ -795,22 +795,22 @@ discard block |
||
795 | 795 | $newdata = $this->saveUser($data); |
796 | 796 | $module->sSYSTEM->_POST = $newdata['auth']; |
797 | 797 | $errors = $module->sLogin(true); |
798 | - $this->plugin->klarnaLog("Shopware_Controllers_Frontend_PaymentKlarna::createAccount->saveUser:",3, $newdata); |
|
798 | + $this->plugin->klarnaLog("Shopware_Controllers_Frontend_PaymentKlarna::createAccount->saveUser:", 3, $newdata); |
|
799 | 799 | } else { |
800 | - $this->plugin->klarnaLog("Shopware_Controllers_Frontend_PaymentKlarna::createAccount->saveUser->Register:",3, $session->sRegister); |
|
800 | + $this->plugin->klarnaLog("Shopware_Controllers_Frontend_PaymentKlarna::createAccount->saveUser->Register:", 3, $session->sRegister); |
|
801 | 801 | $module->sSaveRegister(); |
802 | - $this->plugin->klarnaLog("Shopware_Controllers_Frontend_PaymentKlarna::createAccount->saveUser->RegisterFinished:",3, $session->offsetGet('sRegisterFinished')); |
|
802 | + $this->plugin->klarnaLog("Shopware_Controllers_Frontend_PaymentKlarna::createAccount->saveUser->RegisterFinished:", 3, $session->offsetGet('sRegisterFinished')); |
|
803 | 803 | } |
804 | 804 | |
805 | 805 | } catch (\Exception $ex) { /* do nothing */ |
806 | - $this->klarnaLog("ERROR while creating User. Exception information:".$ex->getMessage(),1); |
|
806 | + $this->klarnaLog("ERROR while creating User. Exception information:".$ex->getMessage(), 1); |
|
807 | 807 | |
808 | 808 | } |
809 | 809 | } |
810 | 810 | |
811 | 811 | } |
812 | 812 | |
813 | - $this->plugin->klarnaLog("Shopware_Controllers_Frontend_PaymentKlarna::createAccount->data END OF METHOD:",4, $data); |
|
813 | + $this->plugin->klarnaLog("Shopware_Controllers_Frontend_PaymentKlarna::createAccount->data END OF METHOD:", 4, $data); |
|
814 | 814 | } |
815 | 815 | |
816 | 816 | /** |
@@ -854,8 +854,8 @@ discard block |
||
854 | 854 | array('email' => $data['auth']['email']) |
855 | 855 | ); |
856 | 856 | |
857 | - $data['auth']['password']= $getUser->getPassword(); |
|
858 | - $data['auth']['passwordMD5']= $getUser->getPassword(); |
|
857 | + $data['auth']['password'] = $getUser->getPassword(); |
|
858 | + $data['auth']['passwordMD5'] = $getUser->getPassword(); |
|
859 | 859 | $data['auth']['encoderName'] = 'md5'; |
860 | 860 | return $data; |
861 | 861 | } |
@@ -912,7 +912,7 @@ discard block |
||
912 | 912 | $addressService->create($address, $customer); |
913 | 913 | $addressService->setDefaultShippingAddress($address); |
914 | 914 | } catch (Exception $ex) { |
915 | - $this->klarnaLog("ERROR while creating address via address service. Exception information:".$ex->getMessage(),1); |
|
915 | + $this->klarnaLog("ERROR while creating address via address service. Exception information:".$ex->getMessage(), 1); |
|
916 | 916 | } |
917 | 917 | |
918 | 918 | } |
@@ -963,13 +963,13 @@ discard block |
||
963 | 963 | $this->plugin = $this->get('plugins')->Frontend()->SwagPaymentKlarna(); |
964 | 964 | $this->config = $this->plugin->Config(); |
965 | 965 | |
966 | - $this->plugin->klarnaLog("Entering Shopware_Controllers_Frontend_PaymentKlarna::returnAction",3); |
|
966 | + $this->plugin->klarnaLog("Entering Shopware_Controllers_Frontend_PaymentKlarna::returnAction", 3); |
|
967 | 967 | $transactionId = $this->Request()->getParam('transactionId'); |
968 | 968 | $connector = $this->plugin->getConnector(); |
969 | 969 | |
970 | 970 | $order = new Klarna_Checkout_Order($connector, $transactionId); |
971 | - $this->plugin->klarnaLog("Entering Shopware_Controllers_Frontend_PaymentKlarna::returnAction->transactionId:\n".$transactionId,3); |
|
972 | - $this->plugin->klarnaLog("Entering Shopware_Controllers_Frontend_PaymentKlarna::returnAction->order:",4, $order); |
|
971 | + $this->plugin->klarnaLog("Entering Shopware_Controllers_Frontend_PaymentKlarna::returnAction->transactionId:\n".$transactionId, 3); |
|
972 | + $this->plugin->klarnaLog("Entering Shopware_Controllers_Frontend_PaymentKlarna::returnAction->order:", 4, $order); |
|
973 | 973 | $orderNumber = ''; |
974 | 974 | $session = Shopware()->Session(); |
975 | 975 | |
@@ -981,8 +981,8 @@ discard block |
||
981 | 981 | |
982 | 982 | // if already created by pushaction just redirect |
983 | 983 | |
984 | - if ($order['status'] === 'created'){ |
|
985 | - $this->plugin->klarnaLog("Shopware_Controllers_Frontend_PaymentKlarna::returnAction: OrderStatus is already created... nothing to do: " .$orderNumber,1); |
|
984 | + if ($order['status'] === 'created') { |
|
985 | + $this->plugin->klarnaLog("Shopware_Controllers_Frontend_PaymentKlarna::returnAction: OrderStatus is already created... nothing to do: ".$orderNumber, 1); |
|
986 | 986 | $this->redirect(array( |
987 | 987 | 'controller' => 'payment_klarna', |
988 | 988 | 'action' => 'finish', |
@@ -996,15 +996,15 @@ discard block |
||
996 | 996 | Shopware()->Session()->sOrderVariables['sUserData'] = $this->getUserData(); |
997 | 997 | |
998 | 998 | if ($order['status'] == 'checkout_complete') { |
999 | - $this->plugin->klarnaLog("Entering Shopware_Controllers_Frontend_PaymentKlarna::returnAction: checkout_complete. Save oder if session values match.",3); |
|
1000 | - if (Shopware()->Session()->offsetGet('KlarnaTransactionId') == null){ |
|
1001 | - $this->plugin->klarnaLog("Entering Shopware_Controllers_Frontend_PaymentKlarna::returnAction: Session matches. Order will be saved",3); |
|
1002 | - Shopware()->Session()->offsetSet('KlarnaTransactionId', $transactionId ); |
|
999 | + $this->plugin->klarnaLog("Entering Shopware_Controllers_Frontend_PaymentKlarna::returnAction: checkout_complete. Save oder if session values match.", 3); |
|
1000 | + if (Shopware()->Session()->offsetGet('KlarnaTransactionId') == null) { |
|
1001 | + $this->plugin->klarnaLog("Entering Shopware_Controllers_Frontend_PaymentKlarna::returnAction: Session matches. Order will be saved", 3); |
|
1002 | + Shopware()->Session()->offsetSet('KlarnaTransactionId', $transactionId); |
|
1003 | 1003 | $orderNumber = $this->saveOrder( |
1004 | 1004 | $order['reservation'], |
1005 | 1005 | $order['reference'] |
1006 | 1006 | ); |
1007 | - Shopware()->Session()->offsetSet('KlarnaTransactionId', null ); |
|
1007 | + Shopware()->Session()->offsetSet('KlarnaTransactionId', null); |
|
1008 | 1008 | } |
1009 | 1009 | } |
1010 | 1010 | |
@@ -1013,13 +1013,13 @@ discard block |
||
1013 | 1013 | $orderNumber = $order['merchant_reference']['orderid1']; |
1014 | 1014 | } |
1015 | 1015 | |
1016 | - if (!empty($orderNumber)){ |
|
1016 | + if (!empty($orderNumber)) { |
|
1017 | 1017 | $update = array(); |
1018 | 1018 | |
1019 | 1019 | $update['status'] = 'created'; |
1020 | 1020 | $update['merchant_reference'] = array( |
1021 | - 'orderid1' => (string)$orderNumber, |
|
1022 | - 'orderid2' => (string)$order['reference'] |
|
1021 | + 'orderid1' => (string) $orderNumber, |
|
1022 | + 'orderid2' => (string) $order['reference'] |
|
1023 | 1023 | ); |
1024 | 1024 | $order->update($update); |
1025 | 1025 | } |
@@ -1054,7 +1054,7 @@ discard block |
||
1054 | 1054 | } |
1055 | 1055 | } catch (Exception $e) { |
1056 | 1056 | Shopware()->Plugins()->Controller()->ViewRenderer()->setNoRender(); |
1057 | - $this->plugin->klarnaLog("Shopware_Controllers_Frontend_PaymentKlarna::returnAction: Catch. Searching for Order:",3); |
|
1057 | + $this->plugin->klarnaLog("Shopware_Controllers_Frontend_PaymentKlarna::returnAction: Catch. Searching for Order:", 3); |
|
1058 | 1058 | $this->checkKlarnaOrderExistsByReservation($order['reservation']); |
1059 | 1059 | $this->checkKlarnaOrderExistsByReference($order['reference']); |
1060 | 1060 | $this->checkKlarnaOrderExistsBySession(Shopware()->Session()->sUserId); |
@@ -1082,9 +1082,9 @@ discard block |
||
1082 | 1082 | )); |
1083 | 1083 | |
1084 | 1084 | $orderExists = (empty($order)) ? false : true; |
1085 | - $this->plugin->klarnaLog("Shopware_Controllers_Frontend_PaymentKlarna::checkKlarnaOrderExistsBySession:",3); |
|
1086 | - if ($orderExists){ |
|
1087 | - $this->plugin->klarnaLog("Shopware_Controllers_Frontend_PaymentKlarna::checkKlarnaOrderExistsBySession: Order Found: ",3, $order); |
|
1085 | + $this->plugin->klarnaLog("Shopware_Controllers_Frontend_PaymentKlarna::checkKlarnaOrderExistsBySession:", 3); |
|
1086 | + if ($orderExists) { |
|
1087 | + $this->plugin->klarnaLog("Shopware_Controllers_Frontend_PaymentKlarna::checkKlarnaOrderExistsBySession: Order Found: ", 3, $order); |
|
1088 | 1088 | } |
1089 | 1089 | return $orderExists; |
1090 | 1090 | } |
@@ -1107,9 +1107,9 @@ discard block |
||
1107 | 1107 | )); |
1108 | 1108 | |
1109 | 1109 | $orderExists = (empty($order)) ? false : true; |
1110 | - $this->plugin->klarnaLog("Shopware_Controllers_Frontend_PaymentKlarna::checkKlarnaOrderExistsByReference:",3); |
|
1111 | - if ($orderExists){ |
|
1112 | - $this->plugin->klarnaLog("Shopware_Controllers_Frontend_PaymentKlarna::checkKlarnaOrderExistsByReference: Order Found: ",3, $order); |
|
1110 | + $this->plugin->klarnaLog("Shopware_Controllers_Frontend_PaymentKlarna::checkKlarnaOrderExistsByReference:", 3); |
|
1111 | + if ($orderExists) { |
|
1112 | + $this->plugin->klarnaLog("Shopware_Controllers_Frontend_PaymentKlarna::checkKlarnaOrderExistsByReference: Order Found: ", 3, $order); |
|
1113 | 1113 | } |
1114 | 1114 | return $orderExists; |
1115 | 1115 | } |
@@ -1132,9 +1132,9 @@ discard block |
||
1132 | 1132 | )); |
1133 | 1133 | |
1134 | 1134 | $orderExists = (empty($order)) ? false : true; |
1135 | - $this->plugin->klarnaLog("Shopware_Controllers_Frontend_PaymentKlarna::checkKlarnaOrderExistsByReservation:",3); |
|
1136 | - if ($orderExists){ |
|
1137 | - $this->plugin->klarnaLog("Shopware_Controllers_Frontend_PaymentKlarna::checkKlarnaOrderExistsByReservation: Order Found: ",3, $order); |
|
1135 | + $this->plugin->klarnaLog("Shopware_Controllers_Frontend_PaymentKlarna::checkKlarnaOrderExistsByReservation:", 3); |
|
1136 | + if ($orderExists) { |
|
1137 | + $this->plugin->klarnaLog("Shopware_Controllers_Frontend_PaymentKlarna::checkKlarnaOrderExistsByReservation: Order Found: ", 3, $order); |
|
1138 | 1138 | } |
1139 | 1139 | return $orderExists; |
1140 | 1140 | } |
@@ -1183,9 +1183,9 @@ discard block |
||
1183 | 1183 | )); |
1184 | 1184 | |
1185 | 1185 | $orderExists = (empty($orderDetails)) ? false : true; |
1186 | - $this->plugin->klarnaLog("Shopware_Controllers_Frontend_PaymentKlarna::checkKlarnaOrderDetailsBySession:",3); |
|
1187 | - if ($orderExists){ |
|
1188 | - $this->plugin->klarnaLog("Shopware_Controllers_Frontend_PaymentKlarna::checkKlarnaOrderDetailsBySession: OrderDetails Found: ",3, $orderDetails); |
|
1186 | + $this->plugin->klarnaLog("Shopware_Controllers_Frontend_PaymentKlarna::checkKlarnaOrderDetailsBySession:", 3); |
|
1187 | + if ($orderExists) { |
|
1188 | + $this->plugin->klarnaLog("Shopware_Controllers_Frontend_PaymentKlarna::checkKlarnaOrderDetailsBySession: OrderDetails Found: ", 3, $orderDetails); |
|
1189 | 1189 | } |
1190 | 1190 | return $orderExists; |
1191 | 1191 | } |
@@ -1267,14 +1267,14 @@ discard block |
||
1267 | 1267 | $this->config = $this->plugin->Config(); |
1268 | 1268 | $transactionId = $this->Request()->getParam('transactionId'); |
1269 | 1269 | |
1270 | - $this->plugin->klarnaLog("Shopware_Controllers_Frontend_PaymentKlarna::pushAction->transactionId:\n".$transactionId,3); |
|
1270 | + $this->plugin->klarnaLog("Shopware_Controllers_Frontend_PaymentKlarna::pushAction->transactionId:\n".$transactionId, 3); |
|
1271 | 1271 | $connector = $this->plugin->getConnector(); |
1272 | 1272 | $order = new Klarna_Checkout_Order($connector, $transactionId); |
1273 | 1273 | |
1274 | 1274 | $order->fetch(); |
1275 | 1275 | |
1276 | - if ($order['status'] === 'created'){ |
|
1277 | - $this->plugin->klarnaLog("Shopware_Controllers_Frontend_PaymentKlarna::pushAction: OrderStatus is already created... nothing to do: ",1); |
|
1276 | + if ($order['status'] === 'created') { |
|
1277 | + $this->plugin->klarnaLog("Shopware_Controllers_Frontend_PaymentKlarna::pushAction: OrderStatus is already created... nothing to do: ", 1); |
|
1278 | 1278 | return; |
1279 | 1279 | } |
1280 | 1280 | |
@@ -1284,15 +1284,15 @@ discard block |
||
1284 | 1284 | Shopware()->Session()->sOrderVariables['sUserData'] = $this->getUserData(); |
1285 | 1285 | |
1286 | 1286 | if ($order['status'] == 'checkout_complete') { |
1287 | - $this->plugin->klarnaLog("Entering Shopware_Controllers_Frontend_PaymentKlarna::returnAction: checkout_complete. Save oder if session values match.",3); |
|
1288 | - if (Shopware()->Session()->offsetGet('KlarnaTransactionId') == null){ |
|
1289 | - $this->plugin->klarnaLog("Entering Shopware_Controllers_Frontend_PaymentKlarna::returnAction: Session matches. Order will be saved",3); |
|
1290 | - Shopware()->Session()->offsetSet('KlarnaTransactionId', $transactionId ); |
|
1287 | + $this->plugin->klarnaLog("Entering Shopware_Controllers_Frontend_PaymentKlarna::returnAction: checkout_complete. Save oder if session values match.", 3); |
|
1288 | + if (Shopware()->Session()->offsetGet('KlarnaTransactionId') == null) { |
|
1289 | + $this->plugin->klarnaLog("Entering Shopware_Controllers_Frontend_PaymentKlarna::returnAction: Session matches. Order will be saved", 3); |
|
1290 | + Shopware()->Session()->offsetSet('KlarnaTransactionId', $transactionId); |
|
1291 | 1291 | $orderNumber = $this->saveOrder( |
1292 | 1292 | $order['reservation'], |
1293 | 1293 | $order['reference'] |
1294 | 1294 | ); |
1295 | - Shopware()->Session()->offsetSet('KlarnaTransactionId', null ); |
|
1295 | + Shopware()->Session()->offsetSet('KlarnaTransactionId', null); |
|
1296 | 1296 | } |
1297 | 1297 | } |
1298 | 1298 | |
@@ -1300,13 +1300,13 @@ discard block |
||
1300 | 1300 | $orderNumber = $order['merchant_reference']['orderid1']; |
1301 | 1301 | } |
1302 | 1302 | |
1303 | - if (!empty($orderNumber)){ |
|
1303 | + if (!empty($orderNumber)) { |
|
1304 | 1304 | $update = array(); |
1305 | 1305 | |
1306 | 1306 | $update['status'] = 'created'; |
1307 | 1307 | $update['merchant_reference'] = array( |
1308 | - 'orderid1' => (string)$orderNumber, |
|
1309 | - 'orderid2' => (string)$order['reference'] |
|
1308 | + 'orderid1' => (string) $orderNumber, |
|
1309 | + 'orderid2' => (string) $order['reference'] |
|
1310 | 1310 | ); |
1311 | 1311 | $order->update($update); |
1312 | 1312 | } |
@@ -1331,7 +1331,7 @@ discard block |
||
1331 | 1331 | $orderNumber |
1332 | 1332 | )); |
1333 | 1333 | } catch (Exception $e) { |
1334 | - $this->plugin->klarnaLog("PROBLEM SAVING ORDER ATTRIBUTES AFTER KLARNA PUSH!:\n".$e->getMessage(),1); |
|
1334 | + $this->plugin->klarnaLog("PROBLEM SAVING ORDER ATTRIBUTES AFTER KLARNA PUSH!:\n".$e->getMessage(), 1); |
|
1335 | 1335 | } |
1336 | 1336 | } |
1337 | 1337 |
@@ -220,8 +220,7 @@ |
||
220 | 220 | $this->session['klarnaPreFill'] = true; |
221 | 221 | if (empty($session['sCountry'])) { |
222 | 222 | $countryId = $this->getCountryByShop($shop); |
223 | - } |
|
224 | - else { |
|
223 | + } else { |
|
225 | 224 | $countryId = $session['sCountry']; |
226 | 225 | } |
227 | 226 | if ($user ['additional']['countryShipping']['id'] == $countryId |