public function refundByLineItems($items, $close = false, $additionalMessage = '') { $this->refundByLineItemsDry($items, $close, $additionalMessage); $amount = Customweb_Util_Invoice::getTotalAmountIncludingTax($items); $historyMessage = Customweb_I18n_Translation::__("A refund was added over !amount.", array('!amount' => Customweb_Util_Currency::formatAmount($amount, $this->getCurrencyCode()))); if (!empty($additionalMessage)) { $historyMessage .= ' (' . $additionalMessage . ')'; } $refundItem = $this->createRefundItem($amount); $refundItem->setRefundItems($items); $this->createHistoryItem($historyMessage, Customweb_Payment_Authorization_ITransactionHistoryItem::ACTION_REFUND); if (Customweb_Util_Currency::compareAmount($this->getRefundedTotalAmount(), $this->getCapturedAmount(), $this->getCurrencyCode()) >= 0) { $close = true; } $this->refundClosed = $close; return $refundItem; }