Passed
Push — master ( ad9d2a...3a231c )
by Mario
02:53
created
Controllers/Frontend/PaymentKlarna.php 1 patch
Indentation   +100 added lines, -100 removed lines patch added patch discarded remove patch
@@ -97,13 +97,13 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 }
Please login to merge, or discard this patch.
Bootstrap.php 1 patch
Indentation   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -1603,10 +1603,10 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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;
Please login to merge, or discard this patch.