From 7703ea3b19c411ff5a27b72cc9200ce6d3dd7ea8 Mon Sep 17 00:00:00 2001 From: paeddl Date: Mon, 29 Sep 2025 09:09:01 +0200 Subject: [PATCH] v1.8.4 --- assets/js/checkout.js | 41 +++++++++++++-------------- includes/gateways/AbstractGateway.php | 10 +++++++ includes/gateways/ApplePay.php | 2 +- includes/gateways/ApplePayV2.php | 2 +- includes/gateways/GooglePay.php | 2 +- includes/gateways/Installment.php | 2 +- readme.txt | 5 +++- unzer-payments.php | 6 ++-- 8 files changed, 40 insertions(+), 30 deletions(-) diff --git a/assets/js/checkout.js b/assets/js/checkout.js index 5bf83dd..6ba13b1 100755 --- a/assets/js/checkout.js +++ b/assets/js/checkout.js @@ -514,7 +514,7 @@ const UnzerManager = { UnzerManager.error( unzer_i18n.errorCompanyType || 'Please enter your company type' ); return false; } - if (!UnzerManager.isB2B() || (UnzerManager.isB2B() && document.getElementById( 'unzer-invoice-company-type' ).value === 'sole')) { + if ( ! UnzerManager.isB2B() || (UnzerManager.isB2B() && document.getElementById( 'unzer-invoice-company-type' ).value === 'sole')) { if ( ! document.getElementById( 'unzer-invoice-dob' ).value) { UnzerManager.error( unzer_i18n.errorDob || 'Please enter your date of birth' ); return false; @@ -991,32 +991,29 @@ jQuery( UnzerManager.checkCountry(); const companyTypeInputContainer = document.getElementById( 'unzer-invoice-company-type-container' ); - const birthdate_form = document.getElementById('unzer-checkout-dob-row'); - const birthdate = document.getElementById('unzer-invoice-dob'); - if (companyTypeInputContainer) { - companyTypeInputContainer.style.display = UnzerManager.isB2B() ? 'block' : 'none'; - if (UnzerManager.isB2B()) { - if (document.getElementById('unzer-invoice-company-type').value === "sole") { + const birthdate_form = document.getElementById( 'unzer-checkout-dob-row' ); + const birthdate = document.getElementById( 'unzer-invoice-dob' ); + if (birthdate_form && birthdate) { + if (companyTypeInputContainer) { + companyTypeInputContainer.style.display = UnzerManager.isB2B() ? 'block' : 'none'; + if (UnzerManager.isB2B()) { + if (document.getElementById( 'unzer-invoice-company-type' ).value === "sole") { + birthdate_form.style.display = "block"; + birthdate.setAttribute( "required", "required" ); + birthdate.name = "unzer-invoice-dob"; + } else { + birthdate_form.style.display = "none"; + birthdate.removeAttribute( "required" ); + birthdate.name = ""; + } + } else { birthdate_form.style.display = "block"; - birthdate.setAttribute("required", "required"); + birthdate.setAttribute( "required", "required" ); birthdate.name = "unzer-invoice-dob"; - } else { - birthdate_form.style.display = "none"; - birthdate.removeAttribute("required"); - birthdate.name = ""; } } else { birthdate_form.style.display = "block"; - birthdate.setAttribute("required", "required"); - birthdate.name = "unzer-invoice-dob"; - } - } else { - if(birthdate_form) { - birthdate_form.style.display = "block"; - } - - if(birthdate) { - birthdate.setAttribute("required", "required"); + birthdate.setAttribute( "required", "required" ); birthdate.name = "unzer-invoice-dob"; } } diff --git a/includes/gateways/AbstractGateway.php b/includes/gateways/AbstractGateway.php index 6fab2ef..41faea7 100755 --- a/includes/gateways/AbstractGateway.php +++ b/includes/gateways/AbstractGateway.php @@ -71,6 +71,16 @@ public function payment_scripts() { $this->addCheckoutAssets(); } + protected function get_amount() { + global $wp; + if ( ! empty( $wp->query_vars['order-pay'] ) ) { + $order = wc_get_order( $wp->query_vars['order-pay'] ); + return $order->get_total(); + } else { + return WC()->cart->get_total( 'plain' ); + } + } + public function get_private_key() { return get_option( 'unzer_private_key' ); } diff --git a/includes/gateways/ApplePay.php b/includes/gateways/ApplePay.php index 2b133c0..d10ab3a 100755 --- a/includes/gateways/ApplePay.php +++ b/includes/gateways/ApplePay.php @@ -36,7 +36,7 @@ public function payment_fields() { ?> - + - + - +
- +
diff --git a/readme.txt b/readme.txt index b1c2679..272db5f 100755 --- a/readme.txt +++ b/readme.txt @@ -3,7 +3,7 @@ Contributors: Unzer Tags: payments, woocommerce Requires at least: 4.5 Tested up to: 6.8 -Stable tag: 1.8.3 +Stable tag: 1.8.4 License: Apache-2.0 License URI: http://www.apache.org/licenses/LICENSE-2.0 Author URI: https://unzer.com @@ -61,6 +61,9 @@ Unzer is one of the leading payment companies in Europe. Over 70,000 retailers t ## Changelog ## +# 1.8.4 # +* Fix correct amount for order pay page + # 1.8.3 # * Adaption Invoice as commerical customer diff --git a/unzer-payments.php b/unzer-payments.php index 7ea7fbd..e349451 100755 --- a/unzer-payments.php +++ b/unzer-payments.php @@ -5,12 +5,12 @@ * Description: Official Unzer Plugin * Author: Unzer * Author URI: https://www.unzer.com - * Version: 1.8.3 + * Version: 1.8.4 * License: Apache-2.0 * Requires at least: 4.5 * Tested up to: 6.8 * WC requires at least: 6.0 - * WC tested up to: 9.7 + * WC tested up to: 10.2 * Text Domain: unzer-payments */ @@ -21,7 +21,7 @@ /** * Required minimums and constants */ -define( 'UNZER_VERSION', '1.8.3' ); +define( 'UNZER_VERSION', '1.8.4' ); define( 'UNZER_PLUGIN_TYPE_STRING', 'Unzer Payments' ); define( 'UNZER_PLUGIN_URL', untrailingslashit( plugins_url( basename( plugin_dir_path( __FILE__ ) ), basename( __FILE__ ) ) ) ); define( 'UNZER_PLUGIN_PATH', __DIR__ . '/' );