Skip to content

Commit cab6b9e

Browse files
author
Ariano Fonseca Ângelo
committed
v3.1.1
Minor fixes
1 parent f979f0d commit cab6b9e

6 files changed

Lines changed: 43 additions & 23 deletions

File tree

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,5 +145,8 @@ The easiest and fastest way is via our live chat on our [website](https://crypta
145145
* Support CryptAPI Pro
146146
* Minor fixes
147147

148+
#### 3.1.1
149+
* Minor fixes
150+
148151
== Upgrade Notice ==
149152
* No breaking changes

upload/admin/language/en-gb/extension/payment/cryptapi.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,8 @@
7070
$_['error_permission'] = 'Warning: You do not have permission to modify the CryptAPI payment module';
7171

7272
// Help hints
73-
$_['help_cryptocurrencies'] = 'Select which coins do you wish to accept (Don\'t forget to paste your address in the respective field).';
74-
$_['help_cryptocurrency'] = 'Click the checkbox to enable ';
73+
$_['help_cryptocurrencies'] = '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.';
74+
$_['help_cryptocurrency'] = 'Click the checkbox to enable the cryptocurrency';
7575

7676

7777
// Order page - payment tab

upload/admin/view/template/extension/payment/cryptapi.twig

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -54,17 +54,6 @@
5454
{% if payment_cryptapi_title is empty %}value="Cryptocurrency" {% else %}value="{{ payment_cryptapi_title }}"{% endif %}>
5555
</div>
5656
</div>
57-
<div class="form-group">
58-
<label class="col-sm-2 control-label" for="cryptapi_cryptapi_api_key">
59-
<span data-toggle="tooltip" title="{{ api_key_info }}">
60-
{{ api_key }}
61-
</span>
62-
</label>
63-
<div class="col-sm-10">
64-
<input class="form-control" type="text" id="cryptapi_cryptapi_api_key" name='payment_cryptapi_api_key'
65-
{% if payment_cryptapi_api_key is empty %}value="" {% else %}value="{{ payment_cryptapi_api_key }}"{% endif %}>
66-
</div>
67-
</div>
6857
<div class="form-group">
6958
<label class="col-sm-2 control-label" for="cryptapi_branding">{{ branding }}</label>
7059
<div class="col-sm-10">
@@ -508,13 +497,26 @@
508497
class="form-control"/>
509498
</div>
510499
</div>
500+
<div class="form-group">
501+
<label class="col-sm-2 control-label" for="cryptapi_cryptapi_api_key">
502+
{{ api_key }}
503+
</label>
504+
<div class="col-sm-10">
505+
<input class="form-control" type="text" id="cryptapi_cryptapi_api_key" name='payment_cryptapi_api_key'
506+
{% if payment_cryptapi_api_key is empty %}value="" {% else %}value="{{ payment_cryptapi_api_key }}"{% endif %}>
507+
<p class="mt-2">
508+
{{ api_key_info }}
509+
</p>
510+
</div>
511+
</div>
511512
<div class="form-group">
512513
<div class="col-12 text-center" style="margin-bottom: 20px">
513514
<label class="control-label text-center" style="float: none !important;">
514-
<span data-toggle="tooltip" title="{{ help_cryptocurrencies }}">
515515
{{ entry_cryptocurrencies }}
516-
</span>
517516
</label>
517+
<p>
518+
{{ help_cryptocurrencies }}
519+
</p>
518520
</div>
519521
<input type="hidden" id="cryptapi_cryptocurrencies_array_cache" name="payment_cryptapi_cryptocurrencies_array_cache"
520522
value='{{ payment_cryptapi_cryptocurrencies_array|json_encode() }}'>

upload/catalog/controller/extension/payment/cryptapi.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,9 @@ public function confirm()
8181
$selected = $this->request->post['cryptapi_coin'];
8282
$address = $this->config->get('payment_cryptapi_cryptocurrencies_address_' . $selected);
8383

84-
if (!empty($address)) {
84+
$apiKey = $this->config->get('payment_cryptapi_api_key');
85+
86+
if (!empty($address) || !empty($apiKey)) {
8587
$nonce = $this->model_extension_payment_cryptapi->generateNonce();
8688

8789
require_once(DIR_SYSTEM . 'library/cryptapi.php');
@@ -103,7 +105,6 @@ public function confirm()
103105
$callbackUrl = $this->url->link('extension/payment/cryptapi/callback', 'order_id=' . $this->session->data['order_id'] . '&nonce=' . $nonce, true);
104106
$callbackUrl = str_replace('&amp;', '&', $callbackUrl);
105107

106-
$apiKey = $this->config->get('payment_cryptapi_api_key');
107108

108109
$helper = new CryptAPIHelper($selected, $address, $apiKey, $callbackUrl, [], true);
109110
$addressIn = $helper->get_address();

upload/catalog/model/extension/payment/cryptapi.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,11 @@ public function validateCurrencies()
5555

5656
if (count($cryptocurrencies) > 0) {
5757
foreach ($cryptocurrencies as $token => $coin) {
58-
if ($coin && !empty($this->config->get('payment_cryptapi_cryptocurrencies_address_' . $token))) {
59-
$status = true;
60-
break;
58+
if ($coin) {
59+
if(!empty($this->config->get('payment_cryptapi_cryptocurrencies_address_' . $token) || !empty($this->config->get('payment_cryptapi_api_key')))) {
60+
$status = true;
61+
break;
62+
}
6163
}
6264
}
6365
}

upload/system/library/cryptapi.php

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,23 +33,35 @@ public function __construct($coin, $own_address, $api_key, $callback_url, $param
3333
public function get_address()
3434
{
3535

36-
if (empty($this->own_address) || empty($this->coin) || empty($this->callback_url)) return null;
36+
if (empty($this->coin) || empty($this->callback_url)) {
37+
return null;
38+
}
3739

3840
$api_key = $this->api_key;
3941

42+
if (empty($api_key) && empty($this->own_address)) {
43+
return null;
44+
}
45+
4046
$callback_url = $this->callback_url;
4147
if (!empty($this->parameters)) {
4248
$req_parameters = http_build_query($this->parameters);
4349
$callback_url = "{$this->callback_url}?{$req_parameters}";
4450
}
4551

46-
if (empty($api_key)) {
52+
if (!empty($api_key) && empty($this->own_address)) {
53+
$ca_params = [
54+
'apikey' => $api_key,
55+
'callback' => $callback_url,
56+
'pending' => $this->pending,
57+
];
58+
} elseif (empty($api_key) && !empty($this->own_address)) {
4759
$ca_params = [
4860
'callback' => $callback_url,
4961
'address' => $this->own_address,
5062
'pending' => $this->pending,
5163
];
52-
} else {
64+
} elseif(!empty($api_key) && !empty($this->own_address)) {
5365
$ca_params = [
5466
'apikey' => $api_key,
5567
'callback' => $callback_url,

0 commit comments

Comments
 (0)