@@ -97,13 +97,13 @@ discard block |
||
| 97 | 97 | } |
| 98 | 98 | |
| 99 | 99 | if (!$this->isUserLoggedIn($session)){ |
| 100 | - $this->createAccount(); |
|
| 101 | - } |
|
| 100 | + $this->createAccount(); |
|
| 101 | + } |
|
| 102 | 102 | |
| 103 | 103 | $user = Shopware()->Modules()->Admin()->sGetUserData(); |
| 104 | 104 | if ($this->Request()->getPost('sCountry')) { |
| 105 | - $session['sCountry'] = $this->Request()->getPost('sCountry'); |
|
| 106 | - $session['sChangedCountry'] = $this->Request()->getPost('sCountry'); |
|
| 105 | + $session['sCountry'] = $this->Request()->getPost('sCountry'); |
|
| 106 | + $session['sChangedCountry'] = $this->Request()->getPost('sCountry'); |
|
| 107 | 107 | } |
| 108 | 108 | |
| 109 | 109 | // Switch Paymentmean to Klarna Checkout |
@@ -120,7 +120,7 @@ discard block |
||
| 120 | 120 | $this->forward('index'); |
| 121 | 121 | } |
| 122 | 122 | |
| 123 | - /** |
|
| 123 | + /** |
|
| 124 | 124 | * @param Klarna_Checkout_Order $order |
| 125 | 125 | */ |
| 126 | 126 | public function createAccount($order = null, $checkLoginState=true) |
@@ -257,8 +257,8 @@ discard block |
||
| 257 | 257 | } |
| 258 | 258 | $module->sSYSTEM->_POST = $data['billing']; |
| 259 | 259 | if (Shopware::VERSION === '___VERSION___' || version_compare(Shopware::VERSION, '5.2.0', '>=')) { |
| 260 | - $userId = $session->offsetGet('sUserId'); |
|
| 261 | - $this->updateBilling($userId, $data['billing']); |
|
| 260 | + $userId = $session->offsetGet('sUserId'); |
|
| 261 | + $this->updateBilling($userId, $data['billing']); |
|
| 262 | 262 | } else{ |
| 263 | 263 | $module->sUpdateBilling(); |
| 264 | 264 | } |
@@ -364,12 +364,12 @@ discard block |
||
| 364 | 364 | |
| 365 | 365 | // get updated password; it is md5 randomized after register |
| 366 | 366 | $getUser = Shopware()->Models()->getRepository('Shopware\Models\Customer\Customer')->findOneBy( |
| 367 | - array('email' => $data['auth']['email']) |
|
| 368 | - ); |
|
| 367 | + array('email' => $data['auth']['email']) |
|
| 368 | + ); |
|
| 369 | 369 | |
| 370 | - $data['auth']['password']= $getUser->getPassword(); |
|
| 371 | - $data['auth']['passwordMD5']= $getUser->getPassword(); |
|
| 372 | - $data['auth']['encoderName'] = 'md5'; |
|
| 370 | + $data['auth']['password']= $getUser->getPassword(); |
|
| 371 | + $data['auth']['passwordMD5']= $getUser->getPassword(); |
|
| 372 | + $data['auth']['encoderName'] = 'md5'; |
|
| 373 | 373 | return $data; |
| 374 | 374 | } |
| 375 | 375 | |
@@ -388,19 +388,19 @@ discard block |
||
| 388 | 388 | unset ($data['billing']); |
| 389 | 389 | |
| 390 | 390 | $customer = Shopware()->Models()->getRepository('Shopware\Models\Customer\Customer')->findOneBy( |
| 391 | - array('id' => $userId) |
|
| 392 | - ); |
|
| 391 | + array('id' => $userId) |
|
| 392 | + ); |
|
| 393 | 393 | $customer->fromArray($data); |
| 394 | 394 | Shopware()->Container()->get('shopware_account.customer_service')->update($customer); |
| 395 | 395 | } |
| 396 | 396 | |
| 397 | 397 | |
| 398 | - /** |
|
| 399 | - * Updates the shipping address |
|
| 400 | - * |
|
| 401 | - * @param int $userId |
|
| 402 | - * @param array $shippingData |
|
| 403 | - */ |
|
| 398 | + /** |
|
| 399 | + * Updates the shipping address |
|
| 400 | + * |
|
| 401 | + * @param int $userId |
|
| 402 | + * @param array $shippingData |
|
| 403 | + */ |
|
| 404 | 404 | private function updateShipping($userId, $shippingData) |
| 405 | 405 | { |
| 406 | 406 | /** @var \Shopware\Components\Model\ModelManager $em */ |
@@ -413,7 +413,7 @@ discard block |
||
| 413 | 413 | $addressold = $customer->getDefaultShippingAddress(); |
| 414 | 414 | $address = new \Shopware\Models\Customer\Address(); |
| 415 | 415 | |
| 416 | - /** @var \Shopware\Models\Country\Country $country */ |
|
| 416 | + /** @var \Shopware\Models\Country\Country $country */ |
|
| 417 | 417 | $country = $addressold->getCountry(); |
| 418 | 418 | $shippingData['country'] = $country; |
| 419 | 419 | if ($shippingData['phone'] === null) { |
@@ -447,7 +447,7 @@ discard block |
||
| 447 | 447 | /** @var \Shopware\Models\Customer\Address $address */ |
| 448 | 448 | $address = $customer->getDefaultBillingAddress(); |
| 449 | 449 | |
| 450 | - /** @var \Shopware\Models\Country\Country $country */ |
|
| 450 | + /** @var \Shopware\Models\Country\Country $country */ |
|
| 451 | 451 | $country = $address->getCountry(); |
| 452 | 452 | $billingData['country'] = $country; |
| 453 | 453 | $address->fromArray($billingData); |
@@ -794,27 +794,27 @@ discard block |
||
| 794 | 794 | ); |
| 795 | 795 | |
| 796 | 796 | $firstName = $swUser->getBilling()->getFirstname(); |
| 797 | - if ($firstName === 'Klarna Firstname') { |
|
| 798 | - $this->plugin->klarnaLog("Shopware_Controllers_Frontend_PaymentKlarna::pushAction: Found Order with Klarna Firstname, updating from Klarna data: " .$orderNumber,1); |
|
| 799 | - $data['billing']['salutation'] = $order['billing_address']['title']; |
|
| 800 | - $data['billing']['firstname'] = $order['billing_address']['given_name']; |
|
| 801 | - $data['billing']['lastname'] = $order['billing_address']['family_name']; |
|
| 802 | - $data['billing']['street'] = $order['billing_address']['street_name']." ". $order['billing_address']['street_number']; |
|
| 803 | - $data['billing']['zipcode'] = $order['billing_address']['postal_code']; |
|
| 804 | - $data['billing']['city'] = $order['billing_address']['city']; |
|
| 805 | - $data['billing']['birthday'] = $order['customer']['date_of_birth']; |
|
| 806 | - $data['billing']['phone'] = $order['billing_address']['phone']; |
|
| 807 | - |
|
| 808 | - $data['shipping']['salutation'] = $order['shipping_address']['title']; |
|
| 809 | - $data['shipping']['firstname'] = $order['shipping_address']['given_name']; |
|
| 810 | - $data['shipping']['lastname'] = $order['shipping_address']['family_name']; |
|
| 811 | - $data['shipping']['street'] = $order['shipping_address']['street_name']." ". $order['shipping_address']['street_number']; |
|
| 812 | - $data['shipping']['zipcode'] = $order['shipping_address']['postal_code']; |
|
| 813 | - $data['shipping']['city'] = $order['shipping_address']['city']; |
|
| 814 | - $data['shipping']['birthday'] = $order['customer']['date_of_birth']; |
|
| 815 | - $data['shipping']['phone'] = $order['shipping_address']['phone']; |
|
| 816 | - // Update Customer |
|
| 817 | - if (Shopware::VERSION === '___VERSION___' || version_compare(Shopware::VERSION, '5.2.0', '>=')) { |
|
| 797 | + if ($firstName === 'Klarna Firstname') { |
|
| 798 | + $this->plugin->klarnaLog("Shopware_Controllers_Frontend_PaymentKlarna::pushAction: Found Order with Klarna Firstname, updating from Klarna data: " .$orderNumber,1); |
|
| 799 | + $data['billing']['salutation'] = $order['billing_address']['title']; |
|
| 800 | + $data['billing']['firstname'] = $order['billing_address']['given_name']; |
|
| 801 | + $data['billing']['lastname'] = $order['billing_address']['family_name']; |
|
| 802 | + $data['billing']['street'] = $order['billing_address']['street_name']." ". $order['billing_address']['street_number']; |
|
| 803 | + $data['billing']['zipcode'] = $order['billing_address']['postal_code']; |
|
| 804 | + $data['billing']['city'] = $order['billing_address']['city']; |
|
| 805 | + $data['billing']['birthday'] = $order['customer']['date_of_birth']; |
|
| 806 | + $data['billing']['phone'] = $order['billing_address']['phone']; |
|
| 807 | + |
|
| 808 | + $data['shipping']['salutation'] = $order['shipping_address']['title']; |
|
| 809 | + $data['shipping']['firstname'] = $order['shipping_address']['given_name']; |
|
| 810 | + $data['shipping']['lastname'] = $order['shipping_address']['family_name']; |
|
| 811 | + $data['shipping']['street'] = $order['shipping_address']['street_name']." ". $order['shipping_address']['street_number']; |
|
| 812 | + $data['shipping']['zipcode'] = $order['shipping_address']['postal_code']; |
|
| 813 | + $data['shipping']['city'] = $order['shipping_address']['city']; |
|
| 814 | + $data['shipping']['birthday'] = $order['customer']['date_of_birth']; |
|
| 815 | + $data['shipping']['phone'] = $order['shipping_address']['phone']; |
|
| 816 | + // Update Customer |
|
| 817 | + if (Shopware::VERSION === '___VERSION___' || version_compare(Shopware::VERSION, '5.2.0', '>=')) { |
|
| 818 | 818 | unset ($data['billing']['birthday']); |
| 819 | 819 | unset ($data['shipping']['birthday']); |
| 820 | 820 | unset ($data['shipping']['phone']); |
@@ -825,67 +825,67 @@ discard block |
||
| 825 | 825 | $customer->fromArray($data); |
| 826 | 826 | Shopware()->Container()->get('shopware_account.customer_service')->update($customer); |
| 827 | 827 | |
| 828 | - $this->updateShipping($userId, $data['shipping']); |
|
| 829 | - $this->updateBilling($userId, $data['billing']); |
|
| 828 | + $this->updateShipping($userId, $data['shipping']); |
|
| 829 | + $this->updateBilling($userId, $data['billing']); |
|
| 830 | 830 | |
| 831 | - // Update Order Addresses |
|
| 832 | - |
|
| 833 | - $orderShippingID = Shopware()->Db()->fetchOne( |
|
| 834 | - 'SELECT id FROM s_order_shippingaddress WHERE userID = ? AND orderID = ?', |
|
| 835 | - array($userId, $orderId) |
|
| 836 | - ); |
|
| 837 | - $where = array('id='.(int) $orderShippingID); |
|
| 838 | - Shopware()->Db()->update('s_order_shippingaddress', $data['shipping'], $where); |
|
| 839 | - |
|
| 840 | - $orderBillingID = Shopware()->Db()->fetchOne( |
|
| 841 | - 'SELECT id FROM s_order_billingaddress WHERE userID = ? AND orderID = ?', |
|
| 842 | - array($userId, $orderId) |
|
| 843 | - ); |
|
| 844 | - $where = array('id='.(int) $orderBillingID); |
|
| 845 | - Shopware()->Db()->update('s_order_billingaddress', $data['billing'], $where); |
|
| 831 | + // Update Order Addresses |
|
| 832 | + |
|
| 833 | + $orderShippingID = Shopware()->Db()->fetchOne( |
|
| 834 | + 'SELECT id FROM s_order_shippingaddress WHERE userID = ? AND orderID = ?', |
|
| 835 | + array($userId, $orderId) |
|
| 836 | + ); |
|
| 837 | + $where = array('id='.(int) $orderShippingID); |
|
| 838 | + Shopware()->Db()->update('s_order_shippingaddress', $data['shipping'], $where); |
|
| 839 | + |
|
| 840 | + $orderBillingID = Shopware()->Db()->fetchOne( |
|
| 841 | + 'SELECT id FROM s_order_billingaddress WHERE userID = ? AND orderID = ?', |
|
| 842 | + array($userId, $orderId) |
|
| 843 | + ); |
|
| 844 | + $where = array('id='.(int) $orderBillingID); |
|
| 845 | + Shopware()->Db()->update('s_order_billingaddress', $data['billing'], $where); |
|
| 846 | 846 | |
| 847 | - } else{ |
|
| 848 | - |
|
| 849 | - // Append streetnumber to street and unset field for sw 5.1 |
|
| 850 | - // unset birthday too |
|
| 847 | + } else{ |
|
| 851 | 848 | |
| 852 | - // Update User Addresses |
|
| 853 | - unset ($data['shipping']['birthday']); |
|
| 854 | - unset ($data['shipping']['phone']); |
|
| 849 | + // Append streetnumber to street and unset field for sw 5.1 |
|
| 850 | + // unset birthday too |
|
| 855 | 851 | |
| 856 | - $shippingID = Shopware()->Db()->fetchOne( |
|
| 857 | - 'SELECT id FROM s_user_shippingaddress WHERE userID = ?', |
|
| 858 | - array($userId) |
|
| 859 | - ); |
|
| 860 | - $where = array('id='.(int) $shippingID); |
|
| 861 | - Shopware()->Db()->update('s_user_shippingaddress', $data['shipping'], $where); |
|
| 862 | - |
|
| 863 | - $billingID = Shopware()->Db()->fetchOne( |
|
| 864 | - 'SELECT id FROM s_user_billingaddress WHERE userID = ?', |
|
| 865 | - array($userId) |
|
| 866 | - ); |
|
| 867 | - $where = array('id='.(int) $billingID); |
|
| 868 | - Shopware()->Db()->update('s_user_billingaddress', $data['billing'], $where); |
|
| 869 | - |
|
| 870 | - |
|
| 871 | - // Update Order Addresses |
|
| 872 | - |
|
| 873 | - $orderShippingID = Shopware()->Db()->fetchOne( |
|
| 874 | - 'SELECT id FROM s_order_shippingaddress WHERE userID = ? AND orderID = ?', |
|
| 875 | - array($userId, $orderId) |
|
| 876 | - ); |
|
| 877 | - $where = array('id='.(int) $orderShippingID); |
|
| 878 | - Shopware()->Db()->update('s_order_shippingaddress', $data['shipping'], $where); |
|
| 879 | - |
|
| 880 | - $orderBillingID = Shopware()->Db()->fetchOne( |
|
| 881 | - 'SELECT id FROM s_order_billingaddress WHERE userID = ? AND orderID = ?', |
|
| 882 | - array($userId, $orderId) |
|
| 883 | - ); |
|
| 884 | - $where = array('id='.(int) $orderBillingID); |
|
| 885 | - Shopware()->Db()->update('s_order_billingaddress', $data['billing'], $where); |
|
| 852 | + // Update User Addresses |
|
| 853 | + unset ($data['shipping']['birthday']); |
|
| 854 | + unset ($data['shipping']['phone']); |
|
| 855 | + |
|
| 856 | + $shippingID = Shopware()->Db()->fetchOne( |
|
| 857 | + 'SELECT id FROM s_user_shippingaddress WHERE userID = ?', |
|
| 858 | + array($userId) |
|
| 859 | + ); |
|
| 860 | + $where = array('id='.(int) $shippingID); |
|
| 861 | + Shopware()->Db()->update('s_user_shippingaddress', $data['shipping'], $where); |
|
| 862 | + |
|
| 863 | + $billingID = Shopware()->Db()->fetchOne( |
|
| 864 | + 'SELECT id FROM s_user_billingaddress WHERE userID = ?', |
|
| 865 | + array($userId) |
|
| 866 | + ); |
|
| 867 | + $where = array('id='.(int) $billingID); |
|
| 868 | + Shopware()->Db()->update('s_user_billingaddress', $data['billing'], $where); |
|
| 869 | + |
|
| 870 | + |
|
| 871 | + // Update Order Addresses |
|
| 872 | + |
|
| 873 | + $orderShippingID = Shopware()->Db()->fetchOne( |
|
| 874 | + 'SELECT id FROM s_order_shippingaddress WHERE userID = ? AND orderID = ?', |
|
| 875 | + array($userId, $orderId) |
|
| 876 | + ); |
|
| 877 | + $where = array('id='.(int) $orderShippingID); |
|
| 878 | + Shopware()->Db()->update('s_order_shippingaddress', $data['shipping'], $where); |
|
| 879 | + |
|
| 880 | + $orderBillingID = Shopware()->Db()->fetchOne( |
|
| 881 | + 'SELECT id FROM s_order_billingaddress WHERE userID = ? AND orderID = ?', |
|
| 882 | + array($userId, $orderId) |
|
| 883 | + ); |
|
| 884 | + $where = array('id='.(int) $orderBillingID); |
|
| 885 | + Shopware()->Db()->update('s_order_billingaddress', $data['billing'], $where); |
|
| 886 | 886 | |
| 887 | - } |
|
| 888 | - } |
|
| 887 | + } |
|
| 888 | + } |
|
| 889 | 889 | |
| 890 | 890 | $update = array(); |
| 891 | 891 | $update['status'] = 'created'; |
@@ -1042,6 +1042,6 @@ discard block |
||
| 1042 | 1042 | |
| 1043 | 1043 | protected function isUserLoggedIn($session) |
| 1044 | 1044 | { |
| 1045 | - return (isset($session->sUserId) && !empty($session->sUserId)); |
|
| 1045 | + return (isset($session->sUserId) && !empty($session->sUserId)); |
|
| 1046 | 1046 | } |
| 1047 | 1047 | } |
@@ -75,7 +75,7 @@ discard block |
||
| 75 | 75 | { |
| 76 | 76 | $session = Shopware()->Session(); |
| 77 | 77 | |
| 78 | - if (!empty($session->PaypalResponse)){ |
|
| 78 | + if (!empty($session->PaypalResponse)) { |
|
| 79 | 79 | $this->plugin->klarnaLog("Paypal Payment in Progress detected Redirecting To Index Page", 3); |
| 80 | 80 | $this->redirect( |
| 81 | 81 | array( |
@@ -87,16 +87,16 @@ discard block |
||
| 87 | 87 | } |
| 88 | 88 | |
| 89 | 89 | if ($this->Request()->getPost('sCountry')) { |
| 90 | - $session['sCountry'] = (int)$this->Request()->getPost('sCountry'); |
|
| 90 | + $session['sCountry'] = (int) $this->Request()->getPost('sCountry'); |
|
| 91 | 91 | $session["sState"] = 0; |
| 92 | 92 | $session["sArea"] = Shopware()->Db()->fetchOne(" |
| 93 | 93 | SELECT areaID FROM s_core_countries WHERE id = ? |
| 94 | 94 | ", array($session['sCountry'])); |
| 95 | 95 | unset($session->KlarnaOrder); |
| 96 | - $session['sChangedCountry'] = (int)$this->Request()->getPost('sCountry'); |
|
| 96 | + $session['sChangedCountry'] = (int) $this->Request()->getPost('sCountry'); |
|
| 97 | 97 | } |
| 98 | 98 | |
| 99 | - if (!$this->isUserLoggedIn($session)){ |
|
| 99 | + if (!$this->isUserLoggedIn($session)) { |
|
| 100 | 100 | $this->createAccount(); |
| 101 | 101 | } |
| 102 | 102 | |
@@ -123,7 +123,7 @@ discard block |
||
| 123 | 123 | /** |
| 124 | 124 | * @param Klarna_Checkout_Order $order |
| 125 | 125 | */ |
| 126 | - public function createAccount($order = null, $checkLoginState=true) |
|
| 126 | + public function createAccount($order = null, $checkLoginState = true) |
|
| 127 | 127 | { |
| 128 | 128 | $this->plugin->klarnaLog('Entering Shopware_Controllers_Frontend_PaymentKlarna::createAccount', 3); |
| 129 | 129 | $module = Shopware()->Modules()->Admin(); |
@@ -143,7 +143,7 @@ discard block |
||
| 143 | 143 | $sessionId = Shopware()->SessionID(); |
| 144 | 144 | // email is only varchar(70) so we cut the sessionid |
| 145 | 145 | //$sessionId = substr($sessionId, 0,49); |
| 146 | - $data['auth']['email'] = substr($sessionId, 0,49) . '@klarna.com'; |
|
| 146 | + $data['auth']['email'] = substr($sessionId, 0, 49).'@klarna.com'; |
|
| 147 | 147 | $data['auth']['password'] = $sessionId; |
| 148 | 148 | } |
| 149 | 149 | $data['auth']['accountmode'] = '1'; |
@@ -158,11 +158,11 @@ discard block |
||
| 158 | 158 | ); |
| 159 | 159 | } |
| 160 | 160 | |
| 161 | - $this->plugin->klarnaLog("Shopware_Controllers_Frontend_PaymentKlarna::createAccount->order:",4, $order); |
|
| 161 | + $this->plugin->klarnaLog("Shopware_Controllers_Frontend_PaymentKlarna::createAccount->order:", 4, $order); |
|
| 162 | 162 | |
| 163 | 163 | foreach (array('billing', 'shipping') as $type) { |
| 164 | - if (isset($order[$type . '_address'])) { |
|
| 165 | - $orderAddress = $order[$type . '_address']; |
|
| 164 | + if (isset($order[$type.'_address'])) { |
|
| 165 | + $orderAddress = $order[$type.'_address']; |
|
| 166 | 166 | if (isset($orderAddress['title'])) { |
| 167 | 167 | $data[$type]['salutation'] = $orderAddress['title'] == 'Frau' ? 'ms' : 'mr'; |
| 168 | 168 | } else { |
@@ -172,7 +172,7 @@ discard block |
||
| 172 | 172 | $data[$type]['lastname'] = $orderAddress['family_name']; |
| 173 | 173 | if (isset($orderAddress['street_name']) && $orderAddress['street_number']) { |
| 174 | 174 | if (version_compare(Shopware::VERSION, '5.0.0', '>=')) { |
| 175 | - $data[$type]['street'] = $orderAddress['street_name'] . ' ' . $orderAddress['street_number']; |
|
| 175 | + $data[$type]['street'] = $orderAddress['street_name'].' '.$orderAddress['street_number']; |
|
| 176 | 176 | } else { |
| 177 | 177 | $data[$type]['street'] = $orderAddress['street_name']; |
| 178 | 178 | $data[$type]['streetnumber'] = $orderAddress['street_number']; |
@@ -207,21 +207,21 @@ discard block |
||
| 207 | 207 | } |
| 208 | 208 | $data[$type]['department'] = ''; |
| 209 | 209 | |
| 210 | - if (!empty($order[$type . '_address']['country'])) { |
|
| 210 | + if (!empty($order[$type.'_address']['country'])) { |
|
| 211 | 211 | $sql = 'SELECT id FROM s_core_countries WHERE countryiso=?'; |
| 212 | - $countryId = Shopware()->Db()->fetchOne($sql, array($order[$type . '_address']['country'])); |
|
| 212 | + $countryId = Shopware()->Db()->fetchOne($sql, array($order[$type.'_address']['country'])); |
|
| 213 | 213 | } else { |
| 214 | 214 | $countryId = $session['sCountry']; |
| 215 | 215 | } |
| 216 | 216 | // make sure country is set in case of lost sessions defualt to germany |
| 217 | - if (empty($countryId)){ |
|
| 217 | + if (empty($countryId)) { |
|
| 218 | 218 | $countryId = 2; |
| 219 | 219 | } |
| 220 | 220 | |
| 221 | 221 | $data[$type]['country'] = $countryId; |
| 222 | 222 | } |
| 223 | 223 | |
| 224 | - $this->plugin->klarnaLog("Shopware_Controllers_Frontend_PaymentKlarna::createAccount->data AFTER ADDRESSES:",4,$data); |
|
| 224 | + $this->plugin->klarnaLog("Shopware_Controllers_Frontend_PaymentKlarna::createAccount->data AFTER ADDRESSES:", 4, $data); |
|
| 225 | 225 | $sql = 'SELECT id FROM s_core_paymentmeans WHERE name=?'; |
| 226 | 226 | $paymentId = Shopware()->Db()->fetchOne($sql, array('klarna_checkout')); |
| 227 | 227 | |
@@ -240,7 +240,7 @@ discard block |
||
| 240 | 240 | $session->offsetSet('sUserPassword', $user['password']); |
| 241 | 241 | $session->offsetSet('sUserId', $user['id']); |
| 242 | 242 | } else { |
| 243 | - $this->plugin->klarnaLog("Shopware_Controllers_Frontend_PaymentKlarna::createAccount->user Not Found in DB SQL was:" .$sql,1); |
|
| 243 | + $this->plugin->klarnaLog("Shopware_Controllers_Frontend_PaymentKlarna::createAccount->user Not Found in DB SQL was:".$sql, 1); |
|
| 244 | 244 | } |
| 245 | 245 | } |
| 246 | 246 | |
@@ -259,7 +259,7 @@ discard block |
||
| 259 | 259 | if (Shopware::VERSION === '___VERSION___' || version_compare(Shopware::VERSION, '5.2.0', '>=')) { |
| 260 | 260 | $userId = $session->offsetGet('sUserId'); |
| 261 | 261 | $this->updateBilling($userId, $data['billing']); |
| 262 | - } else{ |
|
| 262 | + } else { |
|
| 263 | 263 | $module->sUpdateBilling(); |
| 264 | 264 | } |
| 265 | 265 | unset($data['auth']['password']); |
@@ -267,10 +267,10 @@ discard block |
||
| 267 | 267 | if (Shopware::VERSION === '___VERSION___' || version_compare(Shopware::VERSION, '5.2.0', '>=')) { |
| 268 | 268 | $userId = $session->offsetGet('sUserId'); |
| 269 | 269 | $this->updateCustomer($data, $userId); |
| 270 | - $this->plugin->klarnaLog("Shopware_Controllers_Frontend_PaymentKlarna::createAccount->updateCustomer:",3, $data); |
|
| 271 | - } else{ |
|
| 270 | + $this->plugin->klarnaLog("Shopware_Controllers_Frontend_PaymentKlarna::createAccount->updateCustomer:", 3, $data); |
|
| 271 | + } else { |
|
| 272 | 272 | $module->sUpdateAccount(); |
| 273 | - $this->plugin->klarnaLog("Shopware_Controllers_Frontend_PaymentKlarna::createAccount->updateAccount:",3, $this->front->Request()->getPost()); |
|
| 273 | + $this->plugin->klarnaLog("Shopware_Controllers_Frontend_PaymentKlarna::createAccount->updateAccount:", 3, $this->front->Request()->getPost()); |
|
| 274 | 274 | } |
| 275 | 275 | } else { |
| 276 | 276 | /** @var Enlight_Controller_Front $front */ |
@@ -313,23 +313,23 @@ discard block |
||
| 313 | 313 | $newdata = $this->saveUser($data); |
| 314 | 314 | $module->sSYSTEM->_POST = $newdata['auth']; |
| 315 | 315 | $errors = $module->sLogin(true); |
| 316 | - $this->plugin->klarnaLog("Shopware_Controllers_Frontend_PaymentKlarna::createAccount->saveUser:",3, $newdata); |
|
| 316 | + $this->plugin->klarnaLog("Shopware_Controllers_Frontend_PaymentKlarna::createAccount->saveUser:", 3, $newdata); |
|
| 317 | 317 | // $this->returnAction(); |
| 318 | 318 | } else { |
| 319 | - $this->plugin->klarnaLog("Shopware_Controllers_Frontend_PaymentKlarna::createAccount->saveUser->Register:",3, $session->sRegister); |
|
| 319 | + $this->plugin->klarnaLog("Shopware_Controllers_Frontend_PaymentKlarna::createAccount->saveUser->Register:", 3, $session->sRegister); |
|
| 320 | 320 | $module->sSaveRegister(); |
| 321 | - $this->plugin->klarnaLog("Shopware_Controllers_Frontend_PaymentKlarna::createAccount->saveUser->RegisterFinished:",3, $session->offsetGet('sRegisterFinished')); |
|
| 321 | + $this->plugin->klarnaLog("Shopware_Controllers_Frontend_PaymentKlarna::createAccount->saveUser->RegisterFinished:", 3, $session->offsetGet('sRegisterFinished')); |
|
| 322 | 322 | } |
| 323 | 323 | |
| 324 | 324 | } catch (\Exception $ex) { /* do nothing */ |
| 325 | - $this->klarnaLog("ERROR while creating User. Exception information:".$ex->getMessage(),1); |
|
| 325 | + $this->klarnaLog("ERROR while creating User. Exception information:".$ex->getMessage(), 1); |
|
| 326 | 326 | |
| 327 | 327 | } |
| 328 | 328 | } |
| 329 | 329 | |
| 330 | 330 | } |
| 331 | 331 | |
| 332 | - $this->plugin->klarnaLog("Shopware_Controllers_Frontend_PaymentKlarna::createAccount->data END OF METHOD:",4, $data); |
|
| 332 | + $this->plugin->klarnaLog("Shopware_Controllers_Frontend_PaymentKlarna::createAccount->data END OF METHOD:", 4, $data); |
|
| 333 | 333 | } |
| 334 | 334 | |
| 335 | 335 | /** |
@@ -367,8 +367,8 @@ discard block |
||
| 367 | 367 | array('email' => $data['auth']['email']) |
| 368 | 368 | ); |
| 369 | 369 | |
| 370 | - $data['auth']['password']= $getUser->getPassword(); |
|
| 371 | - $data['auth']['passwordMD5']= $getUser->getPassword(); |
|
| 370 | + $data['auth']['password'] = $getUser->getPassword(); |
|
| 371 | + $data['auth']['passwordMD5'] = $getUser->getPassword(); |
|
| 372 | 372 | $data['auth']['encoderName'] = 'md5'; |
| 373 | 373 | return $data; |
| 374 | 374 | } |
@@ -425,7 +425,7 @@ discard block |
||
| 425 | 425 | $addressService->create($address, $customer); |
| 426 | 426 | $addressService->setDefaultShippingAddress($address); |
| 427 | 427 | } catch (Exception $ex) { |
| 428 | - $this->klarnaLog("ERROR while creating address via address service. Exception information:".$ex->getMessage(),1); |
|
| 428 | + $this->klarnaLog("ERROR while creating address via address service. Exception information:".$ex->getMessage(), 1); |
|
| 429 | 429 | } |
| 430 | 430 | |
| 431 | 431 | } |
@@ -472,7 +472,7 @@ discard block |
||
| 472 | 472 | */ |
| 473 | 473 | public function returnAction() |
| 474 | 474 | { |
| 475 | - $this->plugin->klarnaLog("Entering Shopware_Controllers_Frontend_PaymentKlarna::returnAction",3); |
|
| 475 | + $this->plugin->klarnaLog("Entering Shopware_Controllers_Frontend_PaymentKlarna::returnAction", 3); |
|
| 476 | 476 | if ($this->getPaymentShortName() != 'klarna_checkout') { |
| 477 | 477 | $this->forward('index'); |
| 478 | 478 | return; |
@@ -482,8 +482,8 @@ discard block |
||
| 482 | 482 | $connector = $this->plugin->getConnector(); |
| 483 | 483 | |
| 484 | 484 | $order = new Klarna_Checkout_Order($connector, $transactionId); |
| 485 | - $this->plugin->klarnaLog("Entering Shopware_Controllers_Frontend_PaymentKlarna::returnAction->transactionId:\n".$transactionId,3); |
|
| 486 | - $this->plugin->klarnaLog("Entering Shopware_Controllers_Frontend_PaymentKlarna::returnAction->order:",4, $order); |
|
| 485 | + $this->plugin->klarnaLog("Entering Shopware_Controllers_Frontend_PaymentKlarna::returnAction->transactionId:\n".$transactionId, 3); |
|
| 486 | + $this->plugin->klarnaLog("Entering Shopware_Controllers_Frontend_PaymentKlarna::returnAction->order:", 4, $order); |
|
| 487 | 487 | $orderNumber = ''; |
| 488 | 488 | |
| 489 | 489 | try { |
@@ -493,20 +493,20 @@ discard block |
||
| 493 | 493 | $this->plugin->updateOrderVariables(); |
| 494 | 494 | |
| 495 | 495 | if ($order['status'] == 'checkout_complete') { |
| 496 | - $this->plugin->klarnaLog("Entering Shopware_Controllers_Frontend_PaymentKlarna::returnAction: checkout_complete. Save oder if session values match.",3); |
|
| 497 | - if (Shopware()->Session()->offsetGet('KlarnaTransactionId') == null){ |
|
| 498 | - $this->plugin->klarnaLog("Entering Shopware_Controllers_Frontend_PaymentKlarna::returnAction: Session matches. Order will be saved",3); |
|
| 499 | - Shopware()->Session()->offsetSet('KlarnaTransactionId', $transactionId ); |
|
| 496 | + $this->plugin->klarnaLog("Entering Shopware_Controllers_Frontend_PaymentKlarna::returnAction: checkout_complete. Save oder if session values match.", 3); |
|
| 497 | + if (Shopware()->Session()->offsetGet('KlarnaTransactionId') == null) { |
|
| 498 | + $this->plugin->klarnaLog("Entering Shopware_Controllers_Frontend_PaymentKlarna::returnAction: Session matches. Order will be saved", 3); |
|
| 499 | + Shopware()->Session()->offsetSet('KlarnaTransactionId', $transactionId); |
|
| 500 | 500 | $orderNumber = $this->saveOrder( |
| 501 | 501 | $order['reservation'], |
| 502 | 502 | $order['reference'] |
| 503 | 503 | ); |
| 504 | - Shopware()->Session()->offsetSet('KlarnaTransactionId', null ); |
|
| 504 | + Shopware()->Session()->offsetSet('KlarnaTransactionId', null); |
|
| 505 | 505 | } |
| 506 | 506 | |
| 507 | - $this->plugin->klarnaLog("Shopware_Controllers_Frontend_PaymentKlarna::returnAction: checkout_complete. Check if Order was persisted in DB.",3); |
|
| 507 | + $this->plugin->klarnaLog("Shopware_Controllers_Frontend_PaymentKlarna::returnAction: checkout_complete. Check if Order was persisted in DB.", 3); |
|
| 508 | 508 | |
| 509 | - $this->plugin->klarnaLog("Shopware_Controllers_Frontend_PaymentKlarna::returnAction: checkout_complete. Searching for Order:",3); |
|
| 509 | + $this->plugin->klarnaLog("Shopware_Controllers_Frontend_PaymentKlarna::returnAction: checkout_complete. Searching for Order:", 3); |
|
| 510 | 510 | $this->checkKlarnaOrderExistsByReservation($order['reservation']); |
| 511 | 511 | $this->checkKlarnaOrderExistsByReference($order['reference']); |
| 512 | 512 | $this->checkKlarnaOrderExistsBySession(Shopware()->Session()->sUserId); |
@@ -551,7 +551,7 @@ discard block |
||
| 551 | 551 | } |
| 552 | 552 | } catch (Exception $e) { |
| 553 | 553 | Shopware()->Plugins()->Controller()->ViewRenderer()->setNoRender(); |
| 554 | - $this->plugin->klarnaLog("Shopware_Controllers_Frontend_PaymentKlarna::returnAction: Catch. Searching for Order:",3); |
|
| 554 | + $this->plugin->klarnaLog("Shopware_Controllers_Frontend_PaymentKlarna::returnAction: Catch. Searching for Order:", 3); |
|
| 555 | 555 | $this->checkKlarnaOrderExistsByReservation($order['reservation']); |
| 556 | 556 | $this->checkKlarnaOrderExistsByReference($order['reference']); |
| 557 | 557 | $this->checkKlarnaOrderExistsBySession(Shopware()->Session()->sUserId); |
@@ -577,9 +577,9 @@ discard block |
||
| 577 | 577 | )); |
| 578 | 578 | |
| 579 | 579 | $orderExists = (empty($order)) ? false : true; |
| 580 | - $this->plugin->klarnaLog("Shopware_Controllers_Frontend_PaymentKlarna::checkKlarnaOrderExistsBySession:",3); |
|
| 581 | - if ($orderExists){ |
|
| 582 | - $this->plugin->klarnaLog("Shopware_Controllers_Frontend_PaymentKlarna::checkKlarnaOrderExistsBySession: Order Found: ",3, $order); |
|
| 580 | + $this->plugin->klarnaLog("Shopware_Controllers_Frontend_PaymentKlarna::checkKlarnaOrderExistsBySession:", 3); |
|
| 581 | + if ($orderExists) { |
|
| 582 | + $this->plugin->klarnaLog("Shopware_Controllers_Frontend_PaymentKlarna::checkKlarnaOrderExistsBySession: Order Found: ", 3, $order); |
|
| 583 | 583 | } |
| 584 | 584 | return $orderExists; |
| 585 | 585 | } |
@@ -602,9 +602,9 @@ discard block |
||
| 602 | 602 | )); |
| 603 | 603 | |
| 604 | 604 | $orderExists = (empty($order)) ? false : true; |
| 605 | - $this->plugin->klarnaLog("Shopware_Controllers_Frontend_PaymentKlarna::checkKlarnaOrderExistsByReference:",3); |
|
| 606 | - if ($orderExists){ |
|
| 607 | - $this->plugin->klarnaLog("Shopware_Controllers_Frontend_PaymentKlarna::checkKlarnaOrderExistsByReference: Order Found: ",3, $order); |
|
| 605 | + $this->plugin->klarnaLog("Shopware_Controllers_Frontend_PaymentKlarna::checkKlarnaOrderExistsByReference:", 3); |
|
| 606 | + if ($orderExists) { |
|
| 607 | + $this->plugin->klarnaLog("Shopware_Controllers_Frontend_PaymentKlarna::checkKlarnaOrderExistsByReference: Order Found: ", 3, $order); |
|
| 608 | 608 | } |
| 609 | 609 | return $orderExists; |
| 610 | 610 | } |
@@ -627,9 +627,9 @@ discard block |
||
| 627 | 627 | )); |
| 628 | 628 | |
| 629 | 629 | $orderExists = (empty($order)) ? false : true; |
| 630 | - $this->plugin->klarnaLog("Shopware_Controllers_Frontend_PaymentKlarna::checkKlarnaOrderExistsByReservation:",3); |
|
| 631 | - if ($orderExists){ |
|
| 632 | - $this->plugin->klarnaLog("Shopware_Controllers_Frontend_PaymentKlarna::checkKlarnaOrderExistsByReservation: Order Found: ",3, $order); |
|
| 630 | + $this->plugin->klarnaLog("Shopware_Controllers_Frontend_PaymentKlarna::checkKlarnaOrderExistsByReservation:", 3); |
|
| 631 | + if ($orderExists) { |
|
| 632 | + $this->plugin->klarnaLog("Shopware_Controllers_Frontend_PaymentKlarna::checkKlarnaOrderExistsByReservation: Order Found: ", 3, $order); |
|
| 633 | 633 | } |
| 634 | 634 | return $orderExists; |
| 635 | 635 | } |
@@ -678,9 +678,9 @@ discard block |
||
| 678 | 678 | )); |
| 679 | 679 | |
| 680 | 680 | $orderExists = (empty($orderDetails)) ? false : true; |
| 681 | - $this->plugin->klarnaLog("Shopware_Controllers_Frontend_PaymentKlarna::checkKlarnaOrderDetailsBySession:",3); |
|
| 682 | - if ($orderExists){ |
|
| 683 | - $this->plugin->klarnaLog("Shopware_Controllers_Frontend_PaymentKlarna::checkKlarnaOrderDetailsBySession: OrderDetails Found: ",3, $orderDetails); |
|
| 681 | + $this->plugin->klarnaLog("Shopware_Controllers_Frontend_PaymentKlarna::checkKlarnaOrderDetailsBySession:", 3); |
|
| 682 | + if ($orderExists) { |
|
| 683 | + $this->plugin->klarnaLog("Shopware_Controllers_Frontend_PaymentKlarna::checkKlarnaOrderDetailsBySession: OrderDetails Found: ", 3, $orderDetails); |
|
| 684 | 684 | } |
| 685 | 685 | return $orderExists; |
| 686 | 686 | } |
@@ -760,22 +760,22 @@ discard block |
||
| 760 | 760 | { |
| 761 | 761 | $transactionId = $this->Request()->getParam('transactionId'); |
| 762 | 762 | |
| 763 | - $this->plugin->klarnaLog("Shopware_Controllers_Frontend_PaymentKlarna::pushAction->transactionId:\n".$transactionId,3); |
|
| 763 | + $this->plugin->klarnaLog("Shopware_Controllers_Frontend_PaymentKlarna::pushAction->transactionId:\n".$transactionId, 3); |
|
| 764 | 764 | $connector = $this->plugin->getConnector(); |
| 765 | 765 | $order = new Klarna_Checkout_Order($connector, $transactionId); |
| 766 | 766 | $order->fetch(); |
| 767 | - $this->plugin->klarnaLog("Shopware_Controllers_Frontend_PaymentKlarna::pushAction->order:",4, $order); |
|
| 767 | + $this->plugin->klarnaLog("Shopware_Controllers_Frontend_PaymentKlarna::pushAction->order:", 4, $order); |
|
| 768 | 768 | |
| 769 | 769 | $userId = $this->getUserIdByReference($order['reference']); |
| 770 | - $this->plugin->klarnaLog("Shopware_Controllers_Frontend_PaymentKlarna::pushAction->UserID: " .$userId ,3); |
|
| 770 | + $this->plugin->klarnaLog("Shopware_Controllers_Frontend_PaymentKlarna::pushAction->UserID: ".$userId, 3); |
|
| 771 | 771 | // before continuing its mandatory to check if order has been persisted |
| 772 | 772 | $orderExists = $this->checkKlarnaOrderExists($order['reservation'], $order['reference'], $userId); |
| 773 | 773 | if (!$orderExists) { |
| 774 | 774 | /** |
| 775 | 775 | * @todo: Adding mechanism so that cancel signal will be send to klarna, if push notifications are over the limit of about 2 calls |
| 776 | 776 | */ |
| 777 | - $this->plugin->klarnaLog("Shopware_Controllers_Frontend_PaymentKlarna::pushAction: checkout_complete. Order was not persisted in DB, UserId is" .$userId ,1); |
|
| 778 | - $this->plugin->klarnaLog("Shopware_Controllers_Frontend_PaymentKlarna::pushAction: checkout_complete. Searching for Order:",1); |
|
| 777 | + $this->plugin->klarnaLog("Shopware_Controllers_Frontend_PaymentKlarna::pushAction: checkout_complete. Order was not persisted in DB, UserId is".$userId, 1); |
|
| 778 | + $this->plugin->klarnaLog("Shopware_Controllers_Frontend_PaymentKlarna::pushAction: checkout_complete. Searching for Order:", 1); |
|
| 779 | 779 | $this->checkKlarnaOrderExistsByReservation($order['reservation']); |
| 780 | 780 | $this->checkKlarnaOrderExistsByReference($order['reference']); |
| 781 | 781 | $this->checkKlarnaOrderExistsBySession($userId); |
@@ -785,21 +785,21 @@ discard block |
||
| 785 | 785 | |
| 786 | 786 | $orderNumber = $this->getKlarnaOrderNumber($order['reservation'], $order['reference'], $userId); |
| 787 | 787 | $orderId = $this->getKlarnaOrderId($order['reservation'], $order['reference'], $userId); |
| 788 | - $this->plugin->klarnaLog("Shopware_Controllers_Frontend_PaymentKlarna::pushAction: Found Order was found in DB... Sending Update to Klarna: " .$orderNumber,1); |
|
| 788 | + $this->plugin->klarnaLog("Shopware_Controllers_Frontend_PaymentKlarna::pushAction: Found Order was found in DB... Sending Update to Klarna: ".$orderNumber, 1); |
|
| 789 | 789 | |
| 790 | 790 | // Check if Order Username ist false (Klarna Firstname) |
| 791 | 791 | |
| 792 | 792 | $swUser = Shopware()->Models()->getRepository('Shopware\Models\Customer\Customer')->findOneBy( |
| 793 | - array('id' => $userId ) |
|
| 793 | + array('id' => $userId) |
|
| 794 | 794 | ); |
| 795 | 795 | |
| 796 | 796 | $firstName = $swUser->getBilling()->getFirstname(); |
| 797 | 797 | if ($firstName === 'Klarna Firstname') { |
| 798 | - $this->plugin->klarnaLog("Shopware_Controllers_Frontend_PaymentKlarna::pushAction: Found Order with Klarna Firstname, updating from Klarna data: " .$orderNumber,1); |
|
| 798 | + $this->plugin->klarnaLog("Shopware_Controllers_Frontend_PaymentKlarna::pushAction: Found Order with Klarna Firstname, updating from Klarna data: ".$orderNumber, 1); |
|
| 799 | 799 | $data['billing']['salutation'] = $order['billing_address']['title']; |
| 800 | 800 | $data['billing']['firstname'] = $order['billing_address']['given_name']; |
| 801 | 801 | $data['billing']['lastname'] = $order['billing_address']['family_name']; |
| 802 | - $data['billing']['street'] = $order['billing_address']['street_name']." ". $order['billing_address']['street_number']; |
|
| 802 | + $data['billing']['street'] = $order['billing_address']['street_name']." ".$order['billing_address']['street_number']; |
|
| 803 | 803 | $data['billing']['zipcode'] = $order['billing_address']['postal_code']; |
| 804 | 804 | $data['billing']['city'] = $order['billing_address']['city']; |
| 805 | 805 | $data['billing']['birthday'] = $order['customer']['date_of_birth']; |
@@ -808,7 +808,7 @@ discard block |
||
| 808 | 808 | $data['shipping']['salutation'] = $order['shipping_address']['title']; |
| 809 | 809 | $data['shipping']['firstname'] = $order['shipping_address']['given_name']; |
| 810 | 810 | $data['shipping']['lastname'] = $order['shipping_address']['family_name']; |
| 811 | - $data['shipping']['street'] = $order['shipping_address']['street_name']." ". $order['shipping_address']['street_number']; |
|
| 811 | + $data['shipping']['street'] = $order['shipping_address']['street_name']." ".$order['shipping_address']['street_number']; |
|
| 812 | 812 | $data['shipping']['zipcode'] = $order['shipping_address']['postal_code']; |
| 813 | 813 | $data['shipping']['city'] = $order['shipping_address']['city']; |
| 814 | 814 | $data['shipping']['birthday'] = $order['customer']['date_of_birth']; |
@@ -835,16 +835,16 @@ discard block |
||
| 835 | 835 | array($userId, $orderId) |
| 836 | 836 | ); |
| 837 | 837 | $where = array('id='.(int) $orderShippingID); |
| 838 | - Shopware()->Db()->update('s_order_shippingaddress', $data['shipping'], $where); |
|
| 838 | + Shopware()->Db()->update('s_order_shippingaddress', $data['shipping'], $where); |
|
| 839 | 839 | |
| 840 | 840 | $orderBillingID = Shopware()->Db()->fetchOne( |
| 841 | 841 | 'SELECT id FROM s_order_billingaddress WHERE userID = ? AND orderID = ?', |
| 842 | 842 | array($userId, $orderId) |
| 843 | 843 | ); |
| 844 | 844 | $where = array('id='.(int) $orderBillingID); |
| 845 | - Shopware()->Db()->update('s_order_billingaddress', $data['billing'], $where); |
|
| 845 | + Shopware()->Db()->update('s_order_billingaddress', $data['billing'], $where); |
|
| 846 | 846 | |
| 847 | - } else{ |
|
| 847 | + } else { |
|
| 848 | 848 | |
| 849 | 849 | // Append streetnumber to street and unset field for sw 5.1 |
| 850 | 850 | // unset birthday too |
@@ -858,14 +858,14 @@ discard block |
||
| 858 | 858 | array($userId) |
| 859 | 859 | ); |
| 860 | 860 | $where = array('id='.(int) $shippingID); |
| 861 | - Shopware()->Db()->update('s_user_shippingaddress', $data['shipping'], $where); |
|
| 861 | + Shopware()->Db()->update('s_user_shippingaddress', $data['shipping'], $where); |
|
| 862 | 862 | |
| 863 | 863 | $billingID = Shopware()->Db()->fetchOne( |
| 864 | 864 | 'SELECT id FROM s_user_billingaddress WHERE userID = ?', |
| 865 | 865 | array($userId) |
| 866 | 866 | ); |
| 867 | 867 | $where = array('id='.(int) $billingID); |
| 868 | - Shopware()->Db()->update('s_user_billingaddress', $data['billing'], $where); |
|
| 868 | + Shopware()->Db()->update('s_user_billingaddress', $data['billing'], $where); |
|
| 869 | 869 | |
| 870 | 870 | |
| 871 | 871 | // Update Order Addresses |
@@ -875,14 +875,14 @@ discard block |
||
| 875 | 875 | array($userId, $orderId) |
| 876 | 876 | ); |
| 877 | 877 | $where = array('id='.(int) $orderShippingID); |
| 878 | - Shopware()->Db()->update('s_order_shippingaddress', $data['shipping'], $where); |
|
| 878 | + Shopware()->Db()->update('s_order_shippingaddress', $data['shipping'], $where); |
|
| 879 | 879 | |
| 880 | 880 | $orderBillingID = Shopware()->Db()->fetchOne( |
| 881 | 881 | 'SELECT id FROM s_order_billingaddress WHERE userID = ? AND orderID = ?', |
| 882 | 882 | array($userId, $orderId) |
| 883 | 883 | ); |
| 884 | 884 | $where = array('id='.(int) $orderBillingID); |
| 885 | - Shopware()->Db()->update('s_order_billingaddress', $data['billing'], $where); |
|
| 885 | + Shopware()->Db()->update('s_order_billingaddress', $data['billing'], $where); |
|
| 886 | 886 | |
| 887 | 887 | } |
| 888 | 888 | } |
@@ -893,7 +893,7 @@ discard block |
||
| 893 | 893 | 'orderid1' => (string) $orderNumber, |
| 894 | 894 | 'orderid2' => (string) $order['reference'] |
| 895 | 895 | ); |
| 896 | - $this->plugin->klarnaLog("Shopware_Controllers_Frontend_PaymentKlarna::pushAction: Update Klarna ",1, $update); |
|
| 896 | + $this->plugin->klarnaLog("Shopware_Controllers_Frontend_PaymentKlarna::pushAction: Update Klarna ", 1, $update); |
|
| 897 | 897 | $order->update($update); |
| 898 | 898 | $this->savePaymentStatus( |
| 899 | 899 | $order['reservation'], |
@@ -915,7 +915,7 @@ discard block |
||
| 915 | 915 | $orderNumber |
| 916 | 916 | )); |
| 917 | 917 | } catch (Exception $e) { |
| 918 | - $this->plugin->klarnaLog("PROBLEM SAVING ORDER ATTRIBUTES AFTER KLARNA PUSH!:\n".$e->getMessage(),1); |
|
| 918 | + $this->plugin->klarnaLog("PROBLEM SAVING ORDER ATTRIBUTES AFTER KLARNA PUSH!:\n".$e->getMessage(), 1); |
|
| 919 | 919 | } |
| 920 | 920 | } |
| 921 | 921 | |
@@ -1603,10 +1603,10 @@ discard block |
||
| 1603 | 1603 | } |
| 1604 | 1604 | |
| 1605 | 1605 | if (Shopware::VERSION === '___VERSION___' || version_compare(Shopware::VERSION, '5.2.0', '>=')) { |
| 1606 | - if ( isset($user['additional']['user']['birthday']) && $user['additional']['user']['birthday'] !== "0000-00-00") { |
|
| 1607 | - $user['billingaddress']['birthday'] = $user['additional']['user']['birthday']; |
|
| 1608 | - $user['birthday'] = $user['additional']['user']['birthday']; |
|
| 1609 | - } |
|
| 1606 | + if ( isset($user['additional']['user']['birthday']) && $user['additional']['user']['birthday'] !== "0000-00-00") { |
|
| 1607 | + $user['billingaddress']['birthday'] = $user['additional']['user']['birthday']; |
|
| 1608 | + $user['birthday'] = $user['additional']['user']['birthday']; |
|
| 1609 | + } |
|
| 1610 | 1610 | } |
| 1611 | 1611 | if ( !isset($user['billingaddress']['phone'])) { |
| 1612 | 1612 | $user['billingaddress']['phone'] = " "; |
@@ -1638,7 +1638,7 @@ discard block |
||
| 1638 | 1638 | $locale = 'de-at'; |
| 1639 | 1639 | } elseif ($create['purchase_country'] == 'DE') |
| 1640 | 1640 | { |
| 1641 | - $locale = 'de-de'; |
|
| 1641 | + $locale = 'de-de'; |
|
| 1642 | 1642 | } else { |
| 1643 | 1643 | $locale = $this->getLocale(false, $create['purchase_country']); |
| 1644 | 1644 | } |
@@ -1869,7 +1869,7 @@ discard block |
||
| 1869 | 1869 | $userData['billingaddress']['country'] =$country; |
| 1870 | 1870 | $userData['shippingaddress']['countryID'] = $session['sChangedCountry']; |
| 1871 | 1871 | $userData['billingaddress']['countryID'] = $session['sChangedCountry']; |
| 1872 | - } |
|
| 1872 | + } |
|
| 1873 | 1873 | |
| 1874 | 1874 | $orderVariables['sUserData'] = $userData; |
| 1875 | 1875 | } |
@@ -2859,13 +2859,13 @@ discard block |
||
| 2859 | 2859 | } else { |
| 2860 | 2860 | $url = $front->Router()->assemble(array('controller' => 'index', 'module' => 'frontend')); |
| 2861 | 2861 | } |
| 2862 | - if (version_compare(Shopware::VERSION, '5.2.0', '>=')) { |
|
| 2863 | - # make sure me get only the image name, path is set in case of upgarde from SW.5.1 to 5.2 |
|
| 2864 | - $end = end((explode('/', $media))); |
|
| 2865 | - $media = $url . 'media/image/' . $end; |
|
| 2866 | - } else { |
|
| 2867 | - $media = $url . $media; |
|
| 2868 | - } |
|
| 2862 | + if (version_compare(Shopware::VERSION, '5.2.0', '>=')) { |
|
| 2863 | + # make sure me get only the image name, path is set in case of upgarde from SW.5.1 to 5.2 |
|
| 2864 | + $end = end((explode('/', $media))); |
|
| 2865 | + $media = $url . 'media/image/' . $end; |
|
| 2866 | + } else { |
|
| 2867 | + $media = $url . $media; |
|
| 2868 | + } |
|
| 2869 | 2869 | } |
| 2870 | 2870 | |
| 2871 | 2871 | 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 | |
@@ -438,8 +438,8 @@ discard block |
||
| 438 | 438 | |
| 439 | 439 | $klarnaService = $this->getService(); |
| 440 | 440 | |
| 441 | - $klarnaAddrBilling = $this->getKlarnaAddrByRawOrderData($orderDataRaw,'billing'); |
|
| 442 | - $klarnaAddrShipping = $this->getKlarnaAddrByRawOrderData($orderDataRaw,'shipping'); |
|
| 441 | + $klarnaAddrBilling = $this->getKlarnaAddrByRawOrderData($orderDataRaw, 'billing'); |
|
| 442 | + $klarnaAddrShipping = $this->getKlarnaAddrByRawOrderData($orderDataRaw, 'shipping'); |
|
| 443 | 443 | |
| 444 | 444 | $transactionId = $orderDataRaw['transactionId']; |
| 445 | 445 | $klarnaOrderId = $orderDataRaw['temporaryId']; |
@@ -581,7 +581,7 @@ discard block |
||
| 581 | 581 | { |
| 582 | 582 | $this->Application()->Loader()->registerNamespace( |
| 583 | 583 | 'Shopware\Components', |
| 584 | - __DIR__ . '/Components/' |
|
| 584 | + __DIR__.'/Components/' |
|
| 585 | 585 | ); |
| 586 | 586 | |
| 587 | 587 | return new StreetSplitService(); |
@@ -595,27 +595,27 @@ discard block |
||
| 595 | 595 | * @param mixed $mPrintableElement |
| 596 | 596 | * @return void |
| 597 | 597 | */ |
| 598 | - public function klarnaLog($message, $logLevelMessage=1, $mPrintableElement=null) { |
|
| 598 | + public function klarnaLog($message, $logLevelMessage = 1, $mPrintableElement = null) { |
|
| 599 | 599 | $configname = 'klarnaLogLevel'; |
| 600 | 600 | $elementId = Shopware()->Db()->fetchOne('SELECT id FROM s_core_config_elements WHERE name = ?', [$configname]); |
| 601 | 601 | $logLevelConfigSetting = Shopware()->Db()->fetchOne('SELECT value FROM s_core_config_values WHERE element_id = ?', [$elementId]); |
| 602 | 602 | $logLevelConfigSetting = unserialize($logLevelConfigSetting); |
| 603 | - $logLevelSetting = (is_numeric($logLevelConfigSetting) && $logLevelConfigSetting >=0 && $logLevelConfigSetting <=4) ? (int)$logLevelConfigSetting : 1; |
|
| 603 | + $logLevelSetting = (is_numeric($logLevelConfigSetting) && $logLevelConfigSetting >= 0 && $logLevelConfigSetting <= 4) ? (int) $logLevelConfigSetting : 1; |
|
| 604 | 604 | |
| 605 | 605 | if ($logLevelMessage <= $logLevelSetting) { |
| 606 | 606 | $prefix = "[".date('Y-m-d H:i:s')."] "; |
| 607 | 607 | $debugBacktrace = ''; |
| 608 | 608 | if ($logLevelSetting >= 4) { |
| 609 | - $debugBacktrace = print_r(debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS),true); |
|
| 609 | + $debugBacktrace = print_r(debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS), true); |
|
| 610 | 610 | } |
| 611 | 611 | $sPrintableElementMessage = ''; |
| 612 | 612 | if ($mPrintableElement !== null) { |
| 613 | - $sPrintableElementMessage = print_r($mPrintableElement,true); |
|
| 613 | + $sPrintableElementMessage = print_r($mPrintableElement, true); |
|
| 614 | 614 | } |
| 615 | 615 | $fullMessage = $prefix.$message."\n".$sPrintableElementMessage.$debugBacktrace; |
| 616 | 616 | $shopPath = Shopware()->DocPath(); |
| 617 | 617 | $logfilePath = $shopPath.'/var/log/klarnaTrace.log'; |
| 618 | - $fileHandler = fopen($logfilePath,'a'); |
|
| 618 | + $fileHandler = fopen($logfilePath, 'a'); |
|
| 619 | 619 | fwrite($fileHandler, $fullMessage); |
| 620 | 620 | fclose($fileHandler); |
| 621 | 621 | } |
@@ -641,7 +641,7 @@ discard block |
||
| 641 | 641 | $country = $repository->findOneBy(array('id' => $baseData['countryId'])); |
| 642 | 642 | $countryiso = $country->getIso(); |
| 643 | 643 | |
| 644 | - $klarnaAddr = new KlarnaAddr(); |
|
| 644 | + $klarnaAddr = new KlarnaAddr(); |
|
| 645 | 645 | $klarnaAddr->setEmail($orderDataRaw['customerEmail']); |
| 646 | 646 | $klarnaAddr->setFirstName($baseData['firstName']); |
| 647 | 647 | $klarnaAddr->setLastName($baseData['lastName']); |
@@ -656,7 +656,7 @@ discard block |
||
| 656 | 656 | $klarnaAddr->setCountry($countryiso); |
| 657 | 657 | } |
| 658 | 658 | |
| 659 | - $this->klarnaLog('Update order address from backend with following address data:',3,$klarnaAddr); |
|
| 659 | + $this->klarnaLog('Update order address from backend with following address data:', 3, $klarnaAddr); |
|
| 660 | 660 | return $klarnaAddr; |
| 661 | 661 | } |
| 662 | 662 | |
@@ -684,10 +684,10 @@ discard block |
||
| 684 | 684 | if ($index == count($addressParts) || $houseNumberFound) { |
| 685 | 685 | // at least last element should be streetnr |
| 686 | 686 | if (!empty($streetnr)) $streetnr .= ' '; |
| 687 | - $streetnr .= (string)$addressPart; |
|
| 687 | + $streetnr .= (string) $addressPart; |
|
| 688 | 688 | } |
| 689 | - else { |
|
| 690 | - $street .= (string)' '.$addressPart; |
|
| 689 | + else { |
|
| 690 | + $street .= (string) ' '.$addressPart; |
|
| 691 | 691 | } |
| 692 | 692 | } |
| 693 | 693 | |
@@ -1304,11 +1304,11 @@ discard block |
||
| 1304 | 1304 | protected function registerMyTemplateDir($isBackend = false) |
| 1305 | 1305 | { |
| 1306 | 1306 | if ($isBackend) { |
| 1307 | - $this->get('template')->addTemplateDir(__DIR__ . '/Views/', 'klarna'); |
|
| 1307 | + $this->get('template')->addTemplateDir(__DIR__.'/Views/', 'klarna'); |
|
| 1308 | 1308 | } elseif ($this->isTemplateResponsive()) { |
| 1309 | - $this->get('template')->addTemplateDir(__DIR__ . '/Views/responsive', 'klarna'); |
|
| 1309 | + $this->get('template')->addTemplateDir(__DIR__.'/Views/responsive', 'klarna'); |
|
| 1310 | 1310 | } else { |
| 1311 | - $this->get('template')->addTemplateDir(__DIR__ . '/Views/_emotion', 'klarna'); |
|
| 1311 | + $this->get('template')->addTemplateDir(__DIR__.'/Views/_emotion', 'klarna'); |
|
| 1312 | 1312 | } |
| 1313 | 1313 | } |
| 1314 | 1314 | |
@@ -1336,7 +1336,7 @@ discard block |
||
| 1336 | 1336 | { |
| 1337 | 1337 | $this->registerMyTemplateDir(); |
| 1338 | 1338 | |
| 1339 | - return __DIR__ . '/Controllers/Frontend/PaymentKlarna.php'; |
|
| 1339 | + return __DIR__.'/Controllers/Frontend/PaymentKlarna.php'; |
|
| 1340 | 1340 | } |
| 1341 | 1341 | |
| 1342 | 1342 | /** |
@@ -1348,10 +1348,10 @@ discard block |
||
| 1348 | 1348 | { |
| 1349 | 1349 | $this->registerMyTemplateDir(true); |
| 1350 | 1350 | $this->Application()->Snippets()->addConfigDir( |
| 1351 | - __DIR__ . '/Snippets/' |
|
| 1351 | + __DIR__.'/Snippets/' |
|
| 1352 | 1352 | ); |
| 1353 | 1353 | |
| 1354 | - return __DIR__ . '/Controllers/Backend/PaymentKlarna.php'; |
|
| 1354 | + return __DIR__.'/Controllers/Backend/PaymentKlarna.php'; |
|
| 1355 | 1355 | } |
| 1356 | 1356 | |
| 1357 | 1357 | /** |
@@ -1383,7 +1383,7 @@ discard block |
||
| 1383 | 1383 | $controllerName = $request->getControllerName(); |
| 1384 | 1384 | $actionName = $request->getActionName(); |
| 1385 | 1385 | $fromScope = $request->get('fromScope'); |
| 1386 | - $isFromKCO = (bool)($fromScope == 'klarna_checkout'); |
|
| 1386 | + $isFromKCO = (bool) ($fromScope == 'klarna_checkout'); |
|
| 1387 | 1387 | |
| 1388 | 1388 | $session = $this->get('session'); |
| 1389 | 1389 | |
@@ -1394,9 +1394,9 @@ discard block |
||
| 1394 | 1394 | $action->redirect(array('controller' => 'payment_klarna', 'action' => 'otherPayment')); |
| 1395 | 1395 | return; |
| 1396 | 1396 | } |
| 1397 | - if ($shopCountryId !== (int) $postedCountry){ |
|
| 1398 | - if ($this->isKlarnaUser()){ |
|
| 1399 | - if ($postedCountry == '23'){ |
|
| 1397 | + if ($shopCountryId !== (int) $postedCountry) { |
|
| 1398 | + if ($this->isKlarnaUser()) { |
|
| 1399 | + if ($postedCountry == '23') { |
|
| 1400 | 1400 | $session['sCountry'] = '23'; |
| 1401 | 1401 | |
| 1402 | 1402 | } else { |
@@ -1421,7 +1421,7 @@ discard block |
||
| 1421 | 1421 | if ($request->getControllerName() == 'checkout' |
| 1422 | 1422 | && ($request->getActionName() == 'cart' || $request->getActionName() == 'ajaxCart') |
| 1423 | 1423 | ) { |
| 1424 | - $view->assign('KlarnaEnableButton', (bool)$config->get('showKlarnaButton')); |
|
| 1424 | + $view->assign('KlarnaEnableButton', (bool) $config->get('showKlarnaButton')); |
|
| 1425 | 1425 | $view->assign('KlarnaShowCheckoutButton', $this->getShowCheckoutButton($user)); |
| 1426 | 1426 | $view->assign('klarnaKcoPaymentActive', $this->isKlarnaKcoPaymentActive($user)); |
| 1427 | 1427 | $view->assign('KlarnaPaymentDescription', $this->getPayment()->getDescription()); |
@@ -1466,7 +1466,7 @@ discard block |
||
| 1466 | 1466 | $view->assign('KlarnaLocale', $this->getLocale()); |
| 1467 | 1467 | $view->assign('KlarnaMerchantId', $config->get('merchantId')); |
| 1468 | 1468 | $view->assign('KlarnaHideCheckoutSteps', true); |
| 1469 | - if (version_compare(Shopware::VERSION, '5.2.0', '<')){ |
|
| 1469 | + if (version_compare(Shopware::VERSION, '5.2.0', '<')) { |
|
| 1470 | 1470 | $view->assign('KlarnaSkipLoginFix', true); |
| 1471 | 1471 | } |
| 1472 | 1472 | if (!$this->isTemplateResponsive()) { |
@@ -1560,12 +1560,12 @@ discard block |
||
| 1560 | 1560 | $update = array(); |
| 1561 | 1561 | $update['cart']['items'] = $this->getCheckoutCart($basket); |
| 1562 | 1562 | $update['options'] = $this->getCheckoutOptions($allowPackstation, $view->sDispatch); |
| 1563 | - if ($request->get('klarnaPreFill') == "on"){ |
|
| 1563 | + if ($request->get('klarnaPreFill') == "on") { |
|
| 1564 | 1564 | $update['customer'] = $this->getCheckoutCustomer($user); |
| 1565 | - if ( !isset($user['billingaddress']['phone'])) { |
|
| 1565 | + if (!isset($user['billingaddress']['phone'])) { |
|
| 1566 | 1566 | $user['billingaddress']['phone'] = " "; |
| 1567 | 1567 | } |
| 1568 | - if ( !isset($user['shippinggaddress']['phone'])) { |
|
| 1568 | + if (!isset($user['shippinggaddress']['phone'])) { |
|
| 1569 | 1569 | $user['shippingaddress']['phone'] = " "; |
| 1570 | 1570 | } |
| 1571 | 1571 | if ($user['additional']['countryShipping']['id'] == $user['additional']['country']['id']) { |
@@ -1603,12 +1603,12 @@ discard block |
||
| 1603 | 1603 | } |
| 1604 | 1604 | |
| 1605 | 1605 | if (Shopware::VERSION === '___VERSION___' || version_compare(Shopware::VERSION, '5.2.0', '>=')) { |
| 1606 | - if ( isset($user['additional']['user']['birthday']) && $user['additional']['user']['birthday'] !== "0000-00-00") { |
|
| 1606 | + if (isset($user['additional']['user']['birthday']) && $user['additional']['user']['birthday'] !== "0000-00-00") { |
|
| 1607 | 1607 | $user['billingaddress']['birthday'] = $user['additional']['user']['birthday']; |
| 1608 | 1608 | $user['birthday'] = $user['additional']['user']['birthday']; |
| 1609 | 1609 | } |
| 1610 | 1610 | } |
| 1611 | - if ( !isset($user['billingaddress']['phone'])) { |
|
| 1611 | + if (!isset($user['billingaddress']['phone'])) { |
|
| 1612 | 1612 | $user['billingaddress']['phone'] = " "; |
| 1613 | 1613 | } |
| 1614 | 1614 | |
@@ -1735,7 +1735,7 @@ discard block |
||
| 1735 | 1735 | public function addJsFiles() |
| 1736 | 1736 | { |
| 1737 | 1737 | $jsPath = array( |
| 1738 | - __DIR__ . '/Views/responsive/frontend/_public/src/js/jquery.klarna_checkout.js' |
|
| 1738 | + __DIR__.'/Views/responsive/frontend/_public/src/js/jquery.klarna_checkout.js' |
|
| 1739 | 1739 | ); |
| 1740 | 1740 | |
| 1741 | 1741 | return new Doctrine\Common\Collections\ArrayCollection($jsPath); |
@@ -1776,7 +1776,7 @@ discard block |
||
| 1776 | 1776 | } catch (Exception $e) { |
| 1777 | 1777 | Shopware()->Plugins()->Controller()->ViewRenderer()->setNoRender(); |
| 1778 | 1778 | echo "Entschuldigung, Ein Verbindungsfehler ist aufgetreten, bitte aktualisieren Sie die Seite"; |
| 1779 | - $this->klarnaLog("Verbindungsfehler in onPreDispatchCheckout\nCode:".$e->getCode()."Nachricht:\n".$e->getMessage(),1); |
|
| 1779 | + $this->klarnaLog("Verbindungsfehler in onPreDispatchCheckout\nCode:".$e->getCode()."Nachricht:\n".$e->getMessage(), 1); |
|
| 1780 | 1780 | } |
| 1781 | 1781 | |
| 1782 | 1782 | if ($order['status'] != 'created' && $order['status'] != 'checkout_complete') { |
@@ -1791,7 +1791,7 @@ discard block |
||
| 1791 | 1791 | |
| 1792 | 1792 | try { |
| 1793 | 1793 | $data['status'] = 'created'; |
| 1794 | - $this->klarnaLog("onPreDispatchCheckout: Trying to update order to klarna with state created with following data:",4, $data); |
|
| 1794 | + $this->klarnaLog("onPreDispatchCheckout: Trying to update order to klarna with state created with following data:", 4, $data); |
|
| 1795 | 1795 | $order->update($data); |
| 1796 | 1796 | } catch (Klarna_Checkout_ConnectionErrorException $e) { |
| 1797 | 1797 | $view->assign('KlarnaConnectionError', json_decode($e->getMessage(), true)); |
@@ -1858,15 +1858,15 @@ discard block |
||
| 1858 | 1858 | $userData['additional'] |
| 1859 | 1859 | ); |
| 1860 | 1860 | |
| 1861 | - if (isset($session['sChangedCountry'])){ |
|
| 1861 | + if (isset($session['sChangedCountry'])) { |
|
| 1862 | 1862 | |
| 1863 | 1863 | /** @var \Shopware\Components\Model\ModelManager $em */ |
| 1864 | 1864 | $em = $this->get('models'); |
| 1865 | 1865 | |
| 1866 | 1866 | /** @var \Shopware\Models\Customer\Customer $customer */ |
| 1867 | 1867 | $country = $em->getRepository('Shopware\Models\Country\Country')->findOneBy(array('id' => $session['sChangedCountry'])); |
| 1868 | - $userData['shippingaddress']['country'] =$country; |
|
| 1869 | - $userData['billingaddress']['country'] =$country; |
|
| 1868 | + $userData['shippingaddress']['country'] = $country; |
|
| 1869 | + $userData['billingaddress']['country'] = $country; |
|
| 1870 | 1870 | $userData['shippingaddress']['countryID'] = $session['sChangedCountry']; |
| 1871 | 1871 | $userData['billingaddress']['countryID'] = $session['sChangedCountry']; |
| 1872 | 1872 | } |
@@ -1884,10 +1884,10 @@ discard block |
||
| 1884 | 1884 | $this->klarnaLog("Entering Bootstrap::getCountryByShop", 3); |
| 1885 | 1885 | $locale = explode('_', $locale); |
| 1886 | 1886 | $locale = isset($locale[1]) ? $locale[1] : $locale[0]; |
| 1887 | - $this->klarnaLog("Bootstrap::getCountryByShop locale to request for:".$locale,3); |
|
| 1887 | + $this->klarnaLog("Bootstrap::getCountryByShop locale to request for:".$locale, 3); |
|
| 1888 | 1888 | $sql = 'SELECT id FROM s_core_countries WHERE countryiso=?'; |
| 1889 | 1889 | $countryId = Shopware()->Db()->fetchOne($sql, array($locale)); |
| 1890 | - $countryId = ($countryId) ? (int)$countryId : null; |
|
| 1890 | + $countryId = ($countryId) ? (int) $countryId : null; |
|
| 1891 | 1891 | |
| 1892 | 1892 | return $countryId; |
| 1893 | 1893 | } |
@@ -1918,7 +1918,7 @@ discard block |
||
| 1918 | 1918 | $locale = $locale == 'nn-no' ? 'nb-no' : $locale; |
| 1919 | 1919 | |
| 1920 | 1920 | if ($locale == 'de-de') { |
| 1921 | - if($countryIso == 'CH') { |
|
| 1921 | + if ($countryIso == 'CH') { |
|
| 1922 | 1922 | $locale = 'de-ch'; |
| 1923 | 1923 | } elseif ($countryIso == 'AT') { |
| 1924 | 1924 | $locale = 'de-at'; |
@@ -1933,10 +1933,10 @@ discard block |
||
| 1933 | 1933 | $config = $this->Config(); |
| 1934 | 1934 | $options = $this->getColorConfigOptions($config); |
| 1935 | 1935 | |
| 1936 | - $options['allow_separate_shipping_address'] = (bool)$config->get('allowSeparateShippingAddress'); |
|
| 1937 | - $options['packstation_enabled'] = (bool)$config->get('supportPackstation') && $allowPackstation; |
|
| 1938 | - $options['phone_mandatory'] = (bool)$config->get('mandatoryPhone'); |
|
| 1939 | - $options['date_of_birth_mandatory'] = (bool)$config->get('mandatoryBirthday'); |
|
| 1936 | + $options['allow_separate_shipping_address'] = (bool) $config->get('allowSeparateShippingAddress'); |
|
| 1937 | + $options['packstation_enabled'] = (bool) $config->get('supportPackstation') && $allowPackstation; |
|
| 1938 | + $options['phone_mandatory'] = (bool) $config->get('mandatoryPhone'); |
|
| 1939 | + $options['date_of_birth_mandatory'] = (bool) $config->get('mandatoryBirthday'); |
|
| 1940 | 1940 | |
| 1941 | 1941 | if (!empty($dispatch)) { |
| 1942 | 1942 | $options['shipping_details'] = $dispatch['description']; |
@@ -1951,19 +1951,19 @@ discard block |
||
| 1951 | 1951 | foreach ($basket['content'] as $index=>$basketItem) { |
| 1952 | 1952 | // compatibility to shopware plugin custom products |
| 1953 | 1953 | if (isset($basketItem['custom_product_prices'])) { |
| 1954 | - $basketItemPrice = (double)$basketItem['custom_product_prices']['total']; |
|
| 1954 | + $basketItemPrice = (double) $basketItem['custom_product_prices']['total']; |
|
| 1955 | 1955 | } |
| 1956 | 1956 | else { |
| 1957 | - $basketItemPrice = (double)str_replace(',', '.', $basketItem['price']); |
|
| 1957 | + $basketItemPrice = (double) str_replace(',', '.', $basketItem['price']); |
|
| 1958 | 1958 | } |
| 1959 | 1959 | $unitPrice = round($basketItemPrice * 100); |
| 1960 | 1960 | $cart[] = array( |
| 1961 | 1961 | 'type' => $unitPrice >= 0 ? 'physical' : 'discount', |
| 1962 | 1962 | 'reference' => $basketItem['ordernumber'], |
| 1963 | 1963 | 'name' => $basketItem['articlename'], |
| 1964 | - 'quantity' => (int)$basketItem['quantity'], |
|
| 1965 | - 'unit_price' => (int)$unitPrice, |
|
| 1966 | - 'tax_rate' => (int)round($basketItem['tax_rate'] * 100) |
|
| 1964 | + 'quantity' => (int) $basketItem['quantity'], |
|
| 1965 | + 'unit_price' => (int) $unitPrice, |
|
| 1966 | + 'tax_rate' => (int) round($basketItem['tax_rate'] * 100) |
|
| 1967 | 1967 | ); |
| 1968 | 1968 | } |
| 1969 | 1969 | if (!empty($basket['sShippingcosts'])) { |
@@ -1974,8 +1974,8 @@ discard block |
||
| 1974 | 1974 | 'reference' => 'SHIPPING', |
| 1975 | 1975 | 'name' => 'Shipping Fee', |
| 1976 | 1976 | 'quantity' => 1, |
| 1977 | - 'unit_price' => (int)round($shippingAmount * 100), |
|
| 1978 | - 'tax_rate' => (int)round($basket['sShippingcostsTax'] * 100), |
|
| 1977 | + 'unit_price' => (int) round($shippingAmount * 100), |
|
| 1978 | + 'tax_rate' => (int) round($basket['sShippingcostsTax'] * 100), |
|
| 1979 | 1979 | ); |
| 1980 | 1980 | } |
| 1981 | 1981 | |
@@ -2006,7 +2006,7 @@ discard block |
||
| 2006 | 2006 | 'action' => 'return', |
| 2007 | 2007 | 'forceSecure' => true |
| 2008 | 2008 | ) |
| 2009 | - ) . "?transactionId={checkout.order.uri}"; |
|
| 2009 | + )."?transactionId={checkout.order.uri}"; |
|
| 2010 | 2010 | $merchant['push_uri'] = $router->assemble( |
| 2011 | 2011 | array( |
| 2012 | 2012 | 'controller' => 'payment_klarna', |
@@ -2014,7 +2014,7 @@ discard block |
||
| 2014 | 2014 | 'forceSecure' => true, |
| 2015 | 2015 | 'appendSession' => true |
| 2016 | 2016 | ) |
| 2017 | - ) . "&transactionId={checkout.order.uri}"; |
|
| 2017 | + )."&transactionId={checkout.order.uri}"; |
|
| 2018 | 2018 | $merchant['back_to_store_uri'] = $router->assemble( |
| 2019 | 2019 | array( |
| 2020 | 2020 | 'controller' => 'index', |
@@ -2027,36 +2027,36 @@ discard block |
||
| 2027 | 2027 | |
| 2028 | 2028 | public function getCheckoutAddress($user, $type = 'billing') |
| 2029 | 2029 | { |
| 2030 | - if (empty($user[$type . 'address']['zipcode']) || $user[$type . 'address']['zipcode'] == '00000') { |
|
| 2030 | + if (empty($user[$type.'address']['zipcode']) || $user[$type.'address']['zipcode'] == '00000') { |
|
| 2031 | 2031 | return array(); |
| 2032 | 2032 | } |
| 2033 | 2033 | |
| 2034 | 2034 | $address = array( |
| 2035 | - 'given_name' => $user[$type . 'address']['firstname'], |
|
| 2036 | - 'family_name' => $user[$type . 'address']['lastname'], |
|
| 2037 | - 'postal_code' => $user[$type . 'address']['zipcode'], |
|
| 2038 | - 'city' => $user[$type . 'address']['city'], |
|
| 2035 | + 'given_name' => $user[$type.'address']['firstname'], |
|
| 2036 | + 'family_name' => $user[$type.'address']['lastname'], |
|
| 2037 | + 'postal_code' => $user[$type.'address']['zipcode'], |
|
| 2038 | + 'city' => $user[$type.'address']['city'], |
|
| 2039 | 2039 | 'country' => $user['additional'][$type == 'billing' ? 'country' : 'countryShipping']['countryiso'], |
| 2040 | 2040 | 'email' => $user['additional']['user']['email'], |
| 2041 | 2041 | 'phone' => $user['billingaddress']['phone'], |
| 2042 | 2042 | ); |
| 2043 | 2043 | $address['country'] = strtolower($address['country']); |
| 2044 | 2044 | if ($address['country'] == 'de' || $address['country'] == 'nl') { |
| 2045 | - $address['title'] = $user[$type . 'address']['salutation'] == 'ms' ? 'Frau' : 'Herr'; |
|
| 2045 | + $address['title'] = $user[$type.'address']['salutation'] == 'ms' ? 'Frau' : 'Herr'; |
|
| 2046 | 2046 | if ($this->assertMinimumVersion('5.0.0')) { |
| 2047 | 2047 | /** @var StreetSplitService $streetSplitService */ |
| 2048 | 2048 | $streetSplitService = Shopware()->StreetSplitService(); |
| 2049 | - $streetAndNumber = $streetSplitService->split($user[$type . 'address']['street']); |
|
| 2049 | + $streetAndNumber = $streetSplitService->split($user[$type.'address']['street']); |
|
| 2050 | 2050 | |
| 2051 | 2051 | $address['street_name'] = $streetAndNumber['streetName']; |
| 2052 | 2052 | $address['street_number'] = $streetAndNumber['streetNumber']; |
| 2053 | 2053 | } else { |
| 2054 | - $address['street_name'] = $user[$type . 'address']['street']; |
|
| 2055 | - $address['street_number'] = $user[$type . 'address']['streetnumber']; |
|
| 2054 | + $address['street_name'] = $user[$type.'address']['street']; |
|
| 2055 | + $address['street_number'] = $user[$type.'address']['streetnumber']; |
|
| 2056 | 2056 | } |
| 2057 | 2057 | } else { |
| 2058 | 2058 | $address['street_address'] = trim( |
| 2059 | - $user[$type . 'address']['street'] . ' ' . $user[$type . 'address']['streetnumber'] |
|
| 2059 | + $user[$type.'address']['street'].' '.$user[$type.'address']['streetnumber'] |
|
| 2060 | 2060 | ); |
| 2061 | 2061 | } |
| 2062 | 2062 | |
@@ -2094,7 +2094,7 @@ discard block |
||
| 2094 | 2094 | */ |
| 2095 | 2095 | public function getVersion() |
| 2096 | 2096 | { |
| 2097 | - $info = json_decode(file_get_contents(__DIR__ . DIRECTORY_SEPARATOR . 'plugin.json'), true); |
|
| 2097 | + $info = json_decode(file_get_contents(__DIR__.DIRECTORY_SEPARATOR.'plugin.json'), true); |
|
| 2098 | 2098 | |
| 2099 | 2099 | if ($info) { |
| 2100 | 2100 | return $info['currentVersion']; |
@@ -2111,7 +2111,7 @@ discard block |
||
| 2111 | 2111 | return array( |
| 2112 | 2112 | 'version' => $this->getVersion(), |
| 2113 | 2113 | 'label' => $this->getLabel(), |
| 2114 | - 'description' => file_get_contents(__DIR__ . '/info.txt') |
|
| 2114 | + 'description' => file_get_contents(__DIR__.'/info.txt') |
|
| 2115 | 2115 | ); |
| 2116 | 2116 | } |
| 2117 | 2117 | |
@@ -2122,7 +2122,7 @@ discard block |
||
| 2122 | 2122 | */ |
| 2123 | 2123 | public function onInitResourceKlarnaCheckoutConnector() |
| 2124 | 2124 | { |
| 2125 | - require_once __DIR__ . '/Components/KlarnaCheckout/Checkout.php'; |
|
| 2125 | + require_once __DIR__.'/Components/KlarnaCheckout/Checkout.php'; |
|
| 2126 | 2126 | if ($this->Config()->get('testDrive')) { |
| 2127 | 2127 | Klarna_Checkout_Order::$baseUri = 'https://checkout.testdrive.klarna.com/checkout/orders'; |
| 2128 | 2128 | } else { |
@@ -2141,8 +2141,8 @@ discard block |
||
| 2141 | 2141 | */ |
| 2142 | 2142 | public function onInitResourceKlarnaService() |
| 2143 | 2143 | { |
| 2144 | - require_once __DIR__ . '/Components/Klarna/Klarna.php'; |
|
| 2145 | - require_once __DIR__ . '/Components/Klarna/transport/xmlrpc-3.0.0.beta/lib/xmlrpc.inc'; |
|
| 2144 | + require_once __DIR__.'/Components/Klarna/Klarna.php'; |
|
| 2145 | + require_once __DIR__.'/Components/Klarna/transport/xmlrpc-3.0.0.beta/lib/xmlrpc.inc'; |
|
| 2146 | 2146 | |
| 2147 | 2147 | $k = new Klarna(); |
| 2148 | 2148 | return $k; |
@@ -2160,7 +2160,7 @@ discard block |
||
| 2160 | 2160 | array(), |
| 2161 | 2161 | //less files to compile |
| 2162 | 2162 | array( |
| 2163 | - __DIR__ . '/Views/responsive/frontend/_public/src/less/all.less' |
|
| 2163 | + __DIR__.'/Views/responsive/frontend/_public/src/less/all.less' |
|
| 2164 | 2164 | ), |
| 2165 | 2165 | //import directory |
| 2166 | 2166 | __DIR__ |
@@ -2246,7 +2246,7 @@ discard block |
||
| 2246 | 2246 | |
| 2247 | 2247 | $salutation = $form['register']['personal']['salutation']; |
| 2248 | 2248 | if (!empty($salutation) && ($countryIso == 'DE' || $countryIso == 'NL')) { |
| 2249 | - $create['shipping_address']['title'] = ($salutation == 'ms' ? 'Frau' : 'Herr');//German names |
|
| 2249 | + $create['shipping_address']['title'] = ($salutation == 'ms' ? 'Frau' : 'Herr'); //German names |
|
| 2250 | 2250 | } |
| 2251 | 2251 | |
| 2252 | 2252 | $billingStreet = $form['register']['billing']['street']; |
@@ -2263,7 +2263,7 @@ discard block |
||
| 2263 | 2263 | $create['shipping_address']['street_number'] = $billingStreetNumber; |
| 2264 | 2264 | } |
| 2265 | 2265 | } else { |
| 2266 | - $create['shipping_address']['street_address'] = $billingStreet . ' ' . $billingStreetNumber; |
|
| 2266 | + $create['shipping_address']['street_address'] = $billingStreet.' '.$billingStreetNumber; |
|
| 2267 | 2267 | } |
| 2268 | 2268 | } |
| 2269 | 2269 | |
@@ -2322,9 +2322,9 @@ discard block |
||
| 2322 | 2322 | $view->assign('sPayments', $this->filterPayments($adminModule->sGetPaymentMeans())); |
| 2323 | 2323 | $view->assign('sCountryList', $adminModule->sGetCountryList()); |
| 2324 | 2324 | $view->assign('KlarnaHideCheckoutSteps', true); |
| 2325 | - $view->assign('KlarnaShowB2bSelect', (bool)$config->get('showB2bSelect')); |
|
| 2326 | - $view->assign('KlarnaShowBasket', (bool)$config->get('showMiniBasket')); |
|
| 2327 | - $view->assign('KlarnaShowDispatch', (bool)$config->get('showDispatch')); |
|
| 2325 | + $view->assign('KlarnaShowB2bSelect', (bool) $config->get('showB2bSelect')); |
|
| 2326 | + $view->assign('KlarnaShowBasket', (bool) $config->get('showMiniBasket')); |
|
| 2327 | + $view->assign('KlarnaShowDispatch', (bool) $config->get('showDispatch')); |
|
| 2328 | 2328 | $view->assign( |
| 2329 | 2329 | 'KlarnaCDNLink', |
| 2330 | 2330 | $this->buildCDNLink() |
@@ -2356,7 +2356,7 @@ discard block |
||
| 2356 | 2356 | */ |
| 2357 | 2357 | private function getShowLoginConfig($config, $lastName) |
| 2358 | 2358 | { |
| 2359 | - return (bool)$config->get('showLoginPanel') && $lastName == 'Klarna Checkout'; |
|
| 2359 | + return (bool) $config->get('showLoginPanel') && $lastName == 'Klarna Checkout'; |
|
| 2360 | 2360 | } |
| 2361 | 2361 | |
| 2362 | 2362 | /** |
@@ -2398,7 +2398,7 @@ discard block |
||
| 2398 | 2398 | $result = Shopware()->Db()->fetchAssoc($sql, array()); |
| 2399 | 2399 | |
| 2400 | 2400 | // Load translations if available |
| 2401 | - $this->countries = array_map(function ($country) { |
|
| 2401 | + $this->countries = array_map(function($country) { |
|
| 2402 | 2402 | $country['id'] = $country['countryId']; |
| 2403 | 2403 | return Shopware()->Modules()->Admin()->sGetCountryTranslation($country); |
| 2404 | 2404 | }, $result); |
@@ -2519,7 +2519,7 @@ discard block |
||
| 2519 | 2519 | 'phone' => $billingAddress['phone'] |
| 2520 | 2520 | ), |
| 2521 | 2521 | 'billing' => array( |
| 2522 | - 'street' => $billingAddress['street_name'] . ' ' . $billingAddress['street_number'], |
|
| 2522 | + 'street' => $billingAddress['street_name'].' '.$billingAddress['street_number'], |
|
| 2523 | 2523 | 'zipcode' => $billingAddress['postal_code'], |
| 2524 | 2524 | 'city' => $billingAddress['city'] |
| 2525 | 2525 | ) |
@@ -2678,7 +2678,7 @@ discard block |
||
| 2678 | 2678 | } |
| 2679 | 2679 | $email = $session->offsetGet('sUserMail'); |
| 2680 | 2680 | $sessionId = $session->offsetGet('sessionId'); |
| 2681 | - if (!preg_match('#.{' . strlen($sessionId) . '}@klarna.com#', $email)) { |
|
| 2681 | + if (!preg_match('#.{'.strlen($sessionId).'}@klarna.com#', $email)) { |
|
| 2682 | 2682 | return false; |
| 2683 | 2683 | } |
| 2684 | 2684 | |
@@ -2764,13 +2764,13 @@ discard block |
||
| 2764 | 2764 | /** @var Shopware\Models\Attribute\Payment $payment */ |
| 2765 | 2765 | foreach ($payments as $payment) { |
| 2766 | 2766 | $paymentObj = $payment->getPayment(); |
| 2767 | - if (is_null($paymentObj)){ |
|
| 2767 | + if (is_null($paymentObj)) { |
|
| 2768 | 2768 | $paymentName = false; |
| 2769 | 2769 | } else { |
| 2770 | 2770 | $paymentName = $paymentObj->getName(); |
| 2771 | 2771 | } |
| 2772 | 2772 | |
| 2773 | - if(!$paymentName){ |
|
| 2773 | + if (!$paymentName) { |
|
| 2774 | 2774 | continue; |
| 2775 | 2775 | } |
| 2776 | 2776 | |
@@ -2779,7 +2779,7 @@ discard block |
||
| 2779 | 2779 | } |
| 2780 | 2780 | $paymentArray = array( |
| 2781 | 2781 | 'name' => $payment->getPayment()->getDescription(), |
| 2782 | - 'redirect_uri' => $this->getRedirectUri() . '/paymentId/' . $payment->getPaymentId() |
|
| 2782 | + 'redirect_uri' => $this->getRedirectUri().'/paymentId/'.$payment->getPaymentId() |
|
| 2783 | 2783 | ); |
| 2784 | 2784 | |
| 2785 | 2785 | if ($fee = $this->getFee($payment->getPayment(), $basket)) { |
@@ -2790,7 +2790,7 @@ discard block |
||
| 2790 | 2790 | //Shorten the description to max. 500 characters |
| 2791 | 2791 | $description = strip_tags($description); |
| 2792 | 2792 | $description = preg_replace('#<!--.*-->#ms', '', $description); |
| 2793 | - $paymentArray['description'] = substr($description, 0, 497) . '...'; |
|
| 2793 | + $paymentArray['description'] = substr($description, 0, 497).'...'; |
|
| 2794 | 2794 | } |
| 2795 | 2795 | |
| 2796 | 2796 | //Only add to external checkouts if an image is set and if the shop supports SSL |
@@ -2848,23 +2848,23 @@ discard block |
||
| 2848 | 2848 | { |
| 2849 | 2849 | $media = $payment->getSwagKlarnaKlarnaMedia(); |
| 2850 | 2850 | if (!$payment->getSwagKlarnaShowInKlarnaIframe() || !empty($media)) { |
| 2851 | - if ($this->assertMinimumVersion('5.1') && version_compare(Shopware::VERSION, '5.2.0', '<=') ) { |
|
| 2851 | + if ($this->assertMinimumVersion('5.1') && version_compare(Shopware::VERSION, '5.2.0', '<=')) { |
|
| 2852 | 2852 | $media = $this->get('shopware_media.media_service')->getUrl($media); |
| 2853 | 2853 | } else { |
| 2854 | 2854 | /** @var Enlight_Controller_Front $front */ |
| 2855 | 2855 | $front = $this->get('front'); |
| 2856 | 2856 | $request = $front->Request(); |
| 2857 | 2857 | if ($request && $request->getHttpHost()) { |
| 2858 | - $url = ($request->isSecure() ? 'https' : 'http') . '://' . $request->getHttpHost() . $request->getBasePath() . "/"; |
|
| 2858 | + $url = ($request->isSecure() ? 'https' : 'http').'://'.$request->getHttpHost().$request->getBasePath()."/"; |
|
| 2859 | 2859 | } else { |
| 2860 | 2860 | $url = $front->Router()->assemble(array('controller' => 'index', 'module' => 'frontend')); |
| 2861 | 2861 | } |
| 2862 | 2862 | if (version_compare(Shopware::VERSION, '5.2.0', '>=')) { |
| 2863 | 2863 | # make sure me get only the image name, path is set in case of upgarde from SW.5.1 to 5.2 |
| 2864 | 2864 | $end = end((explode('/', $media))); |
| 2865 | - $media = $url . 'media/image/' . $end; |
|
| 2865 | + $media = $url.'media/image/'.$end; |
|
| 2866 | 2866 | } else { |
| 2867 | - $media = $url . $media; |
|
| 2867 | + $media = $url.$media; |
|
| 2868 | 2868 | } |
| 2869 | 2869 | } |
| 2870 | 2870 | |
@@ -388,8 +388,7 @@ discard block |
||
| 388 | 388 | 'sAdmin::saveRegisterAction::before', |
| 389 | 389 | 'onBeforeRegister' |
| 390 | 390 | ); |
| 391 | - } |
|
| 392 | - else { |
|
| 391 | + } else { |
|
| 393 | 392 | $this->subscribeEvent( |
| 394 | 393 | 'sAdmin::sSaveRegister::before', |
| 395 | 394 | 'onBeforeRegister' |
@@ -683,10 +682,11 @@ discard block |
||
| 683 | 682 | $index++; |
| 684 | 683 | if ($index == count($addressParts) || $houseNumberFound) { |
| 685 | 684 | // at least last element should be streetnr |
| 686 | - if (!empty($streetnr)) $streetnr .= ' '; |
|
| 685 | + if (!empty($streetnr)) { |
|
| 686 | + $streetnr .= ' '; |
|
| 687 | + } |
|
| 687 | 688 | $streetnr .= (string)$addressPart; |
| 688 | - } |
|
| 689 | - else { |
|
| 689 | + } else { |
|
| 690 | 690 | $street .= (string)' '.$addressPart; |
| 691 | 691 | } |
| 692 | 692 | } |
@@ -1616,8 +1616,7 @@ discard block |
||
| 1616 | 1616 | $session['klarnaPreFill'] = true; |
| 1617 | 1617 | if (empty($session['sCountry'])) { |
| 1618 | 1618 | $countryId = $this->getCountryByShop($shop); |
| 1619 | - } |
|
| 1620 | - else { |
|
| 1619 | + } else { |
|
| 1621 | 1620 | $countryId = $session['sCountry']; |
| 1622 | 1621 | } |
| 1623 | 1622 | if ($user['additional']['countryShipping']['id'] == $countryId |
@@ -1952,8 +1951,7 @@ discard block |
||
| 1952 | 1951 | // compatibility to shopware plugin custom products |
| 1953 | 1952 | if (isset($basketItem['custom_product_prices'])) { |
| 1954 | 1953 | $basketItemPrice = (double)$basketItem['custom_product_prices']['total']; |
| 1955 | - } |
|
| 1956 | - else { |
|
| 1954 | + } else { |
|
| 1957 | 1955 | $basketItemPrice = (double)str_replace(',', '.', $basketItem['price']); |
| 1958 | 1956 | } |
| 1959 | 1957 | $unitPrice = round($basketItemPrice * 100); |