PluginProbe
PayPlug for WooCommerce (Official) / 1.2.11
PayPlug for WooCommerce (Official) v1.2.11
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 1.2.6 All 101 releases
payplug / src / Gateway / PayplugGatewayOney4x.php

PayplugGatewayOney4x.php in PayPlug for WooCommerce (Official) 1.2.11, at src/Gateway/PayplugGatewayOney4x.php

76 lines 2.8 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace Payplug\PayplugWoocommerce\Gateway;
4
5 // Exit if accessed directly
6 if (!defined('ABSPATH')) {
7 exit;
8 }
9
10 /**
11 * PayPlug WooCommerce Gateway.
12 *
13 * @package Payplug\PayplugWoocommerce\Gateway
14 */
15 class PayplugGatewayOney4x extends PayplugGatewayOney3x
16 {
17
18 public function __construct()
19 {
20 parent::__construct();
21 $this->id = 'oney_x4_with_fees';
22 $this->method_title = _x('PayPlug Oney 4x', 'Gateway method title', 'payplug');
23 $this->method_description = __('Enable PayPlug Oney 4x for your customers.', 'payplug');
24 $this->title = __('Pay by card in 4x with Oney', 'payplug');
25 }
26
27 /**
28 * Get payment icons.
29 *
30 * @return string
31 */
32 public function get_icon()
33 {
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';
66 $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)),
68 ]);
69 $icons_str = '';
70 foreach ($icons as $icon) {
71 $icons_str .= $icon;
72 }
73 return $icons_str;
74 }
75 }
76