/**
  * Returns an array of errors, in the format $error_code => $error_message.
  * This should be an empty array on transaction success.
  *
  * @deprecated
  *
  * @return array
  */
 public function getTransactionErrors()
 {
     if ($this->transaction_response && $this->transaction_response->getErrors()) {
         $simplify = function ($error) {
             return $error['message'];
         };
         return array_map($simplify, $this->transaction_response->getErrors());
     } else {
         return array();
     }
 }
 /**
  * Build a PaymentResult object from adapter results
  *
  * @param PaymentTransactionResponse $response processed response object
  * @param string $finalStatus final transaction status.
  *
  * @return PaymentResult
  */
 public static function fromResults(PaymentTransactionResponse $response, $finalStatus)
 {
     if ($finalStatus === FinalStatus::FAILED) {
         return PaymentResult::newFailure($response->getErrors());
     }
     if (!$response) {
         return PaymentResult::newEmpty();
     }
     if ($response->getErrors()) {
         // TODO: We will probably want the ability to refresh to a new form
         // as well and display errors at the same time.
         return PaymentResult::newRefresh($response->getErrors());
     }
     if ($response->getRedirect()) {
         return PaymentResult::newRedirect($response->getRedirect());
     }
     return PaymentResult::newSuccess();
 }