Skip to content

Commit bdafb80

Browse files
author
arianoangelo
committed
v4.7.2
- Minor fixes
1 parent 75e8d9f commit bdafb80

File tree

5 files changed

+22
-14
lines changed

5 files changed

+22
-14
lines changed

CryptAPI.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
Plugin Name: CryptAPI Payment Gateway for WooCommerce
44
Plugin URI: https://github.com/cryptapi/woocommerce-cryptapi
55
Description: Accept cryptocurrency payments on your WooCommerce website
6-
Version: 4.7.1
6+
Version: 4.7.2
77
Requires at least: 5
88
Tested up to: 6.1.1
99
WC requires at least: 5.8

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -309,6 +309,9 @@ The easiest and fastest way is via our live chat on our [website](https://crypta
309309
* Minor fixes
310310
* Improvements on the callback processing algorithm
311311

312+
#### 4.7.2
313+
* Minor fixes
314+
312315
### Upgrade Notice
313316
#### 4.3
314317
* Please be sure to enable the PHP extension BCMath before upgrading to this version.

controllers/CryptAPI.php

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1333,11 +1333,15 @@ function handling_fee() {
13331333
return;
13341334
}
13351335

1336-
$total_fee = $this->get_option( 'fee_order_percentage' ) == 'none' ? 0 : $this->get_option( 'fee_order_percentage' );
1336+
$total_fee = $this->get_option( 'fee_order_percentage' ) === 'none' ? 0 : (float) $this->get_option( 'fee_order_percentage' );
13371337

1338-
$fee_order = WC()->cart->subtotal * $total_fee;
1338+
$fee_order = 0;
13391339

1340-
if ( $total_fee !== 'none' || $this->add_blockchain_fee ) {
1340+
if ( $total_fee !== 0 || $this->add_blockchain_fee ) {
1341+
1342+
if ($total_fee !== 0) {
1343+
$fee_order = (float) WC()->cart->subtotal * $total_fee;
1344+
}
13411345

13421346
$selected = WC()->session->get( 'cryptapi_coin' );
13431347

readme.txt

Lines changed: 4 additions & 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, shib, doge
44
Requires at least: 5
55
Tested up to: 6.1.1
6-
Stable tag: 4.7.1
6+
Stable tag: 4.7.2
77
Requires PHP: 7.2
88
WC requires at least: 5.8
99
WC tested up to: 7.2.2
@@ -318,6 +318,9 @@ The easiest and fastest way is via our live chat on our [website](https://crypta
318318
= 4.7.1 =
319319
* Minor fixes
320320

321+
= 4.7.2 =
322+
* Minor fixes
323+
321324
== Upgrade Notice ==
322325

323326
= 4.3 =

utils/helper.php

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -253,17 +253,15 @@ public static function process_callback($_get)
253253

254254
public static function sig_fig($value, $digits)
255255
{
256-
if ($value == 0) {
257-
$decimalPlaces = $digits - 1;
258-
} elseif ($value < 0) {
259-
$decimalPlaces = $digits - floor(log10($value * -1)) - 1;
260-
} else {
261-
$decimalPlaces = $digits - floor(log10($value)) - 1;
256+
if (strpos((string) $value, '.') !== false) {
257+
if ($value[0] != '-') {
258+
return bcadd($value, '0.' . str_repeat('0', $digits) . '5', $digits);
259+
}
260+
261+
return bcsub($value, '0.' . str_repeat('0', $digits) . '5', $digits);
262262
}
263263

264-
$answer = ($decimalPlaces > 0) ?
265-
number_format($value, $decimalPlaces, '.', '') : round($value, $decimalPlaces);
266-
return $answer;
264+
return $value;
267265
}
268266

269267
private static function _request($coin, $endpoint, $params = [], $assoc = false)

0 commit comments

Comments
 (0)