| @@ -20,9 +20,9 @@ | ||
| 20 | 20 | $this->id = 'oney_x3_without_fees'; |
| 21 | 21 | $this->method_title = _x('PayPlug Oney 3x', 'Gateway method title', 'payplug'); |
| 22 | 22 | $this->method_description = __('Enable PayPlug Oney 3x for your customers.', 'payplug'); |
| 23 | 23 | $this->title = __('Pay by credit card in 3x 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,56 +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 | - | |
| 39 | - if (empty($this->oney_response)) { | |
| 40 | - $disable = 'disable-checkout-icons'; | |
| 41 | - } | |
| 42 | - | |
| 43 | - $currency = get_woocommerce_currency_symbol(get_option('woocommerce_currency')); | |
| 44 | - $f = function ($fn) { | |
| 45 | - return $fn; | |
| 46 | - }; | |
| 47 | - | |
| 48 | - if (is_array($this->oney_response)) { | |
| 49 | - $total_price_oney = floatval($this->oney_response['x3_without_fees']['down_payment_amount']); | |
| 50 | - foreach ($this->oney_response['x3_without_fees']['installments'] as $installment) { | |
| 51 | - $total_price_oney = $total_price_oney + floatval($installment['amount']); | |
| 52 | - } | |
| 53 | - | |
| 54 | - $this->description = <<<HTML | |
| 55 | - <div class="payplug-oney-flex"> | |
| 56 | - <div><b>{$f(__('oney_total', 'payplug'))}</b></div> | |
| 57 | - <div><b>{$total_price_oney} {$currency}</b></div> | |
| 58 | - </div> | |
| 59 | - <div class="payplug-oney-flex"> | |
| 60 | - <div>{$f(__('Bring', 'payplug'))}:</div> | |
| 61 | - <div>{$this->oney_response['x3_without_fees']['down_payment_amount']} {$currency}</div> | |
| 62 | - </div> | |
| 63 | - <div class="payplug-oney-flex"> | |
| 64 | - <div>{$f(__('1st monthly payment', 'payplug'))}:</div> | |
| 65 | - <div>{$this->oney_response['x3_without_fees']['installments'][0]['amount']} {$currency}</div> | |
| 66 | - </div> | |
| 67 | - <div class="payplug-oney-flex"> | |
| 68 | - <div>{$f(__('2nd monthly payment', 'payplug'))}:</div> | |
| 69 | - <div>{$this->oney_response['x3_without_fees']['installments'][1]['amount']} {$currency}</div> | |
| 70 | - </div> | |
| 71 | - <div> | |
| 72 | -{$f(__('oney_financing_cost', 'payplug'))} {$this->oney_response['x3_without_fees']['nominal_annual_percentage_rate']} {$currency} TAEG : {$this->oney_response['x3_without_fees']['effective_annual_percentage_rate']} % | |
| 73 | - </div> | |
| 74 | -HTML; | |
| 75 | - } else { | |
| 76 | - $this->description = $this->oney_response; | |
| 77 | - } | |
| 78 | - } else { | |
| 79 | - $disable = 'disable-checkout-icons'; | |
| 80 | - } | |
| 81 | - | |
| 34 | + $disable = $this->check_oney_is_available() === true ? '' : 'disable-checkout-icons'; | |
| 82 | 35 | $country = PayplugWoocommerceHelper::getISOCountryCode(); |
| 83 | 36 | |
| 84 | 37 | if (file_exists(PAYPLUG_GATEWAY_PLUGIN_URL . 'assets/images/checkout/x3_without_fees_' . $country . '.svg')) { |
| 85 | 38 | $image = PAYPLUG_GATEWAY_PLUGIN_URL . 'assets/images/checkout/x3_without_fees_' . $country . '.svg'; |