Index: /lib/filter_functions.inc.php
===================================================================
--- /lib/filter_functions.inc.php	(revision 7517)
+++ /lib/filter_functions.inc.php	(revision 7518)
@@ -515,16 +515,14 @@
 
             $sanitization_err_code = "";
-
-        	if(wpsg_isSizedArray($_SESSION['sanitization_err_fields']))
-	        {
-	        	foreach($_SESSION['sanitization_err_fields'] as $field_name => $nCalls)
-		        {
-
-		        	$_SESSION['sanitization_err_fields'][$field_name]++;
-
-		        	if($_SESSION['sanitization_err_fields'][$field_name] >= 1)
-		        		unset($_SESSION['sanitization_err_fields'][$field_name]);
-
-		        	$sanitization_err_code .= "document.getElementsByName('$field_name').forEach(el => { el.style.borderColor = '#D9534F'; });\n";
+	 
+			if (wpsg_isSizedArray($_SESSION['sanitization_err_fields'])) {
+				 
+	        	foreach($_SESSION['sanitization_err_fields'] as $field_name => $nCalls) {
+
+		        	$_SESSION['sanitization_err_fields'][$field_name] ++;
+					
+		        	if ($_SESSION['sanitization_err_fields'][$field_name] >= 1) unset($_SESSION['sanitization_err_fields'][$field_name]);
+
+		        	$sanitization_err_code .= "alert('$field_name'); document.getElementsByName('$field_name').forEach(el => { el.style.borderColor = '#D9534F'; });\n";
 
 		        }
Index: /mods/wpsg_mod_paypal.class.php
===================================================================
--- /mods/wpsg_mod_paypal.class.php	(revision 7517)
+++ /mods/wpsg_mod_paypal.class.php	(revision 7518)
@@ -39,6 +39,5 @@
 			$this->shop->checkDefault('wpsg_mod_paypal_mwstland', '0');
 			$this->shop->checkDefault('wpsg_mod_paypal_autostart', '0');
-			$this->shop->checkDefault('wpsg_mod_paypal_sandbox', '0');
-			$this->shop->checkDefault('wpsg_mod_paypal_email', '');
+			$this->shop->checkDefault('wpsg_mod_paypal_sandbox', '0');			
 			$this->shop->checkDefault('wpsg_mod_paypal_language', 'DE');
 			$this->shop->checkDefault('wpsg_mod_paypal_subject', 'O%order_id% - K%kunde_id%', false, true);
@@ -84,9 +83,14 @@
 		} // public function settings_edit()
 				
-		public function settings_save()
-		{
-
-			foreach($_REQUEST['wpsg_mod_paypal_stornostate'] as $k => $v)
-				$_REQUEST['wpsg_mod_paypal_stornostate'][$k] = wpsg_sinput("key", $v);
+		public function settings_save() {
+ 
+			foreach($_REQUEST['wpsg_mod_paypal_stornostate'] as $k => $v) {
+				
+				if (wpsg_checkInput($v, WPSG_SANITIZE_INT)) $_REQUEST['wpsg_mod_paypal_stornostate'][$k] = intval($v);
+				else unset($_REQUEST[$k]);
+				
+			}
+			
+			$this->shop->update_option('wpsg_mod_paypal_stornostate', $_REQUEST['wpsg_mod_paypal_stornostate']);
 
 			$this->shop->update_option('wpsg_mod_paypal_bezeichnung', $_REQUEST['wpsg_mod_paypal_bezeichnung'], false, false, WPSG_SANITIZE_TEXTFIELD);
@@ -98,20 +102,14 @@
 			// Vor dem CreateWebHook
 			$this->shop->update_option('wpsg_mod_paypal_sandbox', $_REQUEST['wpsg_mod_paypal_sandbox'], false, false, WPSG_SANITIZE_CHECKBOX);
-						
-			// Classic API
-			$this->shop->update_option('wpsg_mod_paypal_email', $_REQUEST['wpsg_mod_paypal_email'], false, false, WPSG_SANITIZE_EMAIL);
-			
+									
 			// Rest API
 			$this->shop->update_option('wpsg_mod_paypal_clientid', $_REQUEST['wpsg_mod_paypal_clientid'], false, false, WPSG_SANITIZE_TEXTFIELD);
 			$this->shop->update_option('wpsg_mod_paypal_secret', $_REQUEST['wpsg_mod_paypal_secret'], false, false, WPSG_SANITIZE_TEXTFIELD);
 			
-			if (wpsg_isSizedInt($_REQUEST['wpsg_mod_paypal_createwebhook']))
-			{
+			if (wpsg_isSizedInt($_REQUEST['wpsg_mod_paypal_createwebhook'])) {
 				
 				$this->createWebHook();
 				
 			}
-
-			$this->shop->update_option('wpsg_mod_paypal_stornostate', $_REQUEST['wpsg_mod_paypal_stornostate']);
 			
 			$this->shop->update_option('wpsg_mod_paypal_subject', $_REQUEST['wpsg_mod_paypal_subject'], false, false, WPSG_SANITIZE_TEXTFIELD);
@@ -378,53 +376,5 @@
 		
 		/* Modulfunktionen */
-		
-		/* Classic API */
-		
-		/**
-		 * Gibt den Link fÃŒr die Bezahlung per PayPal anhand der BestellID zurÃŒck
-		 */
-		public function getPayPalLink($order_id)
-		{
-
-			$basket_link = get_permalink($this->shop->get_option('wpsg_page_basket'));
-			
-			if (strpos($basket_link, "?") > 0)
-			{
-				$basket_link .= "&wpsg_plugin=wpsg_mod_paypal&confirm=pp";
-			}
-			else
-			{
-				$basket_link .= "?wpsg_plugin=wpsg_mod_paypal&confirm=pp";
-			}
-
-			$order = $this->db->fetchRow("
-				SELECT
-					O.`id` AS o_id, O.`onr`,
-					K.`id` AS k_id, K.`knr`
-				FROM
-					`".WPSG_TBL_ORDER."` AS O
-						LEFT JOIN `".WPSG_TBL_KU."` AS K ON (O.`k_id` = K.`id`)
-				WHERE
-					O.`id` = '".wpsg_q($order_id)."'						
-			");
-			  
-			$strItemName = $this->shop->replaceUniversalPlatzhalter(__($this->shop->get_option('wpsg_mod_paypal_subject'), 'wpsg'), $order_id);			
- 		
-			$arBasket = $this->shop->basket->toArray();
-			$strSuccessURL = get_permalink($this->shop->get_option('wpsg_page_mod_paypal_success'));
-			$strErrorURL = get_permalink($this->shop->get_option('wpsg_page_mod_paypal_error'));
-			
-			return 	$this->url.
-					'?cmd=_xclick&business='.rawurlencode($this->shop->get_option('wpsg_mod_paypal_email')).
-					'&amount='.rawurlencode(wpsg_round(wpsg_tf($arBasket['sum']['preis_gesamt_brutto']), 2)).
-					'&item_name='.rawurlencode($strItemName).
-					'&return='.rawurlencode($strSuccessURL).
-					'&cancel_return='.rawurlencode($strErrorURL).
-					'&notify_url='.rawurlencode($basket_link).
-					'&currency_code='.rawurlencode($this->shop->get_option('wpsg_mod_paypal_currency')).
-					'&lc='.$this->shop->get_option('wpsg_mod_paypal_language').'&custom='.rawurlencode($order_id);
-			
-		} // public function getPayPalLink($order_id)
-		
+				
 		/* REST API */
 		
@@ -501,5 +451,5 @@
 			$paymentId = $oOrder->getMeta('wpsg_mod_paypal_paymentid');
 				
-			if (wpsg_isSizedString($paymentId))
+			if (0&&wpsg_isSizedString($paymentId))
 			{
 		
@@ -568,5 +518,18 @@
 		
 			$payer->setPayerInfo($payer_info);
-				
+			
+			$item = new \PayPal\Api\Item();
+			$item->setName(__('Bestellbetrag', 'wpsg'));
+			$item->setCurrency($this->shop->get_option('wpsg_currency'));
+			$item->setQuantity(1);
+			$item->setPrice($oOrder->getToPay(WPSG_BRUTTO));
+			
+			$itemList = new \PayPal\Api\ItemList();
+			$itemList->setItems([$item]);
+			
+			$details = new \PayPal\Api\Details();
+			$details->setShipping($oOrder->getShippingAmount(WPSG_BRUTTO));
+			$details->setSubtotal($oOrder->getToPay(WPSG_BRUTTO) - $oOrder->getShippingAmount(WPSG_BRUTTO) - $oOrder->getPaymentAmount(WPSG_BRUTTO));
+			
 			/*
 			 $arProducts = $oOrder->getOrderProducts();
@@ -612,5 +575,5 @@
 			 $details->setSubtotal($oOrder->getToPay(WPSG_BRUTTO) - $oOrder->getShippingAmount(WPSG_BRUTTO) - $oOrder->getPaymentAmount(WPSG_BRUTTO));
 			*/
-				
+			
 			$amount = new \PayPal\Api\Amount();
 			$amount->setCurrency($this->shop->get_option('wpsg_mod_paypal_currency'));
@@ -620,5 +583,5 @@
 			$transaction = new \PayPal\Api\Transaction();
 			$transaction->setAmount($amount);
-			//$transaction->setItemList($itemList);
+			$transaction->setItemList($itemList);
 			$transaction->setDescription($this->shop->replaceUniversalPlatzhalter(__($this->shop->get_option('wpsg_mod_paypal_subject'), 'wpsg'), $oOrder->id));
 			$transaction->setInvoiceNumber($oOrder->id);
@@ -634,6 +597,5 @@
 			$payment->setTransactions(array($transaction));
 				
-			try
-			{
+			try {
 					
 				$response = $payment->create($this->getApiContext());
@@ -641,7 +603,5 @@
 				$oOrder->setMeta('wpsg_mod_paypal_paymentid', $response->getId());
 		
-			}
-			catch (Exception $ex)
-			{
+			} catch (Exception $ex) {
 					
 				$data = json_decode($ex->getData(), true);
Index: /views/mods/mod_paypal/settings_edit.phtml
===================================================================
--- /views/mods/mod_paypal/settings_edit.phtml	(revision 7517)
+++ /views/mods/mod_paypal/settings_edit.phtml	(revision 7518)
@@ -10,4 +10,5 @@
 <?php echo wpsg_drawForm_Checkbox('wpsg_mod_paypal_aktiv', __('Aktiv', 'wpsg'), $this->get_option('wpsg_mod_paypal_aktiv'), array('help' => 'wpsg_shippay_activ')); ?>
 <?php echo wpsg_drawForm_Textarea('wpsg_mod_paypal_hint', __('Hinweistext', 'wpsg'), $this->get_option('wpsg_mod_paypal_hint'), array('help' => 'wpsg_shippay_hint')); ?>
+
 <br />
 	
@@ -57,8 +58,10 @@
 
 <br />
+
 <?php echo wpsg_drawForm_Checkbox('wpsg_mod_paypal_sandbox', __('Sandbox Modus', 'wpsg'), $this->get_option('wpsg_mod_paypal_sandbox'), array('help' => 'wpsg_mod_paypal_sandbox')); ?>
 <?php echo wpsg_drawForm_Input('wpsg_mod_paypal_subject', __('Betreff der Ãberweisung', 'wpsg'), $this->get_option('wpsg_mod_paypal_subject'), array('help' => 'wpsg_mod_paypal_subject')); ?>
 
 <br />
+
 <?php echo wpsg_drawForm_Input('wpsg_mod_paypal_gebuehr', __('GebÃŒhr/Rabatt', 'wpsg'), wpsg_ff($this->get_option('wpsg_mod_paypal_gebuehr'), true), array('help' => 'wpsg_shippay_gebuehr', 'unit' => $this->get_option('wpsg_currency').' / %')); ?>
 <?php echo wpsg_drawForm_Select('wpsg_mod_paypal_mwst', __('Mehrwertsteuersatz', 'wpsg'), wpsg_tax_groups(), $this->get_option('wpsg_mod_paypal_mwst'), array('help' => 'wpsg_shippay_mwst')); ?>
@@ -66,4 +69,5 @@
 
 <br />
+
 <?php echo wpsg_drawForm_Input('wpsg_mod_paypal_currency', __('WÃ€hrungscode (Standard: EUR)', 'wpsg'), $this->get_option('wpsg_mod_paypal_currency'), array('help' => 'wpsg_mod_paypal_currency')); ?>
 <?php echo wpsg_drawForm_Select('wpsg_mod_paypal_language', __('Sprache im PayPal Interface', 'wpsg'), array('DE' => __('Deutsch', 'wpsg'), 'US' => __('Englisch', 'wpsg'), 'FR' => __('FranzÃ¶sisch', 'wpsg')), $this->get_option('wpsg_mod_paypal_language'), array('help' => 'wpsg_mod_paypal_language')); ?>
