id = 'oney_x4_without_fees'; $this->method_title = _x('PayPlug Oney 4x', 'Gateway method title', 'payplug'); $this->method_description = __('Enable PayPlug Oney 4x for your customers.', 'payplug'); $this->title = __('Pay by credit card in 4x installments without fees with Oney', 'payplug'); } /** * Get payment icons. * * @return string */ public function get_icon() { if ($this->check_oney_is_available() === true) { $total_price = floatval(WC()->cart->total); $this->oney_response = $this->api->simulate_oney_payment($total_price, 'without_fees'); $currency = get_woocommerce_currency_symbol(get_option('woocommerce_currency')); $f = function ($fn) { return $fn; }; if(is_array($this->oney_response)) { $this->description = <<
{$f(__('Bring', 'payplug'))}:
{$this->oney_response['x4_without_fees']['down_payment_amount']} {$currency}
{$f(__('1st monthly payment', 'payplug'))}:
{$this->oney_response['x4_without_fees']['installments'][0]['amount']} {$currency}
{$f(__('2nd monthly payment', 'payplug'))}:
{$this->oney_response['x4_without_fees']['installments'][1]['amount']} {$currency}
{$f(__('3rd monthly payment', 'payplug'))}:
{$this->oney_response['x4_without_fees']['installments'][2]['amount']} {$currency}

HTML; } else { $this->description = $this->oney_response; } } $country = PayplugWoocommerceHelper::getISOCountryCode(); $available_img = file_exists(PAYPLUG_GATEWAY_PLUGIN_DIR . 'assets/images/Oney4x-' . $country . '.png') ? 'Oney4x-' . $country . '.png' : 'Oney4x.png'; $disable_img = file_exists(PAYPLUG_GATEWAY_PLUGIN_DIR . 'assets/images/Oney4x_grey-' . $country . '.png') ? 'Oney4x_grey-' . $country . '.png' : 'Oney4x_grey.png'; $image = ($this->check_oney_is_available() === true) ? $available_img : $disable_img; $icons = apply_filters('payplug_payment_icons', [ 'payplug' => sprintf('Oney 4x', esc_url(PAYPLUG_GATEWAY_PLUGIN_URL . '/assets/images/' . $image)), ]); $icons_str = ''; foreach ($icons as $icon) { $icons_str .= $icon; } return $icons_str; } }