You are here

protected function VisaCheckout::describeResponse in Commerce Authorize.Net 8

Formats an API response as a string.

Parameters

\CommerceGuys\AuthNet\Response\ResponseInterface $response: The API response object.

Return value

string The message.

2 calls to VisaCheckout::describeResponse()
VisaCheckout::logResponse in src/Plugin/Commerce/PaymentGateway/VisaCheckout.php
Writes an API response to the log for debugging.
VisaCheckout::validateConfigurationForm in src/Plugin/Commerce/PaymentGateway/VisaCheckout.php
Form validation handler.

File

src/Plugin/Commerce/PaymentGateway/VisaCheckout.php, line 294

Class

VisaCheckout
Provides the Authorize.net payment gateway.

Namespace

Drupal\commerce_authnet\Plugin\Commerce\PaymentGateway

Code

protected function describeResponse(ResponseInterface $response) {
  $messages = [];
  foreach ($response
    ->getMessages() as $message) {
    $messages[] = $message
      ->getCode() . ': ' . $message
      ->getText();
  }
  return $this
    ->t('Received response with code %code from Authorize.net: @messages', [
    '%code' => $response
      ->getResultCode(),
    '@messages' => implode("\n", $messages),
  ]);
}