You are here

public function Onsite::buildAvsResponseCodeLabel in Commerce Core 8.2

Builds a label for the given AVS response code and card type.

Parameters

string $avs_response_code: The AVS response code.

string $card_type: The card type.

Return value

string|null The label, or NULL if not available.

Overrides PaymentGatewayBase::buildAvsResponseCodeLabel

1 call to Onsite::buildAvsResponseCodeLabel()
Onsite::createPayment in modules/payment_example/src/Plugin/Commerce/PaymentGateway/Onsite.php
Creates a payment.

File

modules/payment_example/src/Plugin/Commerce/PaymentGateway/Onsite.php, line 263

Class

Onsite
Provides the On-site payment gateway.

Namespace

Drupal\commerce_payment_example\Plugin\Commerce\PaymentGateway

Code

public function buildAvsResponseCodeLabel($avs_response_code, $card_type) {
  if ($card_type == 'dinersclub' || $card_type == 'jcb') {
    if ($avs_response_code == 'A') {
      return $this
        ->t('Approved.');
    }
    return NULL;
  }
  return parent::buildAvsResponseCodeLabel($avs_response_code, $card_type);
}