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/PayplugGatewayOney4x.php +3 -48 3.0.0 → 3.1.0 View file →
@@ -18,9 +18,9 @@
18 18 $this->id = 'oney_x4_with_fees';
19 19 $this->method_title = _x('PayPlug Oney 4x', 'Gateway method title', 'payplug');
20 20 $this->method_description = __('Enable PayPlug Oney 4x for your customers.', 'payplug');
21 21 $this->title = __('Pay by card in 4x with Oney', 'payplug');
22 - $this->has_fields = false;
22 + $this->has_fields = true;
23 23 }
24 24
25 25 /**
26 26 * Get payment icons.
@@ -28,56 +28,11 @@
28 28 * @return string
29 29 */
30 30 public function get_icon()
31 31 {
32 - if ($this->check_oney_is_available() === true) {
33 - $total_price = floatval(WC()->cart->total);
34 - $this->oney_response = $this->payplug_api->simulate_oney_payment($total_price, 'with_fees');
35 - $currency = get_woocommerce_currency_symbol(get_option('woocommerce_currency'));
36 - $total_price_oney = floatval($this->oney_response['x4_with_fees']['down_payment_amount']);
37 - foreach ($this->oney_response['x4_with_fees']['installments'] as $installment) {
38 - $total_price_oney = $total_price_oney + floatval($installment['amount']);
39 - }
32 + $disable = $this->check_oney_is_available() === true ? '' : 'disable-checkout-icons';
33 + $available_img = 'x4_with_fees.svg';
40 34
41 - $tax_cost = floatval($this->oney_response['x4_with_fees']['total_cost']) / 100;
42 - $disable = '';
43 - $f = fn ($fn) => $fn;
44 - if (is_array($this->oney_response)) {
45 - $this->description = <<<HTML
46 - <p>
47 - <div class="payplug-oney-flex">
48 - <div>{$f(__('Bring', 'payplug'))}:</div>
49 - <div>{$this->oney_response['x4_with_fees']['down_payment_amount']} {$currency}</div>
50 - </div>
51 - <div class="payplug-oney-flex">
52 - <small>( {$f(__('oney_financing_cost', 'payplug'))} <b>{$tax_cost} {$currency}</b> TAEG : <b>{$this->oney_response['x4_with_fees']['effective_annual_percentage_rate']} %</b> )</small>
53 - </div>
54 - <div class="payplug-oney-flex">
55 - <div>{$f(__('1st monthly payment', 'payplug'))}:</div>
56 - <div>{$this->oney_response['x4_with_fees']['installments'][0]['amount']} {$currency}</div>
57 - </div>
58 - <div class="payplug-oney-flex">
59 - <div>{$f(__('2nd monthly payment', 'payplug'))}:</div>
60 - <div>{$this->oney_response['x4_with_fees']['installments'][1]['amount']} {$currency}</div>
61 - </div>
62 - <div class="payplug-oney-flex">
63 - <div>{$f(__('3rd monthly payment', 'payplug'))}:</div>
64 - <div>{$this->oney_response['x4_with_fees']['installments'][2]['amount']} {$currency}</div>
65 - </div>
66 - <div class="payplug-oney-flex">
67 - <div><b>{$f(__('oney_total', 'payplug'))}</b></div>
68 - <div><b>{$total_price_oney} {$currency}</b></div>
69 - </div>
70 - </p>
71 -HTML;
72 - } else {
73 - $this->description = $this->oney_response;
74 - }
75 - } else {
76 - $disable = 'disable-checkout-icons';
77 - }
78 -
79 - $available_img = 'x4_with_fees.svg';
80 35 $icons = apply_filters('payplug_payment_icons', [
81 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)),
82 37 ]);
83 38 $icons_str = '';