From 5fca3658c16cc467cc73a029ff430c1f6009eed3 Mon Sep 17 00:00:00 2001 From: Shahbaz Date: Thu, 17 Jul 2025 12:54:47 +0500 Subject: [PATCH 1/3] Load css and js resources only on checkout page --- altapay.php | 15 ++++++++++----- classes/core/ApplePay.php | 3 +++ 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/altapay.php b/altapay.php index 2a67e95f..1300676e 100755 --- a/altapay.php +++ b/altapay.php @@ -1004,11 +1004,13 @@ function validate_checksum_altapay_callback_form() { if ( is_page( get_option( 'altapay_payment_page' ) ) ) { $checksum = isset( $_POST['checksum'] ) ? sanitize_text_field( wp_unslash( $_POST['checksum'] ) ) : ''; - $altapay_helper = new Helpers\AltapayHelpers(); - $secret = wc_get_payment_gateway_by_order( $_POST['shop_orderid'] )->secret; - if ( ! empty( $checksum ) and ! empty( $secret ) and $altapay_helper->calculateChecksum( $_POST, $secret ) !== $checksum ) { - error_log( 'checksum validation failed' ); - exit; + if ( ! empty( $checksum ) ) { + $altapay_helper = new Helpers\AltapayHelpers(); + $secret = wc_get_payment_gateway_by_order( $_POST['shop_orderid'] )->secret; + if ( ! empty( $checksum ) and ! empty( $secret ) and $altapay_helper->calculateChecksum( $_POST, $secret ) !== $checksum ) { + error_log( 'checksum validation failed' ); + exit; + } } } } @@ -1078,6 +1080,9 @@ function altapay_add_custom_class_to_body( $classes ) { * @return void */ function altapay_checkout_blocks_style() { + if ( ! is_checkout() && ! is_checkout_pay_page() ) { + return; + } wp_enqueue_style( 'altapay-block-style', plugin_dir_url( __FILE__ ) . 'assets/css/blocks.css', diff --git a/classes/core/ApplePay.php b/classes/core/ApplePay.php index c8afd3e6..7020ed45 100644 --- a/classes/core/ApplePay.php +++ b/classes/core/ApplePay.php @@ -66,6 +66,9 @@ public function filter_apple_pay_for_non_safari_browser( $payment_methods ) { * @return void */ public function altapay_load_apple_pay_script() { + if ( ! is_checkout() && ! is_checkout_pay_page() ) { + return; + } wp_enqueue_script( 'altapay-applepay-sdk', From 7423b043e64fb8b222e2bc9fbd4d6b8fc54658fa Mon Sep 17 00:00:00 2001 From: Shahbaz Date: Thu, 17 Jul 2025 12:55:10 +0500 Subject: [PATCH 2/3] Update version and release notes --- CHANGELOG.md | 3 +++ altapay.php | 6 +++--- readme.txt | 9 ++++++--- wiki.md | 6 +++--- 4 files changed, 15 insertions(+), 9 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index bce1eaa2..18c45367 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,9 @@ # Changelog All notable changes to this project will be documented in this file. +## [3.8.2] +- Load plugin CSS and JS only on the checkout page to improve performance. + ## [3.8.1] - Fix: Order line calculations when a cart discount is applied. diff --git a/altapay.php b/altapay.php index 1300676e..7987ba4b 100755 --- a/altapay.php +++ b/altapay.php @@ -7,10 +7,10 @@ * Author URI: https://altapay.com * Text Domain: altapay * Domain Path: /languages - * Version: 3.8.1 + * Version: 3.8.2 * Name: SDM_Altapay * WC requires at least: 3.9.0 - * WC tested up to: 9.9.4 + * WC tested up to: 10.0.2 * * @package Altapay */ @@ -41,7 +41,7 @@ } if ( ! defined( 'ALTAPAY_PLUGIN_VERSION' ) ) { - define( 'ALTAPAY_PLUGIN_VERSION', '3.8.1' ); + define( 'ALTAPAY_PLUGIN_VERSION', '3.8.2' ); } // Include the autoloader, so we can dynamically include the rest of the classes. diff --git a/readme.txt b/readme.txt index cd62d9c1..3731a128 100644 --- a/readme.txt +++ b/readme.txt @@ -3,11 +3,11 @@ Contributors: altapay_integrations Tags: AltaPay, Gateway, Payments, WooCommerce, Payment Card Industry Requires PHP: 7.4 Requires at least: 5.0 -Tested up to: 6.8.1 -Stable tag: 3.8.1 +Tested up to: 6.8.2 +Stable tag: 3.8.2 License: MIT WC requires at least: 3.9.0 -WC tested up to: 9.9.4 +WC tested up to: 10.0.2 License URI: http://www.gnu.org/licenses/gpl-2.0.html A plugin that integrates your WooCommerce web shop to the AltaPay payments gateway. @@ -39,6 +39,9 @@ AltaPay's Payment Gateway for WooCommerce provides merchants with access to a fu == Changelog == += 3.8.2 = +* Load plugin CSS and JS only on the checkout page to improve performance. + = 3.8.1 = * Fix: Order line calculations when a cart discount is applied. diff --git a/wiki.md b/wiki.md index 8bf00f2d..52919974 100644 --- a/wiki.md +++ b/wiki.md @@ -298,14 +298,14 @@ The new credentials can now be used as the API Username and API Password in your ## Supported versions Minimum system requirements are: -- WordPress min. 5.0 – max. 6.8.1 -- WooCommerce min. 3.9.0 – max. 9.9.4 +- WordPress min. 5.0 – max. 6.8.2 +- WooCommerce min. 3.9.0 – max. 10.0.2 - PHP 7.4 and above - PHP-bcmath library installed. - PHP-curl MUST be enabled. The latest tested version is: -- WordPress 6.8.1, WooCommerce 9.9.4 and PHP 8.2 +- WordPress 6.8.2, WooCommerce 10.0.2 and PHP 8.2 ## Troubleshooting From acef07906d6384c2b03e092af2606dad09a9e9cc Mon Sep 17 00:00:00 2001 From: Shahbaz Date: Thu, 17 Jul 2025 13:00:35 +0500 Subject: [PATCH 3/3] Remove duplicate check --- altapay.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/altapay.php b/altapay.php index 7987ba4b..354f731d 100755 --- a/altapay.php +++ b/altapay.php @@ -1007,7 +1007,7 @@ function validate_checksum_altapay_callback_form() { if ( ! empty( $checksum ) ) { $altapay_helper = new Helpers\AltapayHelpers(); $secret = wc_get_payment_gateway_by_order( $_POST['shop_orderid'] )->secret; - if ( ! empty( $checksum ) and ! empty( $secret ) and $altapay_helper->calculateChecksum( $_POST, $secret ) !== $checksum ) { + if ( ! empty( $secret ) and $altapay_helper->calculateChecksum( $_POST, $secret ) !== $checksum ) { error_log( 'checksum validation failed' ); exit; }