You are here

public function CreditCardPaymentMethodBase::cartReview in Ubercart 8.4

Returns the payment method review details.

Parameters

\Drupal\uc_order\OrderInterface $order: The order that is being processed.

Return value

array

Overrides PaymentMethodPluginBase::cartReview

File

payment/uc_credit/src/CreditCardPaymentMethodBase.php, line 343

Class

CreditCardPaymentMethodBase
Defines a base credit card payment method plugin implementation.

Namespace

Drupal\uc_credit

Code

public function cartReview(OrderInterface $order) {
  $fields = $this
    ->getEnabledFields();
  if (!empty($fields['type'])) {
    $review[] = [
      'title' => $this
        ->t('Card type'),
      'data' => $order->payment_details['cc_type'],
    ];
  }
  if (!empty($fields['owner'])) {
    $review[] = [
      'title' => $this
        ->t('Card owner'),
      'data' => $order->payment_details['cc_owner'],
    ];
  }
  $review[] = [
    'title' => $this
      ->t('Card number'),
    'data' => $this
      ->displayCardNumber($order->payment_details['cc_number']),
  ];
  if (!empty($fields['start'])) {
    $start = $order->payment_details['cc_start_month'] . '/' . $order->payment_details['cc_start_year'];
    $review[] = [
      'title' => $this
        ->t('Start date'),
      'data' => strlen($start) > 1 ? $start : '',
    ];
  }
  $review[] = [
    'title' => $this
      ->t('Expiration'),
    'data' => $order->payment_details['cc_exp_month'] . '/' . $order->payment_details['cc_exp_year'],
  ];
  if (!empty($fields['issue'])) {
    $review[] = [
      'title' => $this
        ->t('Issue number'),
      'data' => $order->payment_details['cc_issue'],
    ];
  }
  if (!empty($fields['bank'])) {
    $review[] = [
      'title' => $this
        ->t('Issuing bank'),
      'data' => $order->payment_details['cc_bank'],
    ];
  }
  return $review;
}