/**
  * @param Market_TransactionModel $transaction
  * @param ResponseInterface       $response
  *
  * @throws Exception
  */
 private function updateTransaction(Market_TransactionModel $transaction, ResponseInterface $response)
 {
     if ($response->isSuccessful()) {
         $transaction->status = Market_TransactionRecord::SUCCESS;
     } elseif ($response->isRedirect()) {
         $transaction->status = Market_TransactionRecord::REDIRECT;
     } else {
         $transaction->status = Market_TransactionRecord::FAILED;
     }
     $transaction->reference = $response->getTransactionReference();
     $transaction->message = $response->getMessage();
     if ($response->isSuccessful()) {
         craft()->market_order->updateOrderPaidTotal($transaction->order);
     }
     $this->saveTransaction($transaction);
 }