From b91ba5af1531654622d34483c29507b1da33b43b Mon Sep 17 00:00:00 2001 From: Mateusz Twardowski Date: Thu, 1 Aug 2024 14:48:59 +0200 Subject: [PATCH 1/6] wip --- composer.json | 6 +++--- readme.txt | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/composer.json b/composer.json index 272ba12..7f30ebd 100644 --- a/composer.json +++ b/composer.json @@ -12,8 +12,8 @@ "type": "woocommerce-plugin", "minimum-stability": "stable", "require": { - "php": ">=7.1", - "pay-now/paynow-php-sdk": "^2.3.1", + "php": ">=7.2", + "pay-now/paynow-php-sdk": "^2.4", "nyholm/psr7": "^1.2", "php-http/curl-client": "^2.1", "ext-json": "*" @@ -32,7 +32,7 @@ }, "config": { "platform": { - "php": "7.1" + "php": "7.2" }, "allow-plugins": { "dealerdirect/phpcodesniffer-composer-installer": false, diff --git a/readme.txt b/readme.txt index 858cbbe..4e15ec4 100644 --- a/readme.txt +++ b/readme.txt @@ -1,7 +1,7 @@ === Pay by paynow.pl === Tags: payment, payment gateway, paynow, woocommerce, płatności, payments, bramka płatności Tested up to: 6.4 -Requires PHP: 7.1 +Requires PHP: 7.2 Stable tag: 2.5.5 License: GPLv3 From e2845430e197098c3068f1339c8a66b93cc224ce Mon Sep 17 00:00:00 2001 From: Mateusz Twardowski Date: Wed, 2 Oct 2024 12:03:28 +0200 Subject: [PATCH 2/6] fix checking availability of digital wallets payment --- ...lass-wc-gateway-pay-by-paynow-pl-digital-wallets-payment.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/includes/gateways/class-wc-gateway-pay-by-paynow-pl-digital-wallets-payment.php b/src/includes/gateways/class-wc-gateway-pay-by-paynow-pl-digital-wallets-payment.php index 40705eb..7cfe4f4 100644 --- a/src/includes/gateways/class-wc-gateway-pay-by-paynow-pl-digital-wallets-payment.php +++ b/src/includes/gateways/class-wc-gateway-pay-by-paynow-pl-digital-wallets-payment.php @@ -44,7 +44,7 @@ function ( $payment ) { $this->icon = $this->generate_icon( $payments ); - return count( $payments ) > 0; + return parent::is_available() && count( $payments ) > 0; } public function get_paynow_icon_url(): string { From d7bbe657f84cf735bddebf59a54832f58dcd43f7 Mon Sep 17 00:00:00 2001 From: Mateusz Twardowski Date: Wed, 2 Oct 2024 16:33:41 +0200 Subject: [PATCH 3/6] fix checking availability of digital wallets payment when methods are not shown --- ...lass-wc-gateway-pay-by-paynow-pl-digital-wallets-payment.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/includes/gateways/class-wc-gateway-pay-by-paynow-pl-digital-wallets-payment.php b/src/includes/gateways/class-wc-gateway-pay-by-paynow-pl-digital-wallets-payment.php index 7cfe4f4..b8b1ddc 100644 --- a/src/includes/gateways/class-wc-gateway-pay-by-paynow-pl-digital-wallets-payment.php +++ b/src/includes/gateways/class-wc-gateway-pay-by-paynow-pl-digital-wallets-payment.php @@ -44,7 +44,7 @@ function ( $payment ) { $this->icon = $this->generate_icon( $payments ); - return parent::is_available() && count( $payments ) > 0; + return parent::is_available() && count( $payments ) > 0 && $this->show_payment_methods; } public function get_paynow_icon_url(): string { From 184e00a98f88675af56f788b1888da1aeb8442f4 Mon Sep 17 00:00:00 2001 From: Mateusz Twardowski Date: Thu, 3 Oct 2024 11:33:31 +0200 Subject: [PATCH 4/6] add woocommerce gateway title filter to change paywall method title depends on available payment methods --- .../class-wc-gateway-pay-by-paynow-pl-paywall-payment.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/includes/gateways/class-wc-gateway-pay-by-paynow-pl-paywall-payment.php b/src/includes/gateways/class-wc-gateway-pay-by-paynow-pl-paywall-payment.php index b1c9b21..99b3419 100644 --- a/src/includes/gateways/class-wc-gateway-pay-by-paynow-pl-paywall-payment.php +++ b/src/includes/gateways/class-wc-gateway-pay-by-paynow-pl-paywall-payment.php @@ -14,6 +14,14 @@ public function __construct() { $this->payment_method_id = null; parent::__construct(); $this->title = $this->generate_title(); + + add_filter('woocommerce_gateway_title', function ($title, $payment_id) { + if ($payment_id === WC_PAY_BY_PAYNOW_PL_PLUGIN_PREFIX . 'paywall') { + return $this->generate_title(); + } + + return $title; + }, 10, 2); } public function is_available(): bool { From 2ad5e726267770caaaeeaf67ace6c063dc6d7659 Mon Sep 17 00:00:00 2001 From: Mateusz Twardowski Date: Tue, 8 Oct 2024 14:03:09 +0200 Subject: [PATCH 5/6] up versions and update composer --- changelog.txt | 5 +++++ composer.json | 4 ++-- readme.txt | 2 +- src/pay-by-paynow-pl.php | 2 +- 4 files changed, 9 insertions(+), 4 deletions(-) diff --git a/changelog.txt b/changelog.txt index d5b168f..65d949d 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,4 +1,9 @@ == Changelog == += 2.5.7 (2024-10-08) = + +- Purchasing process improvements and fixes +- Add support for PHP 8+ + = 2.5.6 (2024-08-12) = - Purchasing process improvements and fixes diff --git a/composer.json b/composer.json index 61a5ea1..797bcbb 100644 --- a/composer.json +++ b/composer.json @@ -2,7 +2,7 @@ "name": "pay-now/paynow-woocommerce", "description": "paynow.pl plugin for WooCommerce", "license": "GPLv3", - "version": "2.5.6", + "version": "2.5.7", "authors": [ { "name": "mElements S.A.", @@ -13,7 +13,7 @@ "minimum-stability": "stable", "require": { "php": ">=7.2", - "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", "ext-json": "*" diff --git a/readme.txt b/readme.txt index bef01db..e7cd679 100644 --- a/readme.txt +++ b/readme.txt @@ -2,7 +2,7 @@ Tags: payment, payment gateway, paynow, woocommerce, płatności, payments, bramka płatności Tested up to: 6.4 Requires PHP: 7.2 -Stable tag: 2.5.6 +Stable tag: 2.5.7 License: GPLv3 **pay**now is a secure online payment by bank transfers, BLIK and card. diff --git a/src/pay-by-paynow-pl.php b/src/pay-by-paynow-pl.php index 1e84ed8..cc14485 100644 --- a/src/pay-by-paynow-pl.php +++ b/src/pay-by-paynow-pl.php @@ -3,7 +3,7 @@ * Plugin Name: Pay by paynow.pl * Plugin URI: https://github.com/pay-now/paynow-woocommerce * Description: Accepts secure BLIK, credit cards payments and fast online transfers by paynow.pl - * Version: 2.5.6 + * Version: 2.5.7 * Requires PHP: 7.2 * Author: mElements S.A. * Author URI: https://www.paynow.pl From e5a2d09adfc9923ab9dd28a8021e145bf7cdc5e0 Mon Sep 17 00:00:00 2001 From: Mateusz Twardowski Date: Tue, 8 Oct 2024 14:26:06 +0200 Subject: [PATCH 6/6] sniffer fixes --- ...teway-pay-by-paynow-pl-paywall-payment.php | 27 +++++++++++++------ 1 file changed, 19 insertions(+), 8 deletions(-) diff --git a/src/includes/gateways/class-wc-gateway-pay-by-paynow-pl-paywall-payment.php b/src/includes/gateways/class-wc-gateway-pay-by-paynow-pl-paywall-payment.php index 99b3419..99cec2b 100644 --- a/src/includes/gateways/class-wc-gateway-pay-by-paynow-pl-paywall-payment.php +++ b/src/includes/gateways/class-wc-gateway-pay-by-paynow-pl-paywall-payment.php @@ -15,13 +15,18 @@ public function __construct() { parent::__construct(); $this->title = $this->generate_title(); - add_filter('woocommerce_gateway_title', function ($title, $payment_id) { - if ($payment_id === WC_PAY_BY_PAYNOW_PL_PLUGIN_PREFIX . 'paywall') { - return $this->generate_title(); - } - - return $title; - }, 10, 2); + add_filter( + 'woocommerce_gateway_title', + function ( $title, $payment_id ) { + if ( WC_PAY_BY_PAYNOW_PL_PLUGIN_PREFIX . 'paywall' === $payment_id ) { + return $this->generate_title(); + } + + return $title; + }, + 10, + 2 + ); } public function is_available(): bool { @@ -29,7 +34,13 @@ public function is_available(): bool { $paynow_payment_gateways = wc_pay_by_paynow()->payment_gateways(); foreach ( WC()->payment_gateways()->payment_gateways() as $payment_gateway ) { - if ( in_array( get_class( $payment_gateway ), $paynow_payment_gateways, true ) && 'yes' === $payment_gateway->enabled ) { + $is_payment_in_array = in_array( + get_class( $payment_gateway ), + $paynow_payment_gateways, + true + ); + + if ( $is_payment_in_array && 'yes' === $payment_gateway->enabled ) { $is_paynow_enabled = true; break; }