Skip to content

Commit 4d3c003

Browse files
committed
v4.7.7
* Minor bugfixes
1 parent 8fbd5da commit 4d3c003

File tree

6 files changed

+72
-29
lines changed

6 files changed

+72
-29
lines changed

CryptAPI.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@
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.6
6+
Version: 4.7.7
77
Requires at least: 5
8-
Tested up to: 6.1.1
8+
Tested up to: 6.2
99
WC requires at least: 5.8
10-
WC tested up to: 7.4.1
10+
WC tested up to: 7.6.1
1111
Requires PHP: 7.2
1212
Author: cryptapi
1313
Author URI: https://cryptapi.io/
@@ -130,4 +130,4 @@ function cryptapi_deactivation()
130130

131131
if (!wp_next_scheduled('cryptapi_cronjob')) {
132132
wp_schedule_event(time(), 'cryptapi_interval', 'cryptapi_cronjob');
133-
}
133+
}

README.md

Lines changed: 27 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ All you need is to provide your crypto address.
2020

2121
The CryptAPI plugin extends WooCommerce, allowing you to get paid in crypto directly on your store, with a simple setup and no sign-ups required.
2222

23-
####Accepted cryptocurrencies & tokens include:
23+
#### Accepted cryptocurrencies & tokens include:
2424

2525
* (BTC) Bitcoin
2626
* (ETH) Ethereum
@@ -43,15 +43,33 @@ Supported currencies for automatic exchange rates are:
4343
* (USD) United States Dollar
4444
* (EUR) Euro
4545
* (GBP) Great Britain Pound
46+
* (CAD) Canadian Dollar
4647
* (JPY) Japanese Yen
47-
* (CNY) Chinese Yuan
48+
* (AED) UAE Dollar
49+
* (MYR) Malaysian Ringgit
50+
* (IDR) Indonesian Rupiah
51+
* (THB) Thai Baht
52+
* (CHF) Swiss Franc
53+
* (COP) Colombian Peso
54+
* (SGD) Singapore Dollar
55+
* (RUB) Russian Ruble
56+
* (ZAR) South African Rand
57+
* (TRY) Turkish Lira
58+
* (LKR) Sri Lankan Rupee
59+
* (XAF) CFA Franc
60+
* (RON) Romanian Leu
61+
* (BGN) Bulgarian Lev
62+
* (HUF) Hungarian Forint
63+
* (CZK) Czech Koruna
64+
* (PHP) Philippine Peso
65+
* (PLN) Poland Zloti
66+
* (UGX) Uganda Shillings
67+
* (MXN) Mexican Peso
4868
* (INR) Indian Rupee
49-
* (CAD) Canadian Dollar
5069
* (HKD) Hong Kong Dollar
70+
* (CNY) Chinese Yuan
5171
* (BRL) Brazilian Real
5272
* (DKK) Danish Krone
53-
* (MXN) Mexican Peso
54-
* (AED) United Arab Emirates Dirham
5573

5674
If your WooCommerce's currency is none of the above, the exchange rates will default to USD.
5775
If you're using WooCommerce in a different currency not listed here and need support, please [contact us](https://cryptapi.io) via our live chat.
@@ -325,6 +343,9 @@ The easiest and fastest way is via our live chat on our [website](https://crypta
325343
* Performance improvements
326344
* Minor fixes
327345

346+
#### 4.7.7
347+
* Minor fixes
348+
328349
### Upgrade Notice
329350
#### 4.3
330-
* Please be sure to enable the PHP extension BCMath before upgrading to this version.
351+
* Please be sure to enable the PHP extension BCMath before upgrading to this version.

controllers/CryptAPI.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
use Cryptapi\Helper;
44

5+
#[AllowDynamicProperties]
56
class WC_CryptAPI_Gateway extends WC_Payment_Gateway
67
{
78
private static $HAS_TRIGGERED = false;
@@ -364,7 +365,7 @@ function init_form_fields()
364365
'title' => esc_attr(__('API Key', 'cryptapi')),
365366
'type' => 'text',
366367
'default' => '',
367-
'description' => sprintf(esc_attr(__('Insert here your BlockBee API Key. You can get one here: %1$s', 'cryptapi')), '<a href="https://dash.blockbee.io/" target="_blank">https://dash.blockbee.io/</a>')
368+
'description' => sprintf(esc_attr(__('(Optional) Insert here your BlockBee API Key. You can get one here: %1$s', 'cryptapi')), '<a href="https://dash.blockbee.io/" target="_blank">https://dash.blockbee.io/</a>')
368369
),
369370
);
370371

@@ -740,7 +741,7 @@ function process_callback_data($data, $order, $validation = false)
740741
$history[$data['uuid']] = [
741742
'timestamp' => time(),
742743
'value_paid' => CryptAPI\Helper::sig_fig($paid, 6),
743-
'value_paid_fiat' => $conversion[get_woocommerce_currency()],
744+
'value_paid_fiat' => $conversion[strtoupper($order->get_currency())],
744745
'pending' => $data['pending']
745746
];
746747
} else {
@@ -1555,4 +1556,4 @@ function refresh_value($order)
15551556

15561557
return false;
15571558
}
1558-
}
1559+
}

