From 7b5d44834cb48492f8f8703733695ef680615990 Mon Sep 17 00:00:00 2001 From: Shahbaz Date: Tue, 14 Oct 2025 19:10:16 +0500 Subject: [PATCH 01/14] Add option to change the payment page layout to checkout independent --- altapay.php | 1 + classes/core/AltapayPluginInstall.php | 24 + classes/core/AltapaySettings.php | 9 + views/altapay-payment-form-external.php | 816 ++++++++++++++++++++++++ views/forms/adminSettings.blade.php | 12 + views/paymentClass.tpl | 5 +- 6 files changed, 866 insertions(+), 1 deletion(-) create mode 100755 views/altapay-payment-form-external.php diff --git a/altapay.php b/altapay.php index 7e1318e8..a9c5b06e 100755 --- a/altapay.php +++ b/altapay.php @@ -227,6 +227,7 @@ function altapay_page_template( $template ) { $callbackPages = array( 'altapay_payment_page' => 'altapay-payment-form.php', 'altapay_callback_redirect_page' => 'altapay-callback-redirect.php', + 'altapay_external_payment_page' => 'altapay-payment-form-external.php', ); foreach ( $callbackPages as $optionKey => $templateFile ) { diff --git a/classes/core/AltapayPluginInstall.php b/classes/core/AltapayPluginInstall.php index 1e9c4fa7..0fff58a1 100644 --- a/classes/core/AltapayPluginInstall.php +++ b/classes/core/AltapayPluginInstall.php @@ -99,5 +99,29 @@ public static function createCallbackRedirectPage() { update_option( 'altapay_callback_redirect_page', $page_id ); } } + + /** + * Create new page for external checkout. + * + * @return void + */ + public static function createExternalPaymentPage() { + + if ( empty( trim( get_option( 'altapay_external_payment_page' ) ) ) ) { + $page_data = array( + 'post_status' => 'publish', + 'post_type' => 'page', + 'post_author' => 1, + 'post_title' => 'AltaPay Payment Form External', + 'post_content' => '', + 'post_parent' => 0, + 'comment_status' => 'closed', + ); + + $page_id = wp_insert_post( $page_data ); + + update_option( 'altapay_external_payment_page', $page_id ); + } + } } diff --git a/classes/core/AltapaySettings.php b/classes/core/AltapaySettings.php index 612a55df..77cd4c05 100644 --- a/classes/core/AltapaySettings.php +++ b/classes/core/AltapaySettings.php @@ -297,6 +297,7 @@ public function altapayRegisterSettings() { register_setting( 'altapay-settings-group', 'altapay_fraud_detection_action' ); register_setting( 'altapay-settings-group', 'altapay_payment_page' ); register_setting( 'altapay-settings-group', 'altapay_cc_form_styling' ); + register_setting( 'altapay-settings-group', 'altapay_payment_page_layout' ); register_setting( 'altapay-settings-group', 'altapay_terminals_enabled', @@ -338,6 +339,7 @@ public function altapaySettings() { $altapay_fraud_detection = get_option( 'altapay_fraud_detection' ); $altapay_fraud_detection_action = get_option( 'altapay_fraud_detection_action' ); $cc_form_styling = get_option( 'altapay_cc_form_styling' ); + $payment_page_layout = get_option( 'altapay_payment_page_layout' ); if ( $terminalDetails ) { $terminals = json_decode( get_option( 'altapay_terminals' ) ); @@ -398,6 +400,7 @@ public function altapaySettings() { 'altapay_fraud_detection' => $altapay_fraud_detection, 'altapay_fraud_detection_action' => $altapay_fraud_detection_action, 'cc_form_styling' => $cc_form_styling, + 'payment_page_layout' => $payment_page_layout, ) ); @@ -614,6 +617,12 @@ function altapayCapturesPostInit() { if ( empty( $callback_redirect_page ) ) { Core\AltapayPluginInstall::createCallbackRedirectPage(); } + + $external_payment_page = get_option( 'altapay_external_payment_page' ); + + if ( empty( $external_payment_page ) ) { + Core\AltapayPluginInstall::createExternalPaymentPage(); + } } /** diff --git a/views/altapay-payment-form-external.php b/views/altapay-payment-form-external.php new file mode 100755 index 00000000..e9ff5d32 --- /dev/null +++ b/views/altapay-payment-form-external.php @@ -0,0 +1,816 @@ + + + + + + + + + + AltaPay + + +get_items( apply_filters( 'woocommerce_purchase_order_item_types', 'line_item' ) ); +$show_purchase_note = $order->has_status( apply_filters( 'woocommerce_purchase_note_order_statuses', array( + 'completed', + 'processing' +) ) ); + +$container_class = 'checkout'; +$cc_form_styling = get_option( 'altapay_cc_form_styling' ); +$container_class .= ( $cc_form_styling === 'checkout_v2' ) ? ' checkout-v2' : ''; + +$surcharge = 'no'; +$wpml_language = $order->get_meta( 'wpml_language' ); +if ( ! empty( $wpml_language ) ) { + global $sitepress; + // Check if the WPML plugin is active + if ( defined( 'ICL_SITEPRESS_VERSION' ) && is_object( $sitepress ) ) { + // Switch the language + $sitepress->switch_lang( $wpml_language ); + } +} +$payment_method = wc_get_payment_gateway_by_order( $order ); +if ( $payment_method && isset( $payment_method->settings ) && is_array( $payment_method->settings ) ) { + $settings = $payment_method->settings; + $surcharge = $settings['surcharge'] ?? 'no'; +} +?> + +
+ ' . esc_html( get_bloginfo( 'name' ) ) . '
'; + } + ?> + +
+
+
+
    +
  • + + get_order_number() ); ?> +
  • + +
  • + + + +
  • +
  • + + + +
  • + +
  • + + get_formatted_order_total() ); ?> +
  • + +
+
+
+ +
+
+
+ + \ No newline at end of file diff --git a/views/forms/adminSettings.blade.php b/views/forms/adminSettings.blade.php index 37d53b3a..6580b79d 100644 --- a/views/forms/adminSettings.blade.php +++ b/views/forms/adminSettings.blade.php @@ -74,6 +74,18 @@ + + + + +

The default option follows the theme styling,
while the custom option + displays the payment page independently of the theme styling.

+ + +

diff --git a/views/paymentClass.tpl b/views/paymentClass.tpl index 58d7f087..101714dc 100644 --- a/views/paymentClass.tpl +++ b/views/paymentClass.tpl @@ -200,8 +200,11 @@ class WC_Gateway_{key} extends WC_Payment_Gateway { $language = $wpml_language; } + $payment_page_layout = get_option( 'altapay_payment_page_layout' ); // Get chosen page from AltaPay's settings - $form_page_id = esc_attr( get_option('altapay_payment_page') ); + $form_page_id = $payment_page_layout === 'checkout_independent' + ? esc_attr( get_option( 'altapay_external_payment_page' ) ) + : esc_attr( get_option( 'altapay_payment_page' ) ); $configUrl = array( 'callback_form' => get_page_link($form_page_id), 'callback_ok' => add_query_arg( From 3ee9da9271f622cccdf16b82d19fc2233edb3dc7 Mon Sep 17 00:00:00 2001 From: Shahbaz Date: Wed, 15 Oct 2025 10:49:30 +0500 Subject: [PATCH 02/14] Get site title --- views/altapay-payment-form-external.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/views/altapay-payment-form-external.php b/views/altapay-payment-form-external.php index e9ff5d32..fdc29528 100755 --- a/views/altapay-payment-form-external.php +++ b/views/altapay-payment-form-external.php @@ -10,7 +10,7 @@ - AltaPay + <?php bloginfo( 'name' ); ?> get_meta( 'wpml_language' ); From 2804e28444981974248b1662a14cbe92c988615a Mon Sep 17 00:00:00 2001 From: Shahbaz Date: Wed, 15 Oct 2025 18:10:20 +0500 Subject: [PATCH 11/14] Update version and release notes --- CHANGELOG.md | 3 +++ altapay.php | 6 +++--- readme.txt | 7 +++++-- wiki.md | 4 ++-- 4 files changed, 13 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f72cdbbf..01fb321f 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.5] +- Support gateway form independent of the plugin/theme styling. + ## [3.8.4] - Add support for Checkout Design v2. diff --git a/altapay.php b/altapay.php index a9c5b06e..bad7344e 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.4 + * Version: 3.8.5 * Name: SDM_Altapay * WC requires at least: 3.9.0 - * WC tested up to: 10.2.1 + * WC tested up to: 10.2.2 * * @package Altapay */ @@ -41,7 +41,7 @@ } if ( ! defined( 'ALTAPAY_PLUGIN_VERSION' ) ) { - define( 'ALTAPAY_PLUGIN_VERSION', '3.8.4' ); + define( 'ALTAPAY_PLUGIN_VERSION', '3.8.5' ); } // Include the autoloader, so we can dynamically include the rest of the classes. diff --git a/readme.txt b/readme.txt index e4c46ec6..09d60eb3 100644 --- a/readme.txt +++ b/readme.txt @@ -4,10 +4,10 @@ Tags: AltaPay, Gateway, Payments, WooCommerce, Payment Card Industry Requires PHP: 7.4 Requires at least: 5.0 Tested up to: 6.8.2 -Stable tag: 3.8.4 +Stable tag: 3.8.5 License: MIT WC requires at least: 3.9.0 -WC tested up to: 10.2.1 +WC tested up to: 10.2.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.5 = +* Support gateway form independent of the plugin/theme styling. + = 3.8.4 = * Add support for Checkout Design v2. diff --git a/wiki.md b/wiki.md index 3450bc9a..d0bfba18 100644 --- a/wiki.md +++ b/wiki.md @@ -315,13 +315,13 @@ The new credentials can now be used as the API Username and API Password in your Minimum system requirements are: - WordPress min. 5.0 – max. 6.8.2 -- WooCommerce min. 3.9.0 – max. 10.2.1 +- WooCommerce min. 3.9.0 – max. 10.2.2 - PHP 7.4 and above - PHP-bcmath library installed. - PHP-curl MUST be enabled. The latest tested version is: -- WordPress 6.8.2, WooCommerce 10.2.1 and PHP 8.2 +- WordPress 6.8.2, WooCommerce 10.2.2 and PHP 8.4 ## Troubleshooting From 0b0ff255ea03861426af03a674799a642bca4556 Mon Sep 17 00:00:00 2001 From: Shahbaz Date: Wed, 15 Oct 2025 18:12:03 +0500 Subject: [PATCH 12/14] Update composer dependencies --- composer.lock | 46 +++++++++++++++++++++++----------------------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/composer.lock b/composer.lock index 27e68692..76050be7 100644 --- a/composer.lock +++ b/composer.lock @@ -8,16 +8,16 @@ "packages": [ { "name": "altapay/api-php", - "version": "3.5.4", + "version": "3.5.5", "source": { "type": "git", "url": "https://github.com/AltaPay/api-php.git", - "reference": "6fd4457ebb66a83c0995ad86764db40207ad5f53" + "reference": "b1e1b06e9645a52a462e6b88ba7209feba8dfdae" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/AltaPay/api-php/zipball/6fd4457ebb66a83c0995ad86764db40207ad5f53", - "reference": "6fd4457ebb66a83c0995ad86764db40207ad5f53", + "url": "https://api.github.com/repos/AltaPay/api-php/zipball/b1e1b06e9645a52a462e6b88ba7209feba8dfdae", + "reference": "b1e1b06e9645a52a462e6b88ba7209feba8dfdae", "shasum": "" }, "require": { @@ -29,7 +29,7 @@ "ext-simplexml": "*", "ext-spl": "*", "guzzlehttp/guzzle": "^6.0 || ^7.0", - "php": "^7.0 || ^8.0", + "php": "^7.1 || ^8.0", "symfony/event-dispatcher": "^2.1 || ^3.0 || ^4.0 || ^5.0 || ^6.0 || ^7.0", "symfony/options-resolver": "^2.6 || ^3.0 || ^4.0 || ^5.0 || ^6.0 || ^7.0" }, @@ -58,9 +58,9 @@ ], "support": { "issues": "https://github.com/AltaPay/api-php/issues", - "source": "https://github.com/AltaPay/api-php/tree/3.5.4" + "source": "https://github.com/AltaPay/api-php/tree/3.5.5" }, - "time": "2025-09-15T05:02:36+00:00" + "time": "2025-10-10T14:59:05+00:00" }, { "name": "composer/package-versions-deprecated", @@ -3185,16 +3185,16 @@ }, { "name": "phpunit/phpunit", - "version": "8.5.47", + "version": "8.5.48", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "c0134803429af3aef9c5fd2fbb41a1f1340fe20d" + "reference": "75f469c1948b91aa566206f88412c88f08090b32" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/c0134803429af3aef9c5fd2fbb41a1f1340fe20d", - "reference": "c0134803429af3aef9c5fd2fbb41a1f1340fe20d", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/75f469c1948b91aa566206f88412c88f08090b32", + "reference": "75f469c1948b91aa566206f88412c88f08090b32", "shasum": "" }, "require": { @@ -3216,7 +3216,7 @@ "sebastian/comparator": "^3.0.6", "sebastian/diff": "^3.0.6", "sebastian/environment": "^4.2.5", - "sebastian/exporter": "^3.1.7", + "sebastian/exporter": "^3.1.8", "sebastian/global-state": "^3.0.6", "sebastian/object-enumerator": "^3.0.5", "sebastian/resource-operations": "^2.0.3", @@ -3263,7 +3263,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/phpunit/issues", "security": "https://github.com/sebastianbergmann/phpunit/security/policy", - "source": "https://github.com/sebastianbergmann/phpunit/tree/8.5.47" + "source": "https://github.com/sebastianbergmann/phpunit/tree/8.5.48" }, "funding": [ { @@ -3287,7 +3287,7 @@ "type": "tidelift" } ], - "time": "2025-09-23T06:18:09+00:00" + "time": "2025-09-24T06:27:39+00:00" }, { "name": "sebastian/code-unit-reverse-lookup", @@ -3561,16 +3561,16 @@ }, { "name": "sebastian/exporter", - "version": "3.1.7", + "version": "3.1.8", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/exporter.git", - "reference": "8c86ae3e84f69acff53b9d4b96614a68e3572901" + "reference": "64cfeaa341951ceb2019d7b98232399d57bb2296" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/8c86ae3e84f69acff53b9d4b96614a68e3572901", - "reference": "8c86ae3e84f69acff53b9d4b96614a68e3572901", + "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/64cfeaa341951ceb2019d7b98232399d57bb2296", + "reference": "64cfeaa341951ceb2019d7b98232399d57bb2296", "shasum": "" }, "require": { @@ -3626,7 +3626,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/exporter/issues", - "source": "https://github.com/sebastianbergmann/exporter/tree/3.1.7" + "source": "https://github.com/sebastianbergmann/exporter/tree/3.1.8" }, "funding": [ { @@ -3646,7 +3646,7 @@ "type": "tidelift" } ], - "time": "2025-09-22T05:03:57+00:00" + "time": "2025-09-24T05:55:14+00:00" }, { "name": "sebastian/global-state", @@ -4182,12 +4182,12 @@ ], "aliases": [], "minimum-stability": "dev", - "stability-flags": [], + "stability-flags": {}, "prefer-stable": true, "prefer-lowest": false, "platform": { "php": "^7.4 || ^8.0" }, - "platform-dev": [], - "plugin-api-version": "2.2.0" + "platform-dev": {}, + "plugin-api-version": "2.6.0" } From 73cc492f45e361bf0472edffa0c2ecb7faa9955f Mon Sep 17 00:00:00 2001 From: Shahbaz Date: Wed, 15 Oct 2025 18:24:34 +0500 Subject: [PATCH 13/14] Update wiki --- wiki.md | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/wiki.md b/wiki.md index d0bfba18..9b567b7f 100644 --- a/wiki.md +++ b/wiki.md @@ -23,6 +23,8 @@ Installing this plug-in will enable the web shop to handle card transactions thr * [Checkout form styling](#checkout-form-styling) +* [Payment page layout](#payment-page-layout) + * [Configure fraud detection](#configure-fraud-detection) * [Synchronize payment methods](#synchronize-payment-methods) @@ -122,15 +124,15 @@ Choose one of the below options from `Checkout form style` dropdown to change th ### Payment page layout -Choose one of the below options from Payment page layout dropdown to select the layout type for payment page. +Choose one of the below options from **Payment page layout** dropdown to select the layout type for payment page. ![altapay_cc_checkout_form.png](docs/payment_page_layout.png) -`Default` This will use the styling from the checkout/theme. +- `Default` This will use the styling from the checkout/theme. ![altapay_cc_checkout_form.png](docs/altapay_cc_checkout_form.png) -`Checkout Independent` This will show the payment page independent from the theme styling. This will provide a visually appealing appearance seamlessly, without conflicting with the theme styling. +- `Checkout Independent` This will show the payment page independent from the theme styling. This will provide a visually appealing appearance seamlessly, without conflicting with the theme styling. ![altapay_cc_checkout_form.png](docs/independent_payment_page_layout.png) From 844c71fa76770587ed071c13a8746ea18cd9496f Mon Sep 17 00:00:00 2001 From: Shahbaz Date: Wed, 15 Oct 2025 18:50:28 +0500 Subject: [PATCH 14/14] Add copyright information --- views/altapay-payment-form-external.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/views/altapay-payment-form-external.php b/views/altapay-payment-form-external.php index 25dfbd71..c8efad4d 100755 --- a/views/altapay-payment-form-external.php +++ b/views/altapay-payment-form-external.php @@ -1,4 +1,12 @@