Index: /mods/wpsg_mod_paypalapi.class.php
===================================================================
--- /mods/wpsg_mod_paypalapi.class.php	(revision 8139)
+++ /mods/wpsg_mod_paypalapi.class.php	(revision 8140)
@@ -153,5 +153,5 @@
 					$json_data = $this->api_createWebExperience();
 				
-					$this->shop->update_option('wpsg_mod_paypalapi_paymentExperience', $json_data['id']);
+					$this->shop->update_option('wpsg_mod_paypalapi_paymentExperience', $json_data['id'], false, WPSG_SANITIZE_TEXTFIELD);
 					
 				} else
@@ -318,6 +318,5 @@
 		} // public function addPayment(&$arPayment)
 				 
-		public function checkout_handlePayment()
-		{
+		public function checkout_handlePayment() {
 		
 			// Wenn 0,- dann nix machen
@@ -332,6 +331,5 @@
 			// Wenn eine andere Zahlungsart als PayPal gewÃ€hlt wurde und Zahlungskosten entstanden sind,
 			// dann lÃ¶sche ich die Zahlung und lasse neu wÃ€hlen			
-			if ($this->id != $_SESSION['wpsg']['checkout']['payment'] && isset($this->shop->view['basket']['sum']['preis_payment'])  && $this->shop->view['basket']['sum']['preis_payment'] != 0)
-			{
+			if ($this->id != $_SESSION['wpsg']['checkout']['payment'] && isset($this->shop->view['basket']['sum']['preis_payment'])  && $this->shop->view['basket']['sum']['preis_payment'] != 0) {
 			
 				unset($_SESSION['wpsg']['checkout']['payment']);
@@ -343,12 +341,9 @@
 						
 			// Zahlung ÃŒber kompletten Betrag schon vorbereitet
-			if (isset($_SESSION['wpsg']['checkout']['payment_amount']) && $_SESSION['wpsg']['checkout']['payment'] == $this->id)
-			{
-				
-				if (wpsg_tf($_SESSION['wpsg']['checkout']['payment_amount']) == $this->shop->view['basket']['sum']['preis_gesamt_brutto'])
-				{
-					
-					if ($this->shop->hasMod('wpsg_mod_willcollect'))
-					{
+			if (isset($_SESSION['wpsg']['checkout']['payment_amount']) && $_SESSION['wpsg']['checkout']['payment'] == $this->id) {
+				
+				if (wpsg_tf($_SESSION['wpsg']['checkout']['payment_amount']) == $this->shop->view['basket']['sum']['preis_gesamt_brutto']) {
+					
+					if ($this->shop->hasMod('wpsg_mod_willcollect')) {
 							
 						$arCheckout = array(
@@ -373,25 +368,18 @@
 						}
 					
+					} else {
+					
+						$this->shop->view['wpsg_mod_paypalapi']['show'] = 1;
+						
 					}
-					else
-					{
-					
-						$this->shop->view['wpsg_mod_paypalapi']['show'] = 1;
-						
-					}
-					
-				}
-				else
-				{
-			
-					if (wpsg_isSizedInt($this->shop->get_option('wpsg_mod_paypalapi_plus_aktiv')))
-					{
+					
+				} else {
+			
+					if (wpsg_isSizedInt($this->shop->get_option('wpsg_mod_paypalapi_plus_aktiv'))) {
 						 
 						$this->setViewForPayPalPLus();						
 						$this->shop->view['wpsg_mod_paypalapi']['show'] = 3;
 						
-					}
-					else
-					{
+					} else {
 					
 						$this->shop->view['wpsg_mod_paypalapi']['show'] = 2;
@@ -404,26 +392,20 @@
 				}
 				
-			}
-			else  
-			{
-				
-				if (wpsg_isSizedInt($this->shop->get_option('wpsg_mod_paypalapi_plus_aktiv')))
-				{
+			} else {
+				
+				if (wpsg_isSizedInt($this->shop->get_option('wpsg_mod_paypalapi_plus_aktiv'))) {
 				
 					$this->setViewForPayPalPLus();
 					$this->shop->view['wpsg_mod_paypalapi']['show'] = 3;
 						
+				} else {
+					
+					return false;
+					
 				}
-				else
-				{
-					
-					return false;
-					
-				}
-				
-			}
-			
-			if (isset($_SESSION['wpsg']['checkout']['payment']) && $_SESSION['wpsg']['checkout']['payment'] != '10') 
-			{ 
+				
+			}
+			
+			if (isset($_SESSION['wpsg']['checkout']['payment']) && $_SESSION['wpsg']['checkout']['payment'] != '10') { 
 			
 				$this->shop->view['wpsg_mod_paypalapi']['error'] = __('Sie hatten eventuell bereits eine Zahlungsart gewÃ€hlt. Aufgrund technischer EinschrÃ€nkungen kann es sein, dass diese Auswahl hier erneut durchgefÃŒhrt werden muss.', 'wpsg');
@@ -433,5 +415,5 @@
 			$this->shop->render(WPSG_PATH_VIEW.'/mods/mod_paypalapi/checkout_handlePayment.phtml');
 			
-			return '-2';
+			return -2;
 							 			
 		} // public function checkout_handlePayment() 
@@ -826,5 +808,14 @@
                     $oOrder->log(__('PayPalAPI V1 WebHook Erfolg', 'wpsg'), print_r($jsonData, 1));
 
-                    $this->shop->setOrderStatus($oOrder->id, 100, true);
+//					try {
+                    
+						$this->shop->setOrderStatus($oOrder->id, 100, true);
+/*
+					} catch (\Exception $e) {
+						
+						mail("daniel@maennchen1.de", "TIERPARK Fehler:".$e->getMessage(), print_r(debug_backtrace(), true));
+						
+					}*/
+					
                     $this->db->UpdateQuery(WPSG_TBL_ORDER, ['ext_payed' => '1'], " `id` = '".wpsg_q($oOrder->getId())."' ");
 
@@ -2053,12 +2044,9 @@
 			);
 			
-			if ($auth_token === false)
-			{
-							
-				if ($this->isSandbox())
-				{
-					
-					if (!wpsg_isSizedString($this->shop->get_option('wpsg_mod_paypalapi_sandbox_clientid')) || !wpsg_isSizedString($this->shop->get_option('wpsg_mod_paypalapi_sandbox_secret')))
-					{
+			if ($auth_token === false) {
+						
+				if ($this->isSandbox()) {
+					 
+					if (!wpsg_isSizedString($this->shop->get_option('wpsg_mod_paypalapi_sandbox_clientid')) || !wpsg_isSizedString($this->shop->get_option('wpsg_mod_paypalapi_sandbox_secret'))) {
 						
 						$this->api_handleError(__('Keine API Daten hinterlegt.', 'wpsg'));
@@ -2066,13 +2054,10 @@
 						
 					}
-					
+					 
 					curl_setopt($ch, CURLOPT_USERPWD, $this->shop->get_option('wpsg_mod_paypalapi_sandbox_clientid').':'.$this->shop->get_option('wpsg_mod_paypalapi_sandbox_secret'));
 					
-				}
-				else 
-				{
-					
-					if (!wpsg_isSizedString($this->shop->get_option('wpsg_mod_paypalapi_clientid')) || !wpsg_isSizedString($this->shop->get_option('wpsg_mod_paypalapi_secret')))
-					{
+				} else {
+					
+					if (!wpsg_isSizedString($this->shop->get_option('wpsg_mod_paypalapi_clientid')) || !wpsg_isSizedString($this->shop->get_option('wpsg_mod_paypalapi_secret'))) {
 					
 						$this->api_handleError(__('Keine API Daten hinterlegt.', 'wpsg'));
@@ -2088,5 +2073,5 @@
 			else
 			{
-				
+			 
 				$arHeader[] = 'Authorization: Bearer '.$auth_token;
 				
@@ -2128,5 +2113,5 @@
 									
 			$output = curl_exec($ch);
-			
+		 
 			if ($auth_token === false && $output == '')
 			{
@@ -2142,5 +2127,5 @@
 			
 			curl_close($ch);
- 
+
 			$return = json_decode($output, true);
 			