define.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?php
22

3-
define('CRYPTAPI_PLUGIN_VERSION', '4.7.6');
3+
define('CRYPTAPI_PLUGIN_VERSION', '4.7.7');
44
define('CRYPTAPI_PLUGIN_PATH', plugin_dir_path(__FILE__));
5-
define('CRYPTAPI_PLUGIN_URL', plugin_dir_url(__FILE__));
5+
define('CRYPTAPI_PLUGIN_URL', plugin_dir_url(__FILE__));

readme.txt

Lines changed: 27 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22
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
5-
Tested up to: 6.1.1
6-
Stable tag: 4.7.6
5+
Tested up to: 6.2
6+
Stable tag: 4.7.7
77
Requires PHP: 7.2
88
WC requires at least: 5.8
9-
WC tested up to: 7.4.1
9+
WC tested up to: 7.6.1
1010
License: MIT
1111

1212
Accept cryptocurrency payments on your WooCommerce website
@@ -34,7 +34,6 @@ The CryptAPI plugin extends WooCommerce, allowing you to get paid in crypto dire
3434
* (DOGE) Dogecoin
3535
* (MATIC) Matic
3636

37-
3837
among many others, for a full list of the supported cryptocurrencies and tokens, check [this page](https://cryptapi.io/pricing/).
3938

4039
= Auto-value conversion =
@@ -45,6 +44,22 @@ Exchange rates are fetched every 5 minutes from CoinGecko.
4544

4645
Supported currencies for automatic exchange rates are:
4746

47+
* (USD) United States Dollar
48+
* (EUR) Euro
49+
* (GBP) Great Britain Pound
50+
* (CAD) Canadian Dollar
51+
* (JPY) Japanese Yen
52+
* (AED) UAE Dollar
53+
* (MYR) Malaysian Ringgit
54+
* (IDR) Indonesian Rupiah
55+
* (THB) Thai Baht
56+
* (CHF) Swiss Franc
57+
* (COP) Colombian Peso
58+
* (SGD) Singapore Dollar
59+
* (RUB) Russian Ruble
60+
* (ZAR) South African Rand
61+
* (TRY) Turkish Lira
62+
* (LKR) Sri Lankan Rupee
4863
* (XAF) CFA Franc
4964
* (RON) Romanian Leu
5065
* (BGN) Bulgarian Lev
@@ -59,12 +74,6 @@ Supported currencies for automatic exchange rates are:
5974
* (CNY) Chinese Yuan
6075
* (BRL) Brazilian Real
6176
* (DKK) Danish Krone
62-
* (AED) UAE Dirham
63-
* (JPY) Japanese Yen
64-
* (CAD) Canadian Dollar
65-
* (GBP) GB Pound
66-
* (EUR) Euro
67-
* (USD) US Dollar
6877

6978
If your WooCommerce's currency is none of the above, the exchange rates will default to USD.
7079
If you're using WooCommerce in a different currency not listed here and need support, please [contact us](https://cryptapi.io) via our live chat.
@@ -330,7 +339,14 @@ The easiest and fastest way is via our live chat on our [website](https://crypta
330339
= 4.7.5 =
331340
* Minor fixes
332341

342+
= 4.7.6 =
343+
* Performance improvements
344+
* Minor fixes
345+
346+
= 4.7.7 =
347+
* Minor fixes
348+
333349
== Upgrade Notice ==
334350

335351
= 4.3 =
336-
Please be sure to enable the PHP extension BCMath before upgrading to this version.
352+
Please be sure to enable the PHP extension BCMath before upgrading to this version.

utils/helper.php

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,8 @@ public static function process_callback($_get)
252252

253253
public static function sig_fig($value, $digits)
254254
{
255-
if (strpos((string) $value, '.') !== false) {
255+
$value = (string) $value;
256+
if (strpos($value, '.') !== false) {
256257
if ($value[0] != '-') {
257258
return bcadd($value, '0.' . str_repeat('0', $digits) . '5', $digits);
258259
}
@@ -289,7 +290,11 @@ private static function _request($coin, $endpoint, $params = [], $assoc = false)
289290
try {
290291
$response = json_decode(wp_remote_retrieve_body(wp_remote_get($url)), $assoc);
291292

292-
if ($response && $response->status == 'success' || !empty($response['btc'])) {
293+
if ($assoc && !empty($response['btc'])) {
294+
return $response;
295+
}
296+
297+
if ($response && $response->status === 'success') {
293298
return $response;
294299
}
295300
} catch (Exception $e) {
@@ -299,4 +304,4 @@ private static function _request($coin, $endpoint, $params = [], $assoc = false)
299304

300305
return json_decode('{"status": "error"}', $assoc);
301306
}
302-
}
307+
}

0 commit comments

Comments
 (0)