@@ -132,7 +132,7 @@ discard block |
||
132 | 132 | public function showIframeAction() { |
133 | 133 | |
134 | 134 | $this->basket = $this->get('modules')->Basket()->sGetBasket(); |
135 | - $preFill = $this->config['preFillCheckout']; |
|
135 | + $preFill = $this->config['preFillCheckout']; |
|
136 | 136 | if ($this->isUserLoggedIn()){ |
137 | 137 | $user = Shopware()->Modules()->Admin()->sGetUserData(); |
138 | 138 | } |
@@ -283,7 +283,7 @@ discard block |
||
283 | 283 | |
284 | 284 | // Klarna Prefill checkBox |
285 | 285 | if ($this->isUserLoggedIn()) { |
286 | - $this->View()->assign('KlarnaPreFillSelect', !$this->session['klarnaPreFill']); |
|
286 | + $this->View()->assign('KlarnaPreFillSelect', !$this->session['klarnaPreFill']); |
|
287 | 287 | } |
288 | 288 | |
289 | 289 | // Iframe Backend Config |
@@ -403,7 +403,7 @@ discard block |
||
403 | 403 | if ($this->Request()->getParam('sArticle') && $this->Request()->getParam('sQuantity')) { |
404 | 404 | $this->View()->sBasketInfo = $basketObj->sUpdateArticle($this->Request()->getParam('sArticle'), $this->Request()->getParam('sQuantity')); |
405 | 405 | } |
406 | - $this->redirect(['action' => $this->Request()->getParam('sTargetAction', 'showIframe')]); |
|
406 | + $this->redirect(['action' => $this->Request()->getParam('sTargetAction', 'showIframe')]); |
|
407 | 407 | } |
408 | 408 | |
409 | 409 | /** |
@@ -576,7 +576,7 @@ discard block |
||
576 | 576 | return array("id" => $this->session['sState']); |
577 | 577 | } |
578 | 578 | |
579 | - /** |
|
579 | + /** |
|
580 | 580 | * @param Klarna_Checkout_Order $order |
581 | 581 | */ |
582 | 582 | public function createAccount($order = null, $checkLoginState=true) |
@@ -704,8 +704,8 @@ discard block |
||
704 | 704 | } |
705 | 705 | $module->sSYSTEM->_POST = $data['billing']; |
706 | 706 | if (Shopware::VERSION === '___VERSION___' || version_compare(Shopware::VERSION, '5.2.0', '>=')) { |
707 | - $userId = $session->offsetGet('sUserId'); |
|
708 | - $this->updateBilling($userId, $data['billing']); |
|
707 | + $userId = $session->offsetGet('sUserId'); |
|
708 | + $this->updateBilling($userId, $data['billing']); |
|
709 | 709 | } else{ |
710 | 710 | $module->sUpdateBilling(); |
711 | 711 | } |
@@ -817,13 +817,13 @@ discard block |
||
817 | 817 | |
818 | 818 | // get updated password; it is md5 randomized after register |
819 | 819 | $getUser = Shopware()->Models()->getRepository('Shopware\Models\Customer\Customer')->findOneBy( |
820 | - array('email' => $data['auth']['email']) |
|
821 | - ); |
|
820 | + array('email' => $data['auth']['email']) |
|
821 | + ); |
|
822 | 822 | |
823 | - $data['auth']['password']= $getUser->getPassword(); |
|
824 | - $data['auth']['passwordMD5']= $getUser->getPassword(); |
|
825 | - $data['auth']['encoderName'] = 'md5'; |
|
826 | - return $data; |
|
823 | + $data['auth']['password']= $getUser->getPassword(); |
|
824 | + $data['auth']['passwordMD5']= $getUser->getPassword(); |
|
825 | + $data['auth']['encoderName'] = 'md5'; |
|
826 | + return $data; |
|
827 | 827 | } |
828 | 828 | |
829 | 829 | |
@@ -845,19 +845,19 @@ discard block |
||
845 | 845 | unset ($data['billing']); |
846 | 846 | |
847 | 847 | $customer = Shopware()->Models()->getRepository('Shopware\Models\Customer\Customer')->findOneBy( |
848 | - array('id' => $userId) |
|
849 | - ); |
|
848 | + array('id' => $userId) |
|
849 | + ); |
|
850 | 850 | $customer->fromArray($data); |
851 | 851 | Shopware()->Container()->get('shopware_account.customer_service')->update($customer); |
852 | 852 | } |
853 | 853 | |
854 | 854 | |
855 | - /** |
|
856 | - * Updates the shipping address |
|
857 | - * |
|
858 | - * @param int $userId |
|
859 | - * @param array $shippingData |
|
860 | - */ |
|
855 | + /** |
|
856 | + * Updates the shipping address |
|
857 | + * |
|
858 | + * @param int $userId |
|
859 | + * @param array $shippingData |
|
860 | + */ |
|
861 | 861 | private function updateShipping($userId, $shippingData) |
862 | 862 | { |
863 | 863 | /** @var \Shopware\Components\Model\ModelManager $em */ |
@@ -870,7 +870,7 @@ discard block |
||
870 | 870 | $addressold = $customer->getDefaultShippingAddress(); |
871 | 871 | $address = new \Shopware\Models\Customer\Address(); |
872 | 872 | |
873 | - /** @var \Shopware\Models\Country\Country $country */ |
|
873 | + /** @var \Shopware\Models\Country\Country $country */ |
|
874 | 874 | $country = $addressold->getCountry(); |
875 | 875 | $shippingData['country'] = $country; |
876 | 876 | if ($shippingData['phone'] === null) { |
@@ -904,7 +904,7 @@ discard block |
||
904 | 904 | /** @var \Shopware\Models\Customer\Address $address */ |
905 | 905 | $address = $customer->getDefaultBillingAddress(); |
906 | 906 | |
907 | - /** @var \Shopware\Models\Country\Country $country */ |
|
907 | + /** @var \Shopware\Models\Country\Country $country */ |
|
908 | 908 | $country = $address->getCountry(); |
909 | 909 | $billingData['country'] = $country; |
910 | 910 | $address->fromArray($billingData); |
@@ -963,14 +963,14 @@ discard block |
||
963 | 963 | |
964 | 964 | if ($order['status'] == 'checkout_complete') { |
965 | 965 | $this->plugin->klarnaLog("Entering Shopware_Controllers_Frontend_PaymentKlarna::returnAction: checkout_complete. Save oder if session values match.",3); |
966 | - if (Shopware()->Session()->offsetGet('KlarnaTransactionId') == null){ |
|
966 | + if (Shopware()->Session()->offsetGet('KlarnaTransactionId') == null){ |
|
967 | 967 | $this->plugin->klarnaLog("Entering Shopware_Controllers_Frontend_PaymentKlarna::returnAction: Session matches. Order will be saved",3); |
968 | 968 | Shopware()->Session()->offsetSet('KlarnaTransactionId', $transactionId ); |
969 | 969 | $orderNumber = $this->saveOrder( |
970 | 970 | $order['reservation'], |
971 | 971 | $order['reference'] |
972 | 972 | ); |
973 | - Shopware()->Session()->offsetSet('KlarnaTransactionId', null ); |
|
973 | + Shopware()->Session()->offsetSet('KlarnaTransactionId', null ); |
|
974 | 974 | } |
975 | 975 | } |
976 | 976 | |
@@ -1400,7 +1400,7 @@ discard block |
||
1400 | 1400 | |
1401 | 1401 | protected function isUserLoggedIn() |
1402 | 1402 | { |
1403 | - return (isset($this->session->sUserId) && !empty($this->session->sUserId)); |
|
1403 | + return (isset($this->session->sUserId) && !empty($this->session->sUserId)); |
|
1404 | 1404 | } |
1405 | 1405 | |
1406 | 1406 | /** |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | */ |
103 | 103 | public function expressAction() |
104 | 104 | { |
105 | - if (!empty($this->session->PaypalResponse)){ |
|
105 | + if (!empty($this->session->PaypalResponse)) { |
|
106 | 106 | $this->plugin->klarnaLog("Paypal Payment in Progress detected Redirecting To Index Page", 3); |
107 | 107 | $this->redirect( |
108 | 108 | array( |
@@ -114,13 +114,13 @@ discard block |
||
114 | 114 | } |
115 | 115 | |
116 | 116 | if ($this->Request()->getPost('sCountry')) { |
117 | - $this->session['sCountry'] = (int)$this->Request()->getPost('sCountry'); |
|
117 | + $this->session['sCountry'] = (int) $this->Request()->getPost('sCountry'); |
|
118 | 118 | $this->session["sState"] = 0; |
119 | 119 | $this->session["sArea"] = Shopware()->Db()->fetchOne(" |
120 | 120 | SELECT areaID FROM s_core_countries WHERE id = ? |
121 | 121 | ", array($this->session['sCountry'])); |
122 | 122 | unset($this->session->KlarnaOrder); |
123 | - $this->session['sChangedCountry'] = (int)$this->Request()->getPost('sCountry'); |
|
123 | + $this->session['sChangedCountry'] = (int) $this->Request()->getPost('sCountry'); |
|
124 | 124 | } |
125 | 125 | $this->forward('index'); |
126 | 126 | } |
@@ -133,7 +133,7 @@ discard block |
||
133 | 133 | |
134 | 134 | $this->basket = $this->get('modules')->Basket()->sGetBasket(); |
135 | 135 | $preFill = $this->config['preFillCheckout']; |
136 | - if ($this->isUserLoggedIn()){ |
|
136 | + if ($this->isUserLoggedIn()) { |
|
137 | 137 | $user = Shopware()->Modules()->Admin()->sGetUserData(); |
138 | 138 | } |
139 | 139 | |
@@ -149,7 +149,7 @@ discard block |
||
149 | 149 | |
150 | 150 | // set klarnaPrefill, in case User ovverides Setting with checkbox |
151 | 151 | |
152 | - if ($this->Request()->getParam('klarnaPreFill') == "on"){ |
|
152 | + if ($this->Request()->getParam('klarnaPreFill') == "on") { |
|
153 | 153 | $this->session['klarnaUserPreFill'] = true; |
154 | 154 | } |
155 | 155 | |
@@ -162,7 +162,7 @@ discard block |
||
162 | 162 | $this->redirect(array('controller' => 'payment_klarna', 'action' => 'otherPayment')); |
163 | 163 | return; |
164 | 164 | } |
165 | - $shopCountryId = (string)$shopCountryId; |
|
165 | + $shopCountryId = (string) $shopCountryId; |
|
166 | 166 | if ($shopCountryId != $postedCountry) { |
167 | 167 | $this->session['sCountry'] = $postedCountry; |
168 | 168 | // unset klarnaOrder so it will be created with new countryID |
@@ -175,21 +175,21 @@ discard block |
||
175 | 175 | } |
176 | 176 | // set shipping costs (Overwrites $session->sCountry!) |
177 | 177 | $debugShipping = $this->getShippingCosts(); |
178 | - if ($postedCountry){ |
|
178 | + if ($postedCountry) { |
|
179 | 179 | $this->session['sCountry'] = $postedCountry; |
180 | 180 | } else { |
181 | 181 | // set Default Country |
182 | 182 | $this->session['sCountry'] = $this->getCountryByShop(Shopware()->Shop()); |
183 | 183 | } |
184 | 184 | |
185 | - $this->basket['sShippingcosts'] = $debugShipping['brutto'];; |
|
185 | + $this->basket['sShippingcosts'] = $debugShipping['brutto']; ; |
|
186 | 186 | $this->basket['sShippingcostsWithTax'] = $debugShipping['brutto']; |
187 | 187 | $this->basket['sShippingcostsNet'] = $debugShipping['netto']; |
188 | 188 | $this->basket['sShippingcostsTax'] = $debugShipping['tax']; |
189 | 189 | |
190 | 190 | // set missing basket vars for use in view |
191 | - $this->basket['AmountWithTaxNumeric'] = floatval(str_replace(',','.',$this->basket['Amount'])) + floatval(str_replace(',','.',$debugShipping['brutto'])); |
|
192 | - $this->basket['AmountNetNumeric'] = floatval(str_replace(',','.',$this->basket['AmountNet'])); |
|
191 | + $this->basket['AmountWithTaxNumeric'] = floatval(str_replace(',', '.', $this->basket['Amount'])) + floatval(str_replace(',', '.', $debugShipping['brutto'])); |
|
192 | + $this->basket['AmountNetNumeric'] = floatval(str_replace(',', '.', $this->basket['AmountNet'])); |
|
193 | 193 | |
194 | 194 | $klarnaConnector = $this->plugin->getConnector(); |
195 | 195 | $shop = $this->plugin->Application()->Shop(); |
@@ -236,7 +236,7 @@ discard block |
||
236 | 236 | } |
237 | 237 | |
238 | 238 | // In case Customer fills Iframe and then logs in do not update existing klarnaOrder |
239 | - if (!empty($this->session['KlarnaOrder']) && !$this->isUserLoggedIn()){ |
|
239 | + if (!empty($this->session['KlarnaOrder']) && !$this->isUserLoggedIn()) { |
|
240 | 240 | $klarnaOrder = new Klarna_Checkout_Order($klarnaConnector, $this->session['KlarnaOrder']); |
241 | 241 | $update = array(); |
242 | 242 | $update['cart']['items'] = $this->plugin->getCheckoutCart($this->basket); |
@@ -258,14 +258,14 @@ discard block |
||
258 | 258 | } catch (Exception $e) { |
259 | 259 | Shopware()->Plugins()->Controller()->ViewRenderer()->setNoRender(); |
260 | 260 | echo "Entschuldigung, Ein Verbindungsfehler ist aufgetreten, bitte aktualisieren Sie die Seite"; |
261 | - $this->plugin->klarnaLog("Verbindungsfehler in onPreDispatchCheckout\nCode:".$e->getCode()."Nachricht:\n".$e->getMessage(),1); |
|
261 | + $this->plugin->klarnaLog("Verbindungsfehler in onPreDispatchCheckout\nCode:".$e->getCode()."Nachricht:\n".$e->getMessage(), 1); |
|
262 | 262 | } |
263 | 263 | |
264 | 264 | $this->session->KlarnaOrder = $klarnaOrder->getLocation(); |
265 | 265 | |
266 | 266 | // Delete old perhaps cancelled Klarna Order |
267 | 267 | |
268 | - if ($klarnaOrder['status'] !== "checkout_incomplete"){ |
|
268 | + if ($klarnaOrder['status'] !== "checkout_incomplete") { |
|
269 | 269 | unset($this->session->KlarnaOrder); |
270 | 270 | } |
271 | 271 | |
@@ -290,7 +290,7 @@ discard block |
||
290 | 290 | $this->plugin->getViewConfig($this->View(), $this->config); |
291 | 291 | $this->View()->sBasket = $this->basket; |
292 | 292 | $this->View()->sDispatches = $this->getDispatches($paymentIdDebug); |
293 | - if ($postedCountry){ |
|
293 | + if ($postedCountry) { |
|
294 | 294 | $this->session['sCountry'] = $postedCountry; |
295 | 295 | } |
296 | 296 | $this->View()->sDispatch = $this->getSelectedDispatch(); |
@@ -298,20 +298,20 @@ discard block |
||
298 | 298 | // Neccessary if user is not logged in |
299 | 299 | $this->View()->sPayment = $userPayment; |
300 | 300 | |
301 | - $this->basket['sShippingcosts'] = $debugShipping['brutto'];; |
|
301 | + $this->basket['sShippingcosts'] = $debugShipping['brutto']; ; |
|
302 | 302 | $this->basket['sShippingcostsWithTax'] = $debugShipping['brutto']; |
303 | 303 | $this->basket['sShippingcostsNet'] = $debugShipping['netto']; |
304 | 304 | $this->basket['sShippingcostsTax'] = $debugShipping['tax']; |
305 | 305 | |
306 | - $this->basket['sAmount'] = floatval ($this->basket['Amount']) + floatval($this->basket['sShippingcosts']); |
|
306 | + $this->basket['sAmount'] = floatval($this->basket['Amount']) + floatval($this->basket['sShippingcosts']); |
|
307 | 307 | $this->basket['sAmountNet'] = floatval($this->basket['AmountNetNumeric']) + floatval($debugShipping['netto']); |
308 | 308 | |
309 | 309 | $this->basket['sAmountTax'] = 1.9; |
310 | 310 | $this->View()->sShippingcosts = $debugShipping['brutto']; |
311 | - $this->View()->sShippingcostsWithTax = $debugShipping['brutto']; |
|
311 | + $this->View()->sShippingcostsWithTax = $debugShipping['brutto']; |
|
312 | 312 | $this->View()->sShippingcostsNet = $debugShipping['netto']; |
313 | 313 | $this->View()->sShippingcostsTax = $debugShipping['tax']; |
314 | - $this->View()->sAmount = $this->basket['AmountWithTaxNumeric'] ; |
|
314 | + $this->View()->sAmount = $this->basket['AmountWithTaxNumeric']; |
|
315 | 315 | |
316 | 316 | $this->View()->sAmountNet = $this->basket['sAmountNet']; |
317 | 317 | $this->View()->sAmountTax = $this->basket['sAmountTax']; |
@@ -330,10 +330,10 @@ discard block |
||
330 | 330 | $this->plugin->klarnaLog("Entering Bootstrap::getCountryByShop", 3); |
331 | 331 | $locale = explode('_', $locale); |
332 | 332 | $locale = isset($locale[1]) ? $locale[1] : $locale[0]; |
333 | - $this->plugin->klarnaLog("Bootstrap::getCountryByShop locale to request for:".$locale,3); |
|
333 | + $this->plugin->klarnaLog("Bootstrap::getCountryByShop locale to request for:".$locale, 3); |
|
334 | 334 | $sql = 'SELECT id FROM s_core_countries WHERE countryiso=?'; |
335 | 335 | $countryId = Shopware()->Db()->fetchOne($sql, array($locale)); |
336 | - $countryId = ($countryId) ? (int)$countryId : null; |
|
336 | + $countryId = ($countryId) ? (int) $countryId : null; |
|
337 | 337 | |
338 | 338 | return $countryId; |
339 | 339 | } |
@@ -579,7 +579,7 @@ discard block |
||
579 | 579 | /** |
580 | 580 | * @param Klarna_Checkout_Order $order |
581 | 581 | */ |
582 | - public function createAccount($order = null, $checkLoginState=true) |
|
582 | + public function createAccount($order = null, $checkLoginState = true) |
|
583 | 583 | { |
584 | 584 | $this->plugin->klarnaLog('Entering Shopware_Controllers_Frontend_PaymentKlarna::createAccount', 3); |
585 | 585 | $module = Shopware()->Modules()->Admin(); |
@@ -599,7 +599,7 @@ discard block |
||
599 | 599 | $sessionId = Shopware()->SessionID(); |
600 | 600 | // email is only varchar(70) so we cut the sessionid |
601 | 601 | //$sessionId = substr($sessionId, 0,49); |
602 | - $data['auth']['email'] = substr($sessionId, 0,49) . '@klarna.com'; |
|
602 | + $data['auth']['email'] = substr($sessionId, 0, 49).'@klarna.com'; |
|
603 | 603 | $data['auth']['password'] = $sessionId; |
604 | 604 | } |
605 | 605 | $data['auth']['accountmode'] = '1'; |
@@ -614,11 +614,11 @@ discard block |
||
614 | 614 | ); |
615 | 615 | } |
616 | 616 | |
617 | - $this->plugin->klarnaLog("Shopware_Controllers_Frontend_PaymentKlarna::createAccount->order:",4, $order); |
|
617 | + $this->plugin->klarnaLog("Shopware_Controllers_Frontend_PaymentKlarna::createAccount->order:", 4, $order); |
|
618 | 618 | |
619 | 619 | foreach (array('billing', 'shipping') as $type) { |
620 | - if (isset($order[$type . '_address'])) { |
|
621 | - $orderAddress = $order[$type . '_address']; |
|
620 | + if (isset($order[$type.'_address'])) { |
|
621 | + $orderAddress = $order[$type.'_address']; |
|
622 | 622 | if (isset($orderAddress['title'])) { |
623 | 623 | $data[$type]['salutation'] = $orderAddress['title'] == 'Frau' ? 'ms' : 'mr'; |
624 | 624 | } else { |
@@ -628,7 +628,7 @@ discard block |
||
628 | 628 | $data[$type]['lastname'] = $orderAddress['family_name']; |
629 | 629 | if (isset($orderAddress['street_name']) && $orderAddress['street_number']) { |
630 | 630 | if (version_compare(Shopware::VERSION, '5.0.0', '>=')) { |
631 | - $data[$type]['street'] = $orderAddress['street_name'] . ' ' . $orderAddress['street_number']; |
|
631 | + $data[$type]['street'] = $orderAddress['street_name'].' '.$orderAddress['street_number']; |
|
632 | 632 | } else { |
633 | 633 | $data[$type]['street'] = $orderAddress['street_name']; |
634 | 634 | $data[$type]['streetnumber'] = $orderAddress['street_number']; |
@@ -654,21 +654,21 @@ discard block |
||
654 | 654 | } |
655 | 655 | $data[$type]['department'] = ''; |
656 | 656 | |
657 | - if (!empty($order[$type . '_address']['country'])) { |
|
657 | + if (!empty($order[$type.'_address']['country'])) { |
|
658 | 658 | $sql = 'SELECT id FROM s_core_countries WHERE countryiso=?'; |
659 | - $countryId = Shopware()->Db()->fetchOne($sql, array($order[$type . '_address']['country'])); |
|
659 | + $countryId = Shopware()->Db()->fetchOne($sql, array($order[$type.'_address']['country'])); |
|
660 | 660 | } else { |
661 | 661 | $countryId = $session['sCountry']; |
662 | 662 | } |
663 | 663 | // make sure country is set in case of lost sessions defualt to germany |
664 | - if (empty($countryId)){ |
|
664 | + if (empty($countryId)) { |
|
665 | 665 | $countryId = 2; |
666 | 666 | } |
667 | 667 | |
668 | 668 | $data[$type]['country'] = $countryId; |
669 | 669 | } |
670 | 670 | |
671 | - $this->plugin->klarnaLog("Shopware_Controllers_Frontend_PaymentKlarna::createAccount->data AFTER ADDRESSES:",4,$data); |
|
671 | + $this->plugin->klarnaLog("Shopware_Controllers_Frontend_PaymentKlarna::createAccount->data AFTER ADDRESSES:", 4, $data); |
|
672 | 672 | $sql = 'SELECT id FROM s_core_paymentmeans WHERE name=?'; |
673 | 673 | $paymentId = Shopware()->Db()->fetchOne($sql, array('klarna_checkout')); |
674 | 674 | |
@@ -687,7 +687,7 @@ discard block |
||
687 | 687 | $session->offsetSet('sUserPassword', $user['password']); |
688 | 688 | $session->offsetSet('sUserId', $user['id']); |
689 | 689 | } else { |
690 | - $this->plugin->klarnaLog("Shopware_Controllers_Frontend_PaymentKlarna::createAccount->user Not Found in DB SQL was:" .$sql,1); |
|
690 | + $this->plugin->klarnaLog("Shopware_Controllers_Frontend_PaymentKlarna::createAccount->user Not Found in DB SQL was:".$sql, 1); |
|
691 | 691 | } |
692 | 692 | } |
693 | 693 | |
@@ -706,7 +706,7 @@ discard block |
||
706 | 706 | if (Shopware::VERSION === '___VERSION___' || version_compare(Shopware::VERSION, '5.2.0', '>=')) { |
707 | 707 | $userId = $session->offsetGet('sUserId'); |
708 | 708 | $this->updateBilling($userId, $data['billing']); |
709 | - } else{ |
|
709 | + } else { |
|
710 | 710 | $module->sUpdateBilling(); |
711 | 711 | } |
712 | 712 | unset($data['auth']['password']); |
@@ -714,10 +714,10 @@ discard block |
||
714 | 714 | if (Shopware::VERSION === '___VERSION___' || version_compare(Shopware::VERSION, '5.2.0', '>=')) { |
715 | 715 | $userId = $session->offsetGet('sUserId'); |
716 | 716 | $this->updateCustomer($data, $userId); |
717 | - $this->plugin->klarnaLog("Shopware_Controllers_Frontend_PaymentKlarna::createAccount->updateCustomer:",3, $data); |
|
718 | - } else{ |
|
717 | + $this->plugin->klarnaLog("Shopware_Controllers_Frontend_PaymentKlarna::createAccount->updateCustomer:", 3, $data); |
|
718 | + } else { |
|
719 | 719 | $module->sUpdateAccount(); |
720 | - $this->plugin->klarnaLog("Shopware_Controllers_Frontend_PaymentKlarna::createAccount->updateAccount:",3, $this->front->Request()->getPost()); |
|
720 | + $this->plugin->klarnaLog("Shopware_Controllers_Frontend_PaymentKlarna::createAccount->updateAccount:", 3, $this->front->Request()->getPost()); |
|
721 | 721 | } |
722 | 722 | } else { |
723 | 723 | /** @var Enlight_Controller_Front $front */ |
@@ -760,22 +760,22 @@ discard block |
||
760 | 760 | $newdata = $this->saveUser($data); |
761 | 761 | $module->sSYSTEM->_POST = $newdata['auth']; |
762 | 762 | $errors = $module->sLogin(true); |
763 | - $this->plugin->klarnaLog("Shopware_Controllers_Frontend_PaymentKlarna::createAccount->saveUser:",3, $newdata); |
|
763 | + $this->plugin->klarnaLog("Shopware_Controllers_Frontend_PaymentKlarna::createAccount->saveUser:", 3, $newdata); |
|
764 | 764 | } else { |
765 | - $this->plugin->klarnaLog("Shopware_Controllers_Frontend_PaymentKlarna::createAccount->saveUser->Register:",3, $session->sRegister); |
|
765 | + $this->plugin->klarnaLog("Shopware_Controllers_Frontend_PaymentKlarna::createAccount->saveUser->Register:", 3, $session->sRegister); |
|
766 | 766 | $module->sSaveRegister(); |
767 | - $this->plugin->klarnaLog("Shopware_Controllers_Frontend_PaymentKlarna::createAccount->saveUser->RegisterFinished:",3, $session->offsetGet('sRegisterFinished')); |
|
767 | + $this->plugin->klarnaLog("Shopware_Controllers_Frontend_PaymentKlarna::createAccount->saveUser->RegisterFinished:", 3, $session->offsetGet('sRegisterFinished')); |
|
768 | 768 | } |
769 | 769 | |
770 | 770 | } catch (\Exception $ex) { /* do nothing */ |
771 | - $this->plugin->klarnaLog("ERROR while creating User. Exception information:".$ex->getMessage(),1); |
|
771 | + $this->plugin->klarnaLog("ERROR while creating User. Exception information:".$ex->getMessage(), 1); |
|
772 | 772 | |
773 | 773 | } |
774 | 774 | } |
775 | 775 | |
776 | 776 | } |
777 | 777 | |
778 | - $this->plugin->klarnaLog("Shopware_Controllers_Frontend_PaymentKlarna::createAccount->data END OF METHOD:",4, $data); |
|
778 | + $this->plugin->klarnaLog("Shopware_Controllers_Frontend_PaymentKlarna::createAccount->data END OF METHOD:", 4, $data); |
|
779 | 779 | } |
780 | 780 | |
781 | 781 | /** |
@@ -820,8 +820,8 @@ discard block |
||
820 | 820 | array('email' => $data['auth']['email']) |
821 | 821 | ); |
822 | 822 | |
823 | - $data['auth']['password']= $getUser->getPassword(); |
|
824 | - $data['auth']['passwordMD5']= $getUser->getPassword(); |
|
823 | + $data['auth']['password'] = $getUser->getPassword(); |
|
824 | + $data['auth']['passwordMD5'] = $getUser->getPassword(); |
|
825 | 825 | $data['auth']['encoderName'] = 'md5'; |
826 | 826 | return $data; |
827 | 827 | } |
@@ -832,7 +832,7 @@ discard block |
||
832 | 832 | */ |
833 | 833 | public function updateCustomer($data, $userId) |
834 | 834 | { |
835 | - if (empty($data['billing']['birthyear']) || empty($data['billing']['birthmonth']) || empty($data['billing']['birthday'])){ |
|
835 | + if (empty($data['billing']['birthyear']) || empty($data['billing']['birthmonth']) || empty($data['billing']['birthday'])) { |
|
836 | 836 | $data['birthdate'] == "0000-00-00"; |
837 | 837 | } else { |
838 | 838 | $data['birthdate'] = $data['billing']['birthyear'].'-'.$data['billing']['birthmonth'].'-'.$data['billing']['birthday']; |
@@ -882,7 +882,7 @@ discard block |
||
882 | 882 | $addressService->create($address, $customer); |
883 | 883 | $addressService->setDefaultShippingAddress($address); |
884 | 884 | } catch (Exception $ex) { |
885 | - $this->plugin->klarnaLog("ERROR while creating address via address service. Exception information:".$ex->getMessage(),1); |
|
885 | + $this->plugin->klarnaLog("ERROR while creating address via address service. Exception information:".$ex->getMessage(), 1); |
|
886 | 886 | } |
887 | 887 | |
888 | 888 | } |
@@ -929,13 +929,13 @@ discard block |
||
929 | 929 | */ |
930 | 930 | public function returnAction() |
931 | 931 | { |
932 | - $this->plugin->klarnaLog("Entering Shopware_Controllers_Frontend_PaymentKlarna::returnAction",3); |
|
932 | + $this->plugin->klarnaLog("Entering Shopware_Controllers_Frontend_PaymentKlarna::returnAction", 3); |
|
933 | 933 | $transactionId = $this->Request()->getParam('transactionId'); |
934 | 934 | $connector = $this->plugin->getConnector(); |
935 | 935 | |
936 | 936 | $order = new Klarna_Checkout_Order($connector, $transactionId); |
937 | - $this->plugin->klarnaLog("Entering Shopware_Controllers_Frontend_PaymentKlarna::returnAction->transactionId:\n".$transactionId,3); |
|
938 | - $this->plugin->klarnaLog("Entering Shopware_Controllers_Frontend_PaymentKlarna::returnAction->order:",4, $order); |
|
937 | + $this->plugin->klarnaLog("Entering Shopware_Controllers_Frontend_PaymentKlarna::returnAction->transactionId:\n".$transactionId, 3); |
|
938 | + $this->plugin->klarnaLog("Entering Shopware_Controllers_Frontend_PaymentKlarna::returnAction->order:", 4, $order); |
|
939 | 939 | $orderNumber = ''; |
940 | 940 | $session = Shopware()->Session(); |
941 | 941 | |
@@ -947,8 +947,8 @@ discard block |
||
947 | 947 | |
948 | 948 | // if already created by pushaction just redirect |
949 | 949 | |
950 | - if ($order['status'] === 'created'){ |
|
951 | - $this->plugin->klarnaLog("Shopware_Controllers_Frontend_PaymentKlarna::returnAction: OrderStatus is already created... nothing to do: " .$orderNumber,1); |
|
950 | + if ($order['status'] === 'created') { |
|
951 | + $this->plugin->klarnaLog("Shopware_Controllers_Frontend_PaymentKlarna::returnAction: OrderStatus is already created... nothing to do: ".$orderNumber, 1); |
|
952 | 952 | $this->redirect(array( |
953 | 953 | 'controller' => 'payment_klarna', |
954 | 954 | 'action' => 'finish', |
@@ -962,15 +962,15 @@ discard block |
||
962 | 962 | Shopware()->Session()->sOrderVariables['sUserData'] = $this->getUserData(); |
963 | 963 | |
964 | 964 | if ($order['status'] == 'checkout_complete') { |
965 | - $this->plugin->klarnaLog("Entering Shopware_Controllers_Frontend_PaymentKlarna::returnAction: checkout_complete. Save oder if session values match.",3); |
|
966 | - if (Shopware()->Session()->offsetGet('KlarnaTransactionId') == null){ |
|
967 | - $this->plugin->klarnaLog("Entering Shopware_Controllers_Frontend_PaymentKlarna::returnAction: Session matches. Order will be saved",3); |
|
968 | - Shopware()->Session()->offsetSet('KlarnaTransactionId', $transactionId ); |
|
965 | + $this->plugin->klarnaLog("Entering Shopware_Controllers_Frontend_PaymentKlarna::returnAction: checkout_complete. Save oder if session values match.", 3); |
|
966 | + if (Shopware()->Session()->offsetGet('KlarnaTransactionId') == null) { |
|
967 | + $this->plugin->klarnaLog("Entering Shopware_Controllers_Frontend_PaymentKlarna::returnAction: Session matches. Order will be saved", 3); |
|
968 | + Shopware()->Session()->offsetSet('KlarnaTransactionId', $transactionId); |
|
969 | 969 | $orderNumber = $this->saveOrder( |
970 | 970 | $order['reservation'], |
971 | 971 | $order['reference'] |
972 | 972 | ); |
973 | - Shopware()->Session()->offsetSet('KlarnaTransactionId', null ); |
|
973 | + Shopware()->Session()->offsetSet('KlarnaTransactionId', null); |
|
974 | 974 | } |
975 | 975 | } |
976 | 976 | |
@@ -979,13 +979,13 @@ discard block |
||
979 | 979 | $orderNumber = $order['merchant_reference']['orderid1']; |
980 | 980 | } |
981 | 981 | |
982 | - if (!empty($orderNumber)){ |
|
982 | + if (!empty($orderNumber)) { |
|
983 | 983 | $update = array(); |
984 | 984 | |
985 | 985 | $update['status'] = 'created'; |
986 | 986 | $update['merchant_reference'] = array( |
987 | - 'orderid1' => (string)$orderNumber, |
|
988 | - 'orderid2' => (string)$order['reference'] |
|
987 | + 'orderid1' => (string) $orderNumber, |
|
988 | + 'orderid2' => (string) $order['reference'] |
|
989 | 989 | ); |
990 | 990 | $order->update($update); |
991 | 991 | } |
@@ -1020,7 +1020,7 @@ discard block |
||
1020 | 1020 | } |
1021 | 1021 | } catch (Exception $e) { |
1022 | 1022 | Shopware()->Plugins()->Controller()->ViewRenderer()->setNoRender(); |
1023 | - $this->plugin->klarnaLog("Shopware_Controllers_Frontend_PaymentKlarna::returnAction: Catch. Searching for Order:",3); |
|
1023 | + $this->plugin->klarnaLog("Shopware_Controllers_Frontend_PaymentKlarna::returnAction: Catch. Searching for Order:", 3); |
|
1024 | 1024 | $this->checkKlarnaOrderExistsByReservation($order['reservation']); |
1025 | 1025 | $this->checkKlarnaOrderExistsByReference($order['reference']); |
1026 | 1026 | $this->checkKlarnaOrderExistsBySession(Shopware()->Session()->sUserId); |
@@ -1048,9 +1048,9 @@ discard block |
||
1048 | 1048 | )); |
1049 | 1049 | |
1050 | 1050 | $orderExists = (empty($order)) ? false : true; |
1051 | - $this->plugin->klarnaLog("Shopware_Controllers_Frontend_PaymentKlarna::checkKlarnaOrderExistsBySession:",3); |
|
1052 | - if ($orderExists){ |
|
1053 | - $this->plugin->klarnaLog("Shopware_Controllers_Frontend_PaymentKlarna::checkKlarnaOrderExistsBySession: Order Found: ",3, $order); |
|
1051 | + $this->plugin->klarnaLog("Shopware_Controllers_Frontend_PaymentKlarna::checkKlarnaOrderExistsBySession:", 3); |
|
1052 | + if ($orderExists) { |
|
1053 | + $this->plugin->klarnaLog("Shopware_Controllers_Frontend_PaymentKlarna::checkKlarnaOrderExistsBySession: Order Found: ", 3, $order); |
|
1054 | 1054 | } |
1055 | 1055 | return $orderExists; |
1056 | 1056 | } |
@@ -1073,9 +1073,9 @@ discard block |
||
1073 | 1073 | )); |
1074 | 1074 | |
1075 | 1075 | $orderExists = (empty($order)) ? false : true; |
1076 | - $this->plugin->klarnaLog("Shopware_Controllers_Frontend_PaymentKlarna::checkKlarnaOrderExistsByReference:",3); |
|
1077 | - if ($orderExists){ |
|
1078 | - $this->plugin->klarnaLog("Shopware_Controllers_Frontend_PaymentKlarna::checkKlarnaOrderExistsByReference: Order Found: ",3, $order); |
|
1076 | + $this->plugin->klarnaLog("Shopware_Controllers_Frontend_PaymentKlarna::checkKlarnaOrderExistsByReference:", 3); |
|
1077 | + if ($orderExists) { |
|
1078 | + $this->plugin->klarnaLog("Shopware_Controllers_Frontend_PaymentKlarna::checkKlarnaOrderExistsByReference: Order Found: ", 3, $order); |
|
1079 | 1079 | } |
1080 | 1080 | return $orderExists; |
1081 | 1081 | } |
@@ -1098,9 +1098,9 @@ discard block |
||
1098 | 1098 | )); |
1099 | 1099 | |
1100 | 1100 | $orderExists = (empty($order)) ? false : true; |
1101 | - $this->plugin->klarnaLog("Shopware_Controllers_Frontend_PaymentKlarna::checkKlarnaOrderExistsByReservation:",3); |
|
1102 | - if ($orderExists){ |
|
1103 | - $this->plugin->klarnaLog("Shopware_Controllers_Frontend_PaymentKlarna::checkKlarnaOrderExistsByReservation: Order Found: ",3, $order); |
|
1101 | + $this->plugin->klarnaLog("Shopware_Controllers_Frontend_PaymentKlarna::checkKlarnaOrderExistsByReservation:", 3); |
|
1102 | + if ($orderExists) { |
|
1103 | + $this->plugin->klarnaLog("Shopware_Controllers_Frontend_PaymentKlarna::checkKlarnaOrderExistsByReservation: Order Found: ", 3, $order); |
|
1104 | 1104 | } |
1105 | 1105 | return $orderExists; |
1106 | 1106 | } |
@@ -1149,9 +1149,9 @@ discard block |
||
1149 | 1149 | )); |
1150 | 1150 | |
1151 | 1151 | $orderExists = (empty($orderDetails)) ? false : true; |
1152 | - $this->plugin->klarnaLog("Shopware_Controllers_Frontend_PaymentKlarna::checkKlarnaOrderDetailsBySession:",3); |
|
1153 | - if ($orderExists){ |
|
1154 | - $this->plugin->klarnaLog("Shopware_Controllers_Frontend_PaymentKlarna::checkKlarnaOrderDetailsBySession: OrderDetails Found: ",3, $orderDetails); |
|
1152 | + $this->plugin->klarnaLog("Shopware_Controllers_Frontend_PaymentKlarna::checkKlarnaOrderDetailsBySession:", 3); |
|
1153 | + if ($orderExists) { |
|
1154 | + $this->plugin->klarnaLog("Shopware_Controllers_Frontend_PaymentKlarna::checkKlarnaOrderDetailsBySession: OrderDetails Found: ", 3, $orderDetails); |
|
1155 | 1155 | } |
1156 | 1156 | return $orderExists; |
1157 | 1157 | } |
@@ -1231,14 +1231,14 @@ discard block |
||
1231 | 1231 | { |
1232 | 1232 | $transactionId = $this->Request()->getParam('transactionId'); |
1233 | 1233 | |
1234 | - $this->plugin->klarnaLog("Shopware_Controllers_Frontend_PaymentKlarna::pushAction->transactionId:\n".$transactionId,3); |
|
1234 | + $this->plugin->klarnaLog("Shopware_Controllers_Frontend_PaymentKlarna::pushAction->transactionId:\n".$transactionId, 3); |
|
1235 | 1235 | $connector = $this->plugin->getConnector(); |
1236 | 1236 | $order = new Klarna_Checkout_Order($connector, $transactionId); |
1237 | 1237 | |
1238 | 1238 | $order->fetch(); |
1239 | 1239 | |
1240 | - if ($order['status'] === 'created'){ |
|
1241 | - $this->plugin->klarnaLog("Shopware_Controllers_Frontend_PaymentKlarna::pushAction: OrderStatus is already created... nothing to do: ",1); |
|
1240 | + if ($order['status'] === 'created') { |
|
1241 | + $this->plugin->klarnaLog("Shopware_Controllers_Frontend_PaymentKlarna::pushAction: OrderStatus is already created... nothing to do: ", 1); |
|
1242 | 1242 | return; |
1243 | 1243 | } |
1244 | 1244 | |
@@ -1248,15 +1248,15 @@ discard block |
||
1248 | 1248 | Shopware()->Session()->sOrderVariables['sUserData'] = $this->getUserData(); |
1249 | 1249 | |
1250 | 1250 | if ($order['status'] == 'checkout_complete') { |
1251 | - $this->plugin->klarnaLog("Entering Shopware_Controllers_Frontend_PaymentKlarna::returnAction: checkout_complete. Save oder if session values match.",3); |
|
1252 | - if (Shopware()->Session()->offsetGet('KlarnaTransactionId') == null){ |
|
1253 | - $this->plugin->klarnaLog("Entering Shopware_Controllers_Frontend_PaymentKlarna::returnAction: Session matches. Order will be saved",3); |
|
1254 | - Shopware()->Session()->offsetSet('KlarnaTransactionId', $transactionId ); |
|
1251 | + $this->plugin->klarnaLog("Entering Shopware_Controllers_Frontend_PaymentKlarna::returnAction: checkout_complete. Save oder if session values match.", 3); |
|
1252 | + if (Shopware()->Session()->offsetGet('KlarnaTransactionId') == null) { |
|
1253 | + $this->plugin->klarnaLog("Entering Shopware_Controllers_Frontend_PaymentKlarna::returnAction: Session matches. Order will be saved", 3); |
|
1254 | + Shopware()->Session()->offsetSet('KlarnaTransactionId', $transactionId); |
|
1255 | 1255 | $orderNumber = $this->saveOrder( |
1256 | 1256 | $order['reservation'], |
1257 | 1257 | $order['reference'] |
1258 | 1258 | ); |
1259 | - Shopware()->Session()->offsetSet('KlarnaTransactionId', null ); |
|
1259 | + Shopware()->Session()->offsetSet('KlarnaTransactionId', null); |
|
1260 | 1260 | } |
1261 | 1261 | } |
1262 | 1262 | |
@@ -1264,13 +1264,13 @@ discard block |
||
1264 | 1264 | $orderNumber = $order['merchant_reference']['orderid1']; |
1265 | 1265 | } |
1266 | 1266 | |
1267 | - if (!empty($orderNumber)){ |
|
1267 | + if (!empty($orderNumber)) { |
|
1268 | 1268 | $update = array(); |
1269 | 1269 | |
1270 | 1270 | $update['status'] = 'created'; |
1271 | 1271 | $update['merchant_reference'] = array( |
1272 | - 'orderid1' => (string)$orderNumber, |
|
1273 | - 'orderid2' => (string)$order['reference'] |
|
1272 | + 'orderid1' => (string) $orderNumber, |
|
1273 | + 'orderid2' => (string) $order['reference'] |
|
1274 | 1274 | ); |
1275 | 1275 | $order->update($update); |
1276 | 1276 | } |
@@ -1295,7 +1295,7 @@ discard block |
||
1295 | 1295 | $orderNumber |
1296 | 1296 | )); |
1297 | 1297 | } catch (Exception $e) { |
1298 | - $this->plugin->klarnaLog("PROBLEM SAVING ORDER ATTRIBUTES AFTER KLARNA PUSH!:\n".$e->getMessage(),1); |
|
1298 | + $this->plugin->klarnaLog("PROBLEM SAVING ORDER ATTRIBUTES AFTER KLARNA PUSH!:\n".$e->getMessage(), 1); |
|
1299 | 1299 | } |
1300 | 1300 | } |
1301 | 1301 |