/** * Update payment status to complete * * @param Mage_Sales_Model_Order_Payment $payment */ protected function _updatePaymentStatusCompleted(Mage_Sales_Model_Order_Payment $payment) { $comment = $this->_helper()->__('The transaction completed successfully.'); $payment->setTransactionId($this->_transactionId)->setPreparedMessage($comment)->setCurrencyCode($payment->getOrder()->getBaseCurrencyCode())->setIsTransactionApproved(true)->setIsTransactionClosed(true)->registerCaptureNotification($this->getOrder()->getTotalDue())->save(); $this->getOrder()->save(); // notify customer if ($invoice = $payment->getCreatedInvoice()) { $comment = $this->_helper()->__('Notified customer about invoice #%s.', $invoice->getIncrementId()); if (!$this->getOrder()->getEmailSent()) { $this->getOrder()->queueNewOrderEmail()->setIsCustomerNotified(true)->addStatusHistoryComment($comment)->save(); } else { $this->getOrder()->sendOrderUpdateEmail(true, $comment)->addStatusHistoryComment($comment)->save(); } } }