Skip to content

Commit 654780e

Browse files
author
Ariano Fonseca Ângelo
committed
4.4.3
- Minor fixes
1 parent 983dbe0 commit 654780e

13 files changed

Lines changed: 467 additions & 433 deletions

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.4.2
6+
Version: 4.4.3
77
Requires at least: 5
88
Tested up to: 5.9.3
99
WC requires at least: 5.8

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -249,6 +249,9 @@ The easiest and fastest way is via our live chat on our [website](https://crypta
249249
#### 4.4.2
250250
* Minor fixes
251251

252+
#### 4.4.3
253+
* Minor fixes
254+
252255
### Upgrade Notice
253256
#### 4.3
254257
* Please be sure to enable the PHP extension BCMath before upgrading to this version.

controllers/CryptAPI.php

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -219,12 +219,6 @@ function init_form_fields()
219219
'default' => '',
220220
'description' => __('Payment method description that the customer will see on your checkout', 'cryptapi')
221221
),
222-
'api_key' => array(
223-
'title' => __('API Key', 'cryptapi'),
224-
'type' => 'text',
225-
'default' => '',
226-
'description' => __('<strong>NEW: </strong>Insert here your CryptAPI Pro API Key. You can get one here: <a href="https://pro.cryptapi.io/" target="_blank">https://pro.cryptapi.io/</a>. <strong>This field is optional.</strong><br/><strong style="color: #f44336;">Notice: </strong> The API Key permission "address_override" needs to be enabled and addresses must be configured down bellow.', 'cryptapi')
227-
),
228222
'show_branding' => array(
229223
'title' => __('Show CryptAPI branding', 'cryptapi'),
230224
'type' => 'checkbox',
@@ -351,6 +345,12 @@ function init_form_fields()
351345
'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'),
352346
'default' => 'no'
353347
),
348+
'api_key' => array(
349+
'title' => __('API Key', 'cryptapi'),
350+
'type' => 'text',
351+
'default' => '',
352+
'description' => __('<strong>NEW: </strong>Insert here your CryptAPI Pro API Key. You can get one here: <a href="https://pro.cryptapi.io/" target="_blank">https://pro.cryptapi.io/</a>. <strong>This field is optional.</strong>', 'cryptapi')
353+
),
354354
);
355355

356356
$coin_description = __('Insert your %s address here. Leave the checkbox unselected if you want to skip this cryptocurrency', 'cryptapi');
@@ -391,19 +391,20 @@ function payment_fields()
391391
{ ?>
392392
<div class="form-row form-row-wide">
393393
<p><?php echo $this->description; ?></p>
394+
<div><img src="" </div>
394395
<ul style="list-style: none outside;">
395396
<?php
396397
if (!empty($this->coins) && is_array($this->coins)) {
397398
$selected = WC()->session->get('cryptapi_coin');
398-
399399
?>
400400
<li>
401401
<select name="cryptapi_coin" id="payment_cryptapi_coin" class="input-control" style="display:block; margin-top: 10px">
402402
<option value="none"><?php echo __('Please select a Cryptocurrency', 'cryptapi') ?></option>
403403
<?php
404404
foreach ($this->coins as $val) {
405405
$addr = $this->{$val . '_address'};
406-
if (!empty($addr)) { ?>
406+
$apikey = $this->api_key;
407+
if (!empty($addr) || !empty($apikey)) { ?>
407408
<option value="<?php echo $val; ?>" <?php
408409
if (!empty($selected) && $selected === $val) {
409410
echo " selected='true'";
@@ -434,14 +435,15 @@ function process_payment($order_id)
434435
$selected = sanitize_text_field($_POST['cryptapi_coin']);
435436

436437
if ($selected === 'none') {
437-
wc_add_notice(__('Payment error:', 'woocommerce') . ' ' . __('Please choose a cryptocurrency', 'cryptapi'), 'error');
438+
wc_add_notice(__('Payment error: ', 'woocommerce') . ' ' . __('Please choose a cryptocurrency', 'cryptapi'), 'error');
438439

439440
return null;
440441
}
441442

443+
$api_key = $this->api_key;
442444
$addr = $this->{$selected . '_address'};
443445

444-
if (!empty($addr)) {
446+
if (!empty($addr) || !empty($api_key)) {
445447

446448
$nonce = $this->generate_nonce();
447449

@@ -493,7 +495,6 @@ function process_payment($order_id)
493495
return null;
494496
}
495497

496-
$api_key = $this->api_key;
497498

498499
$ca = new CryptAPI\Helper($selected, $addr, $api_key, $callback_url, [], true);
499500

@@ -1166,12 +1167,9 @@ public function generate_cryptocurrency_html($key, $data)
11661167
<td class="forminp forminp-<?php echo esc_attr($data['type']) ?>">
11671168
<p>
11681169
<strong>
1169-
<?php echo sprintf(__('Addresses optional if using %1s', 'cryptapi'),
1170-
'<a href="https://pro.cryptapi.io" target="_blank">CryptAPI Pro</a></strong>'
1171-
);
1172-
?>
1170+
<?php echo __('Addresses', 'cryptapi');?>
11731171
</strong><br/>
1174-
<?php echo __('You can setup the addresses in your API Key screen.', 'cryptapi'); ?>
1172+
<?php echo __("If you are using CryptAPI Pro you can choose if setting the receiving addresses here bellow or in your CryptAPI Pro settings page.<br/>- In order to set the addresses on plugin settings, you need to select “Address Override” while creating the API key.<br/>- In order to set the addresses on CryptAPI Pro settings, you need to NOT select “Address Override” while creating the API key.", 'cryptapi'); ?>
11751173
</p>
11761174
</td>
11771175
</tr>

define.php

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

3-
define('CRYPTAPI_PLUGIN_VERSION', '4.4.2');
3+
define('CRYPTAPI_PLUGIN_VERSION', '4.4.3');
44
define('CRYPTAPI_PLUGIN_PATH', plugin_dir_path(__FILE__));
55
define('CRYPTAPI_PLUGIN_URL', plugin_dir_url(__FILE__));
494 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)