diff --git a/README.EN.md b/README.EN.md
index 1819345..515416c 100755
--- a/README.EN.md
+++ b/README.EN.md
@@ -16,7 +16,7 @@ The `paynow` plugin adds quick bank transfers, BLIK and cards payments to Presta
## Prerequisites
-- PHP since 7.1
+- PHP since 7.2
- PrestaShop 1.6.0 and higher
## Installation
diff --git a/README.md b/README.md
index fd7e15e..dd73786 100644
--- a/README.md
+++ b/README.md
@@ -16,7 +16,7 @@ Wtyczka `paynow` dodaje bezpieczne płatności BLIK, szybkie przelewy internetow
## Wymgania
-- PHP od wersji 7.1
+- PHP od wersji 7.2
- PrestaShop od wersji 1.6.0
## Instalacja
@@ -93,4 +93,4 @@ Licencja MIT. Szczegółowe informacje znajdziesz w pliku LICENSE.
[ext8]: https://paynow.wistia.com/medias/nym9wdwdwl
[ext9]: instruction/step6.png
[ext10]: https://panel.sandbox.paynow.pl/merchant/payments
-[ext11]: instruction/step4b.png
\ No newline at end of file
+[ext11]: instruction/step4b.png
diff --git a/classes/PaynowPaymentDataBuilder.php b/classes/PaynowPaymentDataBuilder.php
index b9c2bad..724c4a0 100644
--- a/classes/PaynowPaymentDataBuilder.php
+++ b/classes/PaynowPaymentDataBuilder.php
@@ -167,8 +167,12 @@ private function build(
PaynowLogger::error('Cannot add addresses to payment data', ['msg' => $exception->getMessage()]);
}
- if (!empty($id_customer) && $this->context->customer && $this->context->customer->is_guest === '0'){
- $request['buyer']['externalId'] = PaynowKeysGenerator::generateBuyerExternalId($id_customer, $this->module);
+ if (!empty($id_customer) && $this->context->customer){
+ if (method_exists($this->context->customer, 'isGuest') && !$this->context->customer->isGuest()) {
+ $request['buyer']['externalId'] = PaynowKeysGenerator::generateBuyerExternalId($id_customer, $this->module);
+ } elseif ($this->context->customer->is_guest === '0') {
+ $request['buyer']['externalId'] = PaynowKeysGenerator::generateBuyerExternalId($id_customer, $this->module);
+ }
}
if (! empty($paymentMethodId)) {
diff --git a/classes/PaynowPaymentOptions.php b/classes/PaynowPaymentOptions.php
index 3916035..3a67a06 100644
--- a/classes/PaynowPaymentOptions.php
+++ b/classes/PaynowPaymentOptions.php
@@ -65,7 +65,8 @@ public function generate(): array
$this->context->smarty->assign([
'action' => PaynowLinkHelper::getPaymentUrl(),
- 'data_processing_notices' => $this->data_processing_notices
+ 'data_processing_notices' => $this->data_processing_notices,
+ 'data_paynow_plugin_version' => $this->module->version,
]);
$isAnyPblEnabled = false;
diff --git a/composer.json b/composer.json
index cc5a45d..0ee0b7d 100644
--- a/composer.json
+++ b/composer.json
@@ -11,7 +11,7 @@
"require": {
"php": ">=7.2",
"ext-json": "*",
- "pay-now/paynow-php-sdk": "^2.4.1",
+ "pay-now/paynow-php-sdk": "^2.4.2",
"nyholm/psr7": "^1.2",
"php-http/curl-client": "^2.1"
},
diff --git a/paynow.php b/paynow.php
index 01d8ca6..00d9909 100644
--- a/paynow.php
+++ b/paynow.php
@@ -49,7 +49,7 @@ public function __construct()
{
$this->name = 'paynow';
$this->tab = 'payments_gateways';
- $this->version = '1.7.8';
+ $this->version = '1.7.9';
$this->ps_versions_compliancy = ['min' => '1.6.0', 'max' => _PS_VERSION_];
$this->author = 'mElements S.A.';
$this->is_eu_compatible = 1;
@@ -443,7 +443,8 @@ public function hookPayment($params)
'cta_text' => $this->getCallToActionText(),
'logo' => $this->getLogo(),
'paynow_url' => PaynowLinkHelper::getPaymentUrl(),
- 'data_processing_notices' => $gdpr_notices ?? null
+ 'data_processing_notices' => $gdpr_notices ?? null,
+ 'data_paynow_plugin_version' => $this->version,
]);
$digital_wallets = [
diff --git a/upgrade/upgrade-1.7.8.php b/upgrade/upgrade-1.7.9.php
similarity index 98%
rename from upgrade/upgrade-1.7.8.php
rename to upgrade/upgrade-1.7.9.php
index e16ebef..aadbb3a 100644
--- a/upgrade/upgrade-1.7.8.php
+++ b/upgrade/upgrade-1.7.9.php
@@ -17,7 +17,7 @@
/**
* @throws PrestaShopDatabaseException
*/
-function upgrade_module_1_7_8($module)
+function upgrade_module_1_7_9($module)
{
try {
diff --git a/views/js/front.js b/views/js/front.js
index 33936b9..3968d7c 100644
--- a/views/js/front.js
+++ b/views/js/front.js
@@ -163,13 +163,11 @@ var paynow = {
},
onPaymentOptionChange: function () {
- if ($(paynow.selectors.blikCode).length != 1) {
- return
+ if ($(paynow.selectors.blikCode).length === 1) {
+ $(paynow.selectors.blikCode).mask('000 000', {placeholder: "___ ___"})
}
- $(paynow.selectors.blikCode).mask('000 000', {placeholder: "___ ___"})
-
- if ($(paynow.selectors.form).data('blik-autofocus') == '1') {
+ if ($(paynow.selectors.form).data('blik-autofocus') === '1') {
$(paynow.selectors.blikCode).focus();
}
@@ -178,6 +176,8 @@ var paynow = {
paynow.paymentButton.hide()
} else if ($(paynow.selectors.cardMethodOptions).is(':visible') && !$(paynow.selectors.cardMethod + ':checked').length) {
paynow.paymentButton.disable()
+ } else if ($('div.paynow-payment-pbls .paynow-payment-option-pbl').is(':visible')) {
+ paynow.pblValidate()
} else {
paynow.paymentButton.enable()
paynow.paymentButton.show()
@@ -190,7 +190,7 @@ var paynow = {
},
blikValidate: function () {
- blik_code_value = $(paynow.selectors.blikCode).val().replace(/\s/g, '');
+ const blik_code_value = $(paynow.selectors.blikCode).val().replace(/\s/g, '');
if (blik_code_value.length === 6 && !isNaN(parseInt(blik_code_value)) && parseInt(blik_code_value)) {
$(paynow.selectors.blikErrorLabel).text('');
@@ -215,7 +215,7 @@ var paynow = {
},
pblValidate: function () {
- if (paynow.config.validateTerms && paynow.isTermsChecked()) {
+ if (!(paynow.config.validateTerms && !paynow.isTermsChecked()) && $(paynow.selectors.pblMethod + ':checked').length > 0) {
paynow.paymentButton.enable();
return true
} else {
diff --git a/views/templates/front/1.7/_partials/payment_data_processing_info.tpl b/views/templates/front/1.7/_partials/payment_data_processing_info.tpl
index ce15440..eea4831 100644
--- a/views/templates/front/1.7/_partials/payment_data_processing_info.tpl
+++ b/views/templates/front/1.7/_partials/payment_data_processing_info.tpl
@@ -13,4 +13,8 @@
{/if}
{/foreach}
-{/if}
\ No newline at end of file
+{/if}
+
+{if $data_paynow_plugin_version}
+
+{/if}
diff --git a/views/templates/hook/_partials/payment_data_processing_info.tpl b/views/templates/hook/_partials/payment_data_processing_info.tpl
index 231f787..7ea5518 100644
--- a/views/templates/hook/_partials/payment_data_processing_info.tpl
+++ b/views/templates/hook/_partials/payment_data_processing_info.tpl
@@ -29,4 +29,8 @@
-{/if}
\ No newline at end of file
+{/if}
+
+{if $data_paynow_plugin_version}
+
+{/if}