/**
  * update invoice items to sofortueberweisung
  * 
  * @param Varien_Object $payment object of the order
  * @param array $items of the the invoice
  * @param string $comment to add
  * @param string $invoiceNumber
  * @param string $customerNumber
  * @param string $orderNumber
  * @return Paymentnetwork_Pnsofortueberweisung_Model_Sofortrechnung
  * @throws Exception
  */
 public function updateInvoice(Varien_Object $payment, $items, $comment, $invoiceNumber = '', $customerNumber = '', $orderNumber = '')
 {
     // load current transaction id
     $transactionId = $payment->getAdditionalInformation('sofort_transaction');
     $order = $payment->getOrder();
     if (!empty($transactionId)) {
         // create articles
         $pnagArticles = array();
         foreach ($items as $item) {
             array_push($pnagArticles, array('itemId' => $item['item_id'], 'productNumber' => $item['product_number'], 'productType' => $item['product_type'], 'title' => $item['title'], 'description' => $item['description'], 'quantity' => $item['quantity'], 'unitPrice' => $item['unit_price'], 'tax' => $item['tax']));
         }
         // create connection class
         $PnagInvoice = new PnagInvoice(Mage::getStoreConfig('payment/sofort/configkey'), $transactionId);
         $PnagInvoice->setTransactionId($transactionId);
         $PnagInvoice->updateInvoice($transactionId, $pnagArticles, $comment, $invoiceNumber, $customerNumber, $orderNumber);
         // add error
         if ($PnagInvoice->isError()) {
             Mage::throwException($PnagInvoice->getError());
         } else {
             // update history
             $order->addStatusHistoryComment(Mage::helper('pnsofortueberweisung')->__('The invoice has been edit.') . "\n\n\"" . $comment . '"');
             $order->save();
             Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('pnsofortueberweisung')->__('Successfully edit invoice.'));
             return $this;
         }
     }
     // no transaction id exist
     Mage::getSingleton('adminhtml/session')->addError(Mage::helper('pnsofortueberweisung')->__('Could not edit invoice.'));
     return $this;
 }
$PnagInvoice->setEmailCustomer('*****@*****.**');
$PnagInvoice->addItemToInvoice(md5('unique'), 'Art01', 'a simple title', 1.2, 0, 'a simple description', 6, 19);
$PnagInvoice->setAbortUrl('http://127.0.0.1');
$PnagInvoice->setSuccessUrl('http://127.0.0.1');
$PnagInvoice->setTimeoutUrl('http://127.0.0.1');
$PnagInvoice->setNotificationUrl('http://127.0.0.1');
try {
    $err = $PnagInvoice->checkout();
    getWebPage($PnagInvoice->getPaymentUrl());
} catch (XmlToArrayException $e) {
}
$transactionId = $PnagInvoice->getTransactionId();
$articles = array(array('articleId' => md5('unique'), 'articleNumber' => 'Art01', 'articleTitle' => 'a simple title', 'articlePrice' => 1.2, 'articleType' => 0, 'articleDescription' => 'a simple description', 'articleQuantity' => 2, 'articleTax' => 19));
$PnagInvoice = null;
$PnagInvoice = new PnagInvoice(CONFIGKEY, $transactionId);
$PnagInvoice->setTransactionId($transactionId);
$pnagArticles = array();
foreach ($articles as $article) {
    array_push($pnagArticles, array('itemId' => $article['articleId'], 'productNumber' => $article['articleNumber'], 'title' => $article['articleTitle'], 'description' => $article['articleDescription'], 'quantity' => $article['articleQuantity'], 'unitPrice' => number_format($article['articlePrice'], 2, '.', ''), 'tax' => number_format($article['articleTax'], 2, '.', '')));
}
$invoiceNumber = "10234";
$customerNumber = "10234";
$orderNumber = "10234";
try {
    $comment = 'must not be left empty for confirmed invoices, editing an invoice will result in refunded items';
    $PnagInvoice->updateInvoice($transactionId, $pnagArticles, $comment, $invoiceNumber, $customerNumber, $orderNumber);
} catch (XmlToArrayException $e) {
}
/**
 * Get a web file (HTML, XHTML, XML, image, etc.) from a URL.  Return an
 * array containing the HTTP server response header fields and content.