Skip to content

Commit a5e1135

Browse files
committed
v2.1.0
1 parent 09a893f commit a5e1135

4 files changed

Lines changed: 19 additions & 8 deletions

File tree

CryptAPI.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
Plugin Name: CryptAPI Payment Gateway for WooCommerce
55
Plugin URI: https://github.com/cryptapi/woocommerce-cryptapi
66
Description: Accept cryptocurrency payments on your WooCommerce website
7-
Version: 2.0.1
7+
Version: 2.1.0
88
Requires at least: 4.0
99
Tested up to: 5.8
1010
WC requires at least: 2.4

controllers/CryptAPI.php

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ private function ca_settings() {
4848
$this->qrcode_size = $this->get_option('qrcode_size');
4949
$this->coins = $this->get_option('coins');
5050
$this->show_branding = $this->get_option('show_branding') === 'yes';
51+
$this->disable_conversion = $this->get_option('disable_conversion') === 'yes';
5152

5253
if (!$this->show_branding) {
5354
$this->icon = '';
@@ -86,6 +87,12 @@ function init_form_fields()
8687
'label' => __('Show CryptAPI logo and credits below the QR code', 'cryptapi'),
8788
'default' => 'yes'
8889
),
90+
'disable_conversion' => array(
91+
'title' => __('Disable price conversion', 'cryptapi'),
92+
'type' => 'checkbox',
93+
'label' => __("<b>Attention: This option will disable the price conversion for ALL cryptocurrencies!</b><br/>If you check this, pricing will not be converted from the currency of your shop to the cryptocurrency selected by the user, and users will be requested to pay the same value as shown on your shop, regardless of the cryptocurrency selected", 'cryptapi'),
94+
'default' => 'no'
95+
),
8996
'qrcode_size' => array(
9097
'title' => __('QR Code size', 'cryptapi'),
9198
'type' => 'number',
@@ -178,12 +185,16 @@ function process_payment($order_id)
178185
$info = CryptAPI\Helper::get_info($selected);
179186
$min_tx = floatval($info->minimum_transaction_coin);
180187

181-
$price = floatval($info->prices->USD);
182-
if (isset($info->prices->{$currency})) {
183-
$price = floatval($info->prices->{$currency});
184-
}
188+
if ($this->disable_conversion) {
189+
$crypto_total = $total;
190+
} else {
191+
$price = floatval($info->prices->USD);
192+
if (isset($info->prices->{$currency})) {
193+
$price = floatval($info->prices->{$currency});
194+
}
185195

186-
$crypto_total = $this->round_sig($total / $price, 6);
196+
$crypto_total = $this->round_sig($total / $price, 6);
197+
}
187198

188199
if ($crypto_total < $min_tx) {
189200
wc_add_notice(__('Payment error:', 'woocommerce') . __('Value too low, minimum is', 'cryptapi') . ' ' . $min_tx . ' ' . strtoupper($selected), 'error');

define.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22

33

4-
define('CRYPTAPI_PLUGIN_VERSION', '2.0.1');
4+
define('CRYPTAPI_PLUGIN_VERSION', '2.1.0');
55
define('CRYPTAPI_PLUGIN_PATH', plugin_dir_path(__FILE__));
66
define('CRYPTAPI_PLUGIN_URL', plugin_dir_url(__FILE__));

readme.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ Contributors: cryptapi
33
Tags: crypto payments, woocommerce, payment gateway, crypto, payment, pay with crypto, payment request, bitcoin, bnb, usdt, ethereum, monero, litecoin, bitcoin cash
44
Requires at least: 4.0
55
Tested up to: 5.8
6-
Stable tag: 2.0.1
6+
Stable tag: 2.1.0
77
Requires PHP: 5.5
88
WC requires at least: 2.4
99
WC tested up to: 5.6

0 commit comments

Comments
 (0)