PluginProbe
PayPlug for WooCommerce (Official) / 3.1.0
PayPlug for WooCommerce (Official) v3.1.0
3.1.0 3.0.0 2.18.0 1.0.17 1.0.18 1.0.19 1.0.20 1.0.21 1.0.22 1.0.3 1.0.4 1.0.5 1.0.6 1.0.7 1.0.8 1.1.0 1.10.0 1.10.1 1.2.1 1.2.10 1.2.11 1.2.2 1.2.3 1.2.4 1.2.5 All 102 releases
← All changes | src/Gateway/PayplugGatewayOney3xWithoutFees.php +13 -39 1.10.0 → 3.1.0 View file →
@@ -10,21 +10,19 @@
10 10 }
11 11
12 12 /**
13 13 * PayPlug WooCommerce Gateway.
14 - *
15 - * @package Payplug\PayplugWoocommerce\Gateway
16 14 */
17 15 class PayplugGatewayOney3xWithoutFees extends PayplugGatewayOney3x
18 16 {
19 -
20 17 public function __construct()
21 18 {
22 19 parent::__construct();
23 - $this->id = 'oney_x3_without_fees';
24 - $this->method_title = _x('PayPlug Oney 3x', 'Gateway method title', 'payplug');
20 + $this->id = 'oney_x3_without_fees';
21 + $this->method_title = _x('PayPlug Oney 3x', 'Gateway method title', 'payplug');
25 22 $this->method_description = __('Enable PayPlug Oney 3x for your customers.', 'payplug');
26 - $this->title = __('Pay by credit card in 3x installments without fees with Oney', 'payplug');
23 + $this->title = __('Pay by credit card in 3x installments without fees with Oney', 'payplug');
24 + $this->has_fields = true;
27 25 }
28 26
29 27 /**
30 28 * Get payment icons.
@@ -32,48 +30,24 @@
32 30 * @return string
33 31 */
34 32 public function get_icon()
35 33 {
36 - if ($this->check_oney_is_available() === true) {
37 - $total_price = floatval(WC()->cart->total);
38 - $this->oney_response = $this->api->simulate_oney_payment($total_price,'without_fees');
39 - $currency = get_woocommerce_currency_symbol(get_option('woocommerce_currency'));
40 - $f = function ($fn) {
41 - return $fn;
42 - };
43 - if(is_array($this->oney_response)) {
44 - $this->description = <<<HTML
45 - <p>
46 - <div class="payplug-oney-flex">
47 - <div>{$f(__('Bring', 'payplug'))}:</div>
48 - <div>{$this->oney_response['x3_without_fees']['down_payment_amount']} {$currency}</div>
49 - </div>
50 - <div class="payplug-oney-flex">
51 - <div>{$f(__('1st monthly payment', 'payplug'))}:</div>
52 - <div>{$this->oney_response['x3_without_fees']['installments'][0]['amount']} {$currency}</div>
53 - </div>
54 - <div class="payplug-oney-flex">
55 - <div>{$f(__('2nd monthly payment', 'payplug'))}:</div>
56 - <div>{$this->oney_response['x3_without_fees']['installments'][1]['amount']} {$currency}</div>
57 - </div>
58 - </p>
59 -HTML;
60 - } else {
61 - $this->description = $this->oney_response;
62 - }
34 + $disable = $this->check_oney_is_available() === true ? '' : 'disable-checkout-icons';
35 + $country = PayplugWoocommerceHelper::getISOCountryCode();
36 +
37 + if (file_exists(PAYPLUG_GATEWAY_PLUGIN_URL . 'assets/images/checkout/x3_without_fees_' . $country . '.svg')) {
38 + $image = PAYPLUG_GATEWAY_PLUGIN_URL . 'assets/images/checkout/x3_without_fees_' . $country . '.svg';
39 + } else {
40 + $image = PAYPLUG_GATEWAY_PLUGIN_URL . 'assets/images/checkout/x3_without_fees_FR.svg';
63 41 }
64 42
65 - $country = PayplugWoocommerceHelper::getISOCountryCode();
66 - $available_img = file_exists(PAYPLUG_GATEWAY_PLUGIN_DIR . 'assets/images/Oney3x-' . $country . '.png') ? 'Oney3x-' . $country . '.png' : 'Oney3x.png';
67 - $disable_img = file_exists(PAYPLUG_GATEWAY_PLUGIN_DIR . 'assets/images/Oney3x_grey-' . $country . '.png') ? 'Oney3x_grey-' . $country . '.png' : 'Oney3x_grey.png';
68 - $image = ($this->check_oney_is_available() === true) ? $available_img : $disable_img;
69 -
70 43 $icons = apply_filters('payplug_payment_icons', [
71 - 'payplug' => sprintf('<img src="%s" alt="Oney 3x" class="payplug-payment-icon" />', esc_url(PAYPLUG_GATEWAY_PLUGIN_URL . '/assets/images/' . $image)),
44 + 'payplug' => sprintf('<img src="%s" alt="Oney 3x" class="payplug-payment-icon ' . $disable . '" />', esc_url($image)),
72 45 ]);
73 46 $icons_str = '';
74 47 foreach ($icons as $icon) {
75 48 $icons_str .= $icon;
76 49 }
50 +
77 51 return $icons_str;
78 52 }
79 53 }