/** * 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; }
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': $errors = $PnagInvoice->confirmInvoice(); $warnings = $PnagInvoice->getWarnings(); break; case 'cancel': $errors = $PnagInvoice->cancelInvoice(); $warnings = $PnagInvoice->getWarnings(); break; default: break; } $errorCodes = ""; $successCodes = ""; if ($errors) { $errorCodes .= "<div class='sofort_error'>"; foreach ($errors as $oneError) { if (defined('MODULE_PAYMENT_SOFORT_MULTIPAY_XML_FAULT_' . $oneError['code'])) { $errorCodes .= constant('MODULE_PAYMENT_SOFORT_MULTIPAY_XML_FAULT_' . $oneError['code']) . "<br/>";