| @@ -8,21 +8,19 @@ | ||
| 8 | 8 | } |
| 9 | 9 | |
| 10 | 10 | /** |
| 11 | 11 | * PayPlug WooCommerce Gateway. |
| 12 | - * | |
| 13 | - * @package Payplug\PayplugWoocommerce\Gateway | |
| 14 | 12 | */ |
| 15 | 13 | class PayplugGatewayOney4x extends PayplugGatewayOney3x |
| 16 | 14 | { |
| 17 | - | |
| 18 | 15 | public function __construct() |
| 19 | 16 | { |
| 20 | 17 | parent::__construct(); |
| 21 | - $this->id = 'oney_x4_with_fees'; | |
| 22 | - $this->method_title = _x('PayPlug Oney 4x', 'Gateway method title', 'payplug'); | |
| 18 | + $this->id = 'oney_x4_with_fees'; | |
| 19 | + $this->method_title = _x('PayPlug Oney 4x', 'Gateway method title', 'payplug'); | |
| 23 | 20 | $this->method_description = __('Enable PayPlug Oney 4x for your customers.', 'payplug'); |
| 24 | - $this->title = __('Pay by card in 4x with Oney', 'payplug'); | |
| 21 | + $this->title = __('Pay by card in 4x with Oney', 'payplug'); | |
| 22 | + $this->has_fields = true; | |
| 25 | 23 | } |
| 26 | 24 | |
| 27 | 25 | /** |
| 28 | 26 | * Get payment icons. |
| @@ -30,46 +28,18 @@ | ||
| 30 | 28 | * @return string |
| 31 | 29 | */ |
| 32 | 30 | public function get_icon() |
| 33 | 31 | { |
| 34 | - parent::get_icon(); | |
| 35 | - if ($this->check_oney_is_available() === true) { | |
| 36 | - $currency = get_woocommerce_currency_symbol(get_option('woocommerce_currency')); | |
| 37 | - $f = function ($fn) { | |
| 38 | - return $fn; | |
| 39 | - }; | |
| 40 | - if(is_array($this->oney_response)) { | |
| 41 | - $this->description = <<<HTML | |
| 42 | - <p> | |
| 43 | - <div class="payplug-oney-flex"> | |
| 44 | - <div>{$f(__('Bring', 'payplug'))} :</div> | |
| 45 | - <div>{$this->oney_response['x4_with_fees']['down_payment_amount']} {$currency}</div> | |
| 46 | - </div> | |
| 47 | - <div class="payplug-oney-flex"> | |
| 48 | - <div>{$f(__('1st monthly payment', 'payplug'))} :</div> | |
| 49 | - <div>{$this->oney_response['x4_with_fees']['installments'][0]['amount']} {$currency}</div> | |
| 50 | - </div> | |
| 51 | - <div class="payplug-oney-flex"> | |
| 52 | - <div>{$f(__('2nd monthly payment', 'payplug'))} :</div> | |
| 53 | - <div>{$this->oney_response['x4_with_fees']['installments'][1]['amount']} {$currency}</div> | |
| 54 | - </div> | |
| 55 | - <div class="payplug-oney-flex"> | |
| 56 | - <div>{$f(__('3rd monthly payment', 'payplug'))} :</div> | |
| 57 | - <div>{$this->oney_response['x4_with_fees']['installments'][2]['amount']} {$currency}</div> | |
| 58 | - </div> | |
| 59 | - </p> | |
| 60 | -HTML; | |
| 61 | - } else { | |
| 62 | - $this->description = $this->oney_response; | |
| 63 | - } | |
| 64 | - } | |
| 65 | - $available_img = ($this->check_oney_is_available() === true) ? 'lg-4xoney-checkout.png' : 'lg-4xoney-checkout-disabled.png'; | |
| 32 | + $disable = $this->check_oney_is_available() === true ? '' : 'disable-checkout-icons'; | |
| 33 | + $available_img = 'x4_with_fees.svg'; | |
| 34 | + | |
| 66 | 35 | $icons = apply_filters('payplug_payment_icons', [ |
| 67 | - 'payplug' => sprintf('<img src="%s" alt="Oney 3x" class="payplug-payment-icon" />', esc_url(PAYPLUG_GATEWAY_PLUGIN_URL . '/assets/images/' . $available_img)), | |
| 36 | + 'payplug' => sprintf('<img src="%s" alt="Oney 4x" class="payplug-payment-icon ' . $disable . '" />', esc_url(PAYPLUG_GATEWAY_PLUGIN_URL . '/assets/images/checkout/' . $available_img)), | |
| 68 | 37 | ]); |
| 69 | 38 | $icons_str = ''; |
| 70 | 39 | foreach ($icons as $icon) { |
| 71 | 40 | $icons_str .= $icon; |
| 72 | 41 | } |
| 42 | + | |
| 73 | 43 | return $icons_str; |
| 74 | 44 | } |
| 75 | 45 | } |