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