Commit 2027f3d4 authored by Essam Al-Qaie's avatar Essam Al-Qaie Committed by Jonathan Sacksick
Browse files

Issue #3251900 by 3ssom, thenchev: Add credit card icons on checkout

parent 76d14807
Loading
Loading
Loading
Loading
+18 −0
Original line number Diff line number Diff line
@@ -21,3 +21,21 @@ function commerce_authnet_requirements($phase) {

  return $requirements;
}

/**
 * Disables credit card icon settings on existing payment gateways.
 */
function commerce_authnet_update_8101() {
  $payment_gateways = \Drupal::entityTypeManager()
    ->getStorage('commerce_payment_gateway')
    ->loadMultiple();

  foreach ($payment_gateways as $payment_gateway) {
    if ($payment_gateway->getPluginId() == 'authorizenet_acceptjs') {
      $configuration = $payment_gateway->getPluginConfiguration();
      $configuration['enable_credit_card_icons'] = FALSE;
      $payment_gateway->setPluginConfiguration($configuration);
      $payment_gateway->save();
    }
  }
}
+6 −0
Original line number Diff line number Diff line
@@ -75,3 +75,9 @@ cardinalcruise:
    "https://songbird.cardinalcommerce.com/edge/v1/songbird.js": { type: external, attributes: { charset: utf-8 } }
  dependencies:
  - commerce_authnet/form-accept

credit_card_icons:
  version: VERSION
  css:
    theme:
      css/commerce_authnet.credit_card_icons.css: {}
+15 −0
Original line number Diff line number Diff line
@@ -7,6 +7,21 @@

use Drupal\Core\Form\FormStateInterface;

/**
 * Implements hook_theme().
 */
function commerce_authnet_theme() {
  $theme = [
    'commerce_authnet_credit_card_logos' => [
      'variables' => [
        'credit_cards' => [],
      ],
    ],
  ];

  return $theme;
}

/**
 * Implements hook_form_alter().
 */
+3 −0
Original line number Diff line number Diff line
@@ -22,6 +22,9 @@ commerce_payment.commerce_payment_gateway.plugin.authorizenet_acceptjs:
    cca_api_key:
      type: string
      label: 'Cardinal Cruise Authentication: API Key'
    enable_credit_card_icons:
      type: boolean
      label: 'Enable credit card icons'

commerce_payment.commerce_payment_gateway.plugin.authorizenet_echeck:
  type: commerce_payment_gateway_configuration
+43 −0
Original line number Diff line number Diff line
/**
 * Payment method icon list.
 */
.payment-method-icon-list {
  margin: 0 0 1em;
  padding: 0;
  font-size: 0;
}

.payment-method-icon-list .payment-method-icon {
  position: relative;
  margin: 0 10px 10px 0;
  width: 40px;
  height: 25px;
  background-size: 40px 25px;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, .1);
  border-radius: 4px;
}

@media all and (min-width: 851px) {
  .payment-method-icon-list .payment-method-icon {
    margin: 0 15px 15px 0;
    width: 54px;
    height: 34px;
    background-size: 54px 34px;
  }
}

/* When payment method icon is inactive. */
.payment-method-icon-list .payment-method-icon.inactive {
  opacity: .4;
  filter: grayscale(100%);
}

/* When payment method icon is active. */
.payment-method-icon-list .payment-method-icon.active {
  opacity: 1;
  filter: none;
}

.payment-method-icon-list .payment-method-icon:first-child {
  margin-left: 0;
}
Loading