diff --git a/.gitignore b/.gitignore index 10b50889..0923bcb9 100644 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,11 @@ /.wp /node_modules /yarn.lock +# wp-scopify dependencies +dependencies/* +!dependencies/.gitkeep /vendor + SyncToy_f76a6219-f902-4b34-8524-b4fd7b7279a4.dat lib/selenium-server-standalone.jar lib/drivers/chromedriver.exe @@ -17,4 +21,5 @@ nightwatch.conf.js # OS X metadata .DS_Store .vscode/settings.json -.idea/ \ No newline at end of file +.idea/ + diff --git a/classes/admin/class-klarna-for-woocommerce-addons.php b/classes/admin/class-klarna-for-woocommerce-addons.php index 2ec884cb..4428555d 100644 --- a/classes/admin/class-klarna-for-woocommerce-addons.php +++ b/classes/admin/class-klarna-for-woocommerce-addons.php @@ -275,18 +275,16 @@ public function change_klarna_addon_status() { $new_action = 'install'; $new_status_label = 'Not installed'; $new_action_label = 'Install'; - } else { - if ( 'installed' === $result['status'] ) { + } elseif ( 'installed' === $result['status'] ) { $new_status = 'installed'; $new_action = 'activate'; $new_status_label = 'Installed'; $new_action_label = 'Activate'; - } else { - $new_status = 'not-installed'; - $new_action = 'install'; - $new_status_label = 'Not installed'; - $new_action_label = 'Install'; - } + } else { + $new_status = 'not-installed'; + $new_action = 'install'; + $new_status_label = 'Not installed'; + $new_action_label = 'Install'; } } } @@ -327,7 +325,7 @@ public function install_plugin( $url ) { } $skin = new Klarna_Skin(); $installer = new Plugin_Upgrader( $skin ); - $result = $installer->install( $url ); + $result = $installer->install( $url ); // nosemgrep: URL already escape, and user is authorized. wp_cache_flush(); if ( is_wp_error( $result ) ) { diff --git a/classes/class-kco-credentials.php b/classes/class-kco-credentials.php index 315e104f..87cf001d 100644 --- a/classes/class-kco-credentials.php +++ b/classes/class-kco-credentials.php @@ -55,7 +55,7 @@ public function get_credentials_from_session() { $credentials = array( 'merchant_id' => $this->settings[ $test_string . 'merchant_id_' . $country_string ], - 'shared_secret' => htmlspecialchars_decode( $this->settings[ $test_string . 'shared_secret_' . $country_string ] ), + 'shared_secret' => htmlspecialchars_decode( $this->settings[ $test_string . 'shared_secret_' . $country_string ], ENT_QUOTES | ENT_SUBSTITUTE | ENT_HTML401 ), ); return apply_filters( 'kco_wc_credentials_from_session', $credentials, $this->settings['testmode'] ); diff --git a/classes/class-kco-fields.php b/classes/class-kco-fields.php index 972ae995..4d02c051 100644 --- a/classes/class-kco-fields.php +++ b/classes/class-kco-fields.php @@ -358,7 +358,7 @@ public static function fields() { $settings = array_merge( array_slice( $settings, 0, $offset + 1, true ), array( 'checkout_flow' => $checkout_flow ), array_slice( $settings, $offset, null, true ) ); } else { $option = 'woocommerce_kco_settings'; - $stored_settings = get_option( $option ); + $stored_settings = get_option( $option, array() ); $stored_settings['checkout_flow'] = 'embedded'; update_option( $option, $stored_settings ); } diff --git a/dependencies/.gitkeep b/dependencies/.gitkeep new file mode 100644 index 00000000..e69de29b diff --git a/includes/kco-functions.php b/includes/kco-functions.php index 8baea50e..f64ba044 100644 --- a/includes/kco-functions.php +++ b/includes/kco-functions.php @@ -97,6 +97,7 @@ function kco_wc_show_snippet( $pay_for_order = false ) { if ( isset( $klarna_order['html_snippet'] ) ) { do_action( 'kco_wc_show_snippet', $klarna_order ); + // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- We trust the HTML snippet. echo kco_extract_script( $klarna_order['html_snippet'] ); } } @@ -747,7 +748,7 @@ function kco_validate_order_content( $klarna_order, $order ) { $match = true; $name = $klarna_item['name']; - if ( $quantity !== $klarna_item['quantity'] ) { + if ( strval( $quantity ) !== strval( $klarna_item['quantity'] ) ) { // translators: %1$s: Product name, %2$d: Expected quantity, %3$d: Found quantity. $notes[] = sprintf( __( 'The product "%1$s" has a quantity mismatch. Expected %2$d found %3$d.', 'klarna-checkout-for-woocommerce' ), $name, $klarna_item['quantity'], $quantity ); KCO_Logger::log( "$prefix WC order item reference: $reference ($name) has {$quantity} expected {$klarna_item['quantity']}." ); diff --git a/klarna-checkout-for-woocommerce.php b/klarna-checkout-for-woocommerce.php index 8233eaf5..776d008d 100644 --- a/klarna-checkout-for-woocommerce.php +++ b/klarna-checkout-for-woocommerce.php @@ -5,7 +5,7 @@ * Description: Klarna Checkout payment gateway for WooCommerce. * Author: Klarna * Author URI: https://klarna.com/ - * Version: 2.13.2 + * Version: 2.13.3 * Text Domain: klarna-checkout-for-woocommerce * Domain Path: /languages * @@ -35,7 +35,7 @@ /** * Required minimums and constants */ -define( 'KCO_WC_VERSION', '2.13.2' ); +define( 'KCO_WC_VERSION', '2.13.3' ); define( 'KCO_WC_MIN_PHP_VER', '5.6.0' ); define( 'KCO_WC_MIN_WC_VER', '3.9.0' ); define( 'KCO_WC_MAIN_FILE', __FILE__ ); diff --git a/languages/klarna-checkout-for-woocommerce.pot b/languages/klarna-checkout-for-woocommerce.pot index 7e673331..e4ba32ca 100644 --- a/languages/klarna-checkout-for-woocommerce.pot +++ b/languages/klarna-checkout-for-woocommerce.pot @@ -8,7 +8,7 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Language-Team: Krokedil \n" "Last-Translator: Krokedil \n" -"POT-Creation-Date: 2024-09-11 12:45+0000\n" +"POT-Creation-Date: 2024-09-23 09:42+0000\n" "Report-Msgid-Bugs-To: http://krokedil.se\n" "X-Poedit-Basepath: ..\n" "X-Poedit-KeywordsList: __;_e;_ex:1,2c;_n:1,2;_n_noop:1,2;_nx:1,2,4c;_nx_noop:1,2,3c;_x:1,2c;esc_attr__;esc_attr_e;esc_attr_x:1,2c;esc_html__;esc_html_e;esc_html_x:1,2c\n" @@ -26,7 +26,7 @@ msgid "Support" msgstr "" #. translators: Klarna order ID. -#: ../classes/class-kco-api-callbacks.php:108, ../includes/kco-functions.php:621 +#: ../classes/class-kco-api-callbacks.php:108, ../includes/kco-functions.php:622 msgid "Klarna order is under review, order ID: %s." msgstr "" @@ -34,7 +34,7 @@ msgstr "" msgid "Klarna Checkout order was rejected." msgstr "" -#: ../classes/class-kco-api-callbacks.php:101, ../includes/kco-functions.php:613 +#: ../classes/class-kco-api-callbacks.php:101, ../includes/kco-functions.php:614 msgid "Payment via Klarna Checkout, order ID: %s" msgstr "" @@ -512,32 +512,32 @@ msgstr "" msgid "Klarna Checkout is not available. Please choose a different payment option or contact the store for assistance." msgstr "" -#: ../includes/kco-functions.php:162 +#: ../includes/kco-functions.php:163 msgid "Select another payment method" msgstr "" -#: ../includes/kco-functions.php:632 +#: ../includes/kco-functions.php:633 msgid "Waiting for verification from Klarnas push notification" msgstr "" -#: ../includes/kco-functions.php:627 +#: ../includes/kco-functions.php:628 msgid "Klarna Checkout order was rejected" msgstr "" -#: ../includes/kco-functions.php:671 +#: ../includes/kco-functions.php:672 msgid "Klarna order total (%1$s) does not match WooCommerce order total (%2$s). Please verify the order with Klarna before processing." msgstr "" -#: ../includes/kco-functions.php:701 +#: ../includes/kco-functions.php:702 msgid "A mismatch between the WooCommerce and Klarna orders was identified. Please verify the order in the Klarna merchant portal before processing." msgstr "" #. translators: %1$s: Product name, %2$d: Expected quantity, %3$d: Found quantity. -#: ../includes/kco-functions.php:752 +#: ../includes/kco-functions.php:753 msgid "The product \"%1$s\" has a quantity mismatch. Expected %2$d found %3$d." msgstr "" -#: ../includes/kco-functions.php:761 +#: ../includes/kco-functions.php:762 msgid "The product \"%s\" was not found in the Klarna order." msgstr "" diff --git a/package.json b/package.json index d0eb787d..43ede430 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "klarna-checkout-for-woocommerce", - "version": "2.12.5", + "version": "2.13.3", "description": "Klarna Checkout for WooCommerce", "main": "gulpfile.js", "repository": "https://github.com/krokedil/klarna-checkout-for-woocommerce.git", diff --git a/readme.txt b/readme.txt index e8de2776..cb4dde47 100644 --- a/readme.txt +++ b/readme.txt @@ -54,6 +54,10 @@ Klarna Checkout works for merchants in Sweden, Finland, Norway, Germany, Austria For help setting up and configuring Klarna Checkout for WooCommerce please refer to our [documentation](https://docs.krokedil.com/klarna-checkout-for-woocommerce/). == Changelog == += 2024.09.23 - version 2.13.3 = +* Tweak - Adjusted the order comparison verification between Klarna and WooCommerce. +* Fix - Addressed Woo Quality Insights issues and recommendations. + = 2024.09.11 - version 2.13.2 = * Fix - Fixed an undefined array key warning.