Add new AXO credit card icons

This commit is contained in:
Daniel Dudzic 2024-05-06 15:22:49 +02:00
parent fe3e4762dd
commit ed82a8df2b
No known key found for this signature in database
GPG key ID: 31B40D33E3465483
3 changed files with 59 additions and 3 deletions

View file

@ -68,6 +68,7 @@ return array(
$container->get( 'wcgateway.url' ),
$container->get( 'wcgateway.order-processor' ),
$container->get( 'axo.card_icons' ),
$container->get( 'axo.card_icons.axo' ),
$container->get( 'api.endpoint.order' ),
$container->get( 'api.factory.purchase-unit' ),
$container->get( 'api.factory.shipping-preference' ),
@ -98,6 +99,35 @@ return array(
);
},
'axo.card_icons.axo' => static function ( ContainerInterface $container ): array {
return array(
array(
'title' => 'Dinersclub',
'file' => 'dinersclub-light.svg',
),
array(
'title' => 'Discover',
'file' => 'discover-light.svg',
),
array(
'title' => 'JCB',
'file' => 'jcb-light.svg',
),
array(
'title' => 'MasterCard',
'file' => 'mastercard-light.svg',
),
array(
'title' => 'UnionPay',
'file' => 'unionpay-light.svg',
),
array(
'title' => 'Visa',
'file' => 'visa-light.svg',
),
);
},
/**
* The matrix which countries and currency combinations can be used for AXO.
*/

View file

@ -70,6 +70,13 @@ class AxoGateway extends WC_Payment_Gateway {
*/
protected $card_icons;
/**
* The AXO card icons.
*
* @var array
*/
protected $card_icons_axo;
/**
* The order endpoint.
*
@ -120,6 +127,7 @@ class AxoGateway extends WC_Payment_Gateway {
* @param string $wcgateway_module_url The WcGateway module URL.
* @param OrderProcessor $order_processor The Order processor.
* @param array $card_icons The card icons.
* @param array $card_icons_axo The card icons.
* @param OrderEndpoint $order_endpoint The order endpoint.
* @param PurchaseUnitFactory $purchase_unit_factory The purchase unit factory.
* @param ShippingPreferenceFactory $shipping_preference_factory The shipping preference factory.
@ -133,6 +141,7 @@ class AxoGateway extends WC_Payment_Gateway {
string $wcgateway_module_url,
OrderProcessor $order_processor,
array $card_icons,
array $card_icons_axo,
OrderEndpoint $order_endpoint,
PurchaseUnitFactory $purchase_unit_factory,
ShippingPreferenceFactory $shipping_preference_factory,
@ -147,6 +156,7 @@ class AxoGateway extends WC_Payment_Gateway {
$this->wcgateway_module_url = $wcgateway_module_url;
$this->order_processor = $order_processor;
$this->card_icons = $card_icons;
$this->card_icons_axo = $card_icons_axo;
$this->method_title = __( 'Fastlane Debit & Credit Cards', 'woocommerce-paypal-payments' );
$this->method_description = __( 'PayPal Fastlane offers an accelerated checkout experience that recognizes guest shoppers and autofills their details so they can pay in seconds.', 'woocommerce-paypal-payments' );
@ -285,18 +295,26 @@ class AxoGateway extends WC_Payment_Gateway {
* @return string
*/
public function get_icon() {
$icon = parent::get_icon();
$icon = parent::get_icon();
$icons = $this->card_icons;
$icons_src = esc_url( $this->wcgateway_module_url ) . 'assets/images/';
if ( $this->card_icons_axo ) {
$icons = $this->card_icons_axo;
$icons_src = esc_url( $this->wcgateway_module_url ) . 'assets/images/axo/';
}
if ( empty( $this->card_icons ) ) {
return $icon;
}
$images = array();
foreach ( $this->card_icons as $card ) {
foreach ( $icons as $card ) {
$images[] = '<img
class="ppcp-card-icon"
title="' . $card['title'] . '"
src="' . esc_url( $this->wcgateway_module_url ) . 'assets/images/' . $card['file'] . '"
src="' . $icons_src . $card['file'] . '"
> ';
}

View file

@ -803,6 +803,14 @@ return array(
'elo' => _x( 'Elo', 'Name of credit card', 'woocommerce-paypal-payments' ),
'hiper' => _x( 'Hiper', 'Name of credit card', 'woocommerce-paypal-payments' ),
),
'options_axo' => array(
'dinersclub-light' => _x( 'Diners Club (light)', 'Name of credit card', 'woocommerce-paypal-payments' ),
'discover-light' => _x( 'Discover (light)', 'Name of credit card', 'woocommerce-paypal-payments' ),
'jcb-light' => _x( 'JCB (light)', 'Name of credit card', 'woocommerce-paypal-payments' ),
'mastercard-light' => _x( 'Mastercard (light)', 'Name of credit card', 'woocommerce-paypal-payments' ),
'unionpay-light' => _x( 'UnionPay (light)', 'Name of credit card', 'woocommerce-paypal-payments' ),
'visa-light' => _x( 'Visa (light)', 'Name of credit card', 'woocommerce-paypal-payments' ),
),
'screens' => array(
State::STATE_ONBOARDED,
),