You are here

protected function OnsiteBase::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 OnsiteBase::describeResponse()
OnsiteBase::logResponse in src/Plugin/Commerce/PaymentGateway/OnsiteBase.php
Writes an API response to the log for debugging.
OnsiteBase::validateConfigurationForm in src/Plugin/Commerce/PaymentGateway/OnsiteBase.php
Form validation handler.

File

src/Plugin/Commerce/PaymentGateway/OnsiteBase.php, line 351

Class

OnsiteBase
Provides the Authorize.net payment gateway base class.

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),
  ]);
}