mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-06 18:16:38 +08:00
Add new AXO credit card icons
This commit is contained in:
parent
fe3e4762dd
commit
ed82a8df2b
3 changed files with 59 additions and 3 deletions
|
@ -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.
|
||||
*/
|
||||
|
|
|
@ -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'] . '"
|
||||
> ';
|
||||
}
|
||||
|
||||
|
|
|
@ -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,
|
||||
),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue