/**
  * if cart is edited at shop, send new data to SOFORT
  * @param string $transactionId
  * @param array	 $articles
  * @param string $comment
  */
 public function editArticlesSofort($transactionId, $articles, $comment = '')
 {
     $PnagInvoice = new PnagInvoice(shopGetConfigKey(), $transactionId);
     $sofortArticles = array();
     $orderId = '';
     $taxLow = 0;
     $taxHigh = 0;
     $subtotal = 0;
     $shipping = 0;
     $discount = array();
     $agio = array();
     foreach ($articles as $article) {
         if ($orderId == '') {
             $orderId = (int) $article['articleOrdersId'];
         }
         if ($article['articleQuantity'] != 'delete') {
             array_push($sofortArticles, array('itemId' => $article['articleId'], 'productNumber' => $article['articleNumber'], 'title' => HelperFunctions::convertEncoding($article['articleTitle'], 3), 'description' => HelperFunctions::convertEncoding($article['articleDescription'], 3), 'quantity' => $article['articleQuantity'], 'unitPrice' => number_format($article['articlePrice'], 2, '.', ''), 'tax' => number_format($article['articleTax'], 2, '.', '')));
         }
         switch ($article['articleType']) {
             case 'shipping':
                 $shipping = $article['articlePrice'];
                 break;
             case 'discount':
                 $splitItemId = explode('|', $article['articleId']);
                 $discountClass = $splitItemId[1];
                 array_push($discount, array('class' => $discountClass, 'value' => $article['articlePrice']));
                 break;
             case 'agio':
                 $splitItemId = explode('|', $article['articleId']);
                 $agioClass = $splitItemId[1];
                 array_push($agio, array('class' => $agioClass, 'value' => $article['articlePrice']));
                 break;
             case 'product':
                 $subtotal += $article['articleQuantity'] * $article['articlePrice'];
                 break;
         }
         switch ($article['articleTax']) {
             case 7:
                 $taxLow += $article['articleQuantity'] * $article['articlePrice'];
                 break;
             case 19:
                 $taxHigh += $article['articleQuantity'] * $article['articlePrice'];
                 break;
         }
     }
     $lastShopTotal = HelperFunctions::getLastFieldValueFromSofortTable($orderId, 'amount');
     $time = strftime('%Y-%m-%d %H:%M:%S', time());
     $errors = $PnagInvoice->updateInvoice($transactionId, $sofortArticles, $comment);
     $warnings = $PnagInvoice->getWarnings();
     if ($errors) {
         return array('errors' => $errors, 'warnings' => $warnings);
     }
     $PnagInvoice->refreshTransactionData();
     $orderStatus = shopDbQuery('SELECT orders_status FROM ' . TABLE_ORDERS . ' WHERE orders_id = "' . $orderId . '"');
     $orderStatus = shopDbFetchArray($orderStatus);
     $this->_insertNewTotalCommentToHistory($orderId, $orderStatus['orders_status'], $time, $PnagInvoice, $lastShopTotal);
     $this->editArticlesShop($PnagInvoice, $orderId);
     return false;
 }
 $successCodes = false;
 $errorCodes = false;
 $lang = $_SESSION['languages_id'];
 $ordersStatuses = array();
 $ordersStatusArray = array();
 $ordersStatusQuery = shopDbQuery('SELECT orders_status_id, orders_status_name FROM ' . TABLE_ORDERS_STATUS . ' WHERE language_id = \'' . (int) $lang . '\'');
 $action = isset($_GET['action']) ? $_GET['action'] : '';
 while ($ordersStatus = shopDbFetchArray($ordersStatusQuery)) {
     $ordersStatuses[] = array('id' => $ordersStatus['orders_status_id'], 'text' => $ordersStatus['orders_status_name']);
     $ordersStatusArray[$ordersStatus['orders_status_id']] = $ordersStatus['orders_status_name'];
 }
 $getLng = $_SESSION['language'];
 require shopGetLanguageFile($getLng, $paymentMethodShort);
 require shopGetLanguageFile($getLng, 'general');
 $logo = shopGetLogo($paymentMethodShort);
 $PnagInvoice = new PnagInvoice(shopGetConfigKey(), $tId);
 if ($_POST['sofort_action'] == 'sofort_comment') {
     shopSofortComment($_GET['oID'], $order, $_POST['status'], $_POST['comments'], $_POST['notify'], $_POST['notify_comments']);
 }
 if ($_POST['sofort_action'] == 'sofort_save' && $_POST['sofort_delete_all'] == '1') {
     $_POST['sofort_action'] = 'sofort_buttons';
     $_POST['sofort_button'] = 'cancel';
 }
 if ($_POST['sofort_action'] == 'sofort_buttons') {
     switch ($_POST['sofort_button']) {
         case 'invoice':
         case 'preview':
         case 'credit':
             $PnagInvoice->getInvoice();
             break;
         case 'confirm':