Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion bluem.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
$bluem_db_version = 1.5;

const BLUEM_WOOCOMMERCE_MANUAL_URL = "https://codexology.notion.site/Bluem-voor-WordPress-en-WooCommerce-Handleiding-9e2df5c5254a4b8f9cbd272fae641f5e";
const BLUEM_PLUGIN_VERSION = '1.6.0';
const BLUEM_PLUGIN_VERSION = '1.6.1';

require __DIR__ . '/vendor/autoload.php';

Expand Down
1 change: 1 addition & 0 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ Shortcode: `[bluem_identificatieformulier]`
It is possible to programmatically block display and functionality on your site based on the verification status. Please contact us if you are interested in developing this in your site.

== Changelog ==
- 1.6.1: Fixed incorrect WooCommerce order matching for Bluem payment and eMandate callbacks when HPOS is disabled.
- 1.6.1: Fixed Bluem payment, mandate, identity, and integration callback URLs for sites using WordPress Plain permalinks.
- 1.6.0: Confirmed compatibility with WordPress 7.1, including activation, Bluem settings, classic and Blocks payment gateways, shortcode rendering, and WooCommerce HPOS order administration paths.
- 1.5.5: Prevented cookie header warnings by skipping cookie writes after headers are sent or during WP-Cron.
Expand Down
12 changes: 12 additions & 0 deletions src/Payments/BluemOrderQuery.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,18 @@ final class BluemOrderQuery
*/
public static function mapHposArgs(array $query_args): array
{
// WC_Order_Query applies this filter for both order data stores. The
// legacy CPT store relies on the custom arguments below being present
// so its `woocommerce_order_data_store_cpt_get_orders_query` filters
// can translate them. Removing them there makes the query unfiltered,
// which can incorrectly return the newest order.
if (
! class_exists('Automattic\\WooCommerce\\Utilities\\OrderUtil')
|| ! \Automattic\WooCommerce\Utilities\OrderUtil::custom_orders_table_usage_is_enabled()
) {
return $query_args;
}

$metadata = [
'bluem_transactionid' => 'bluem_transactionid',
'bluem_entrancecode' => 'bluem_entrancecode',
Expand Down
24 changes: 24 additions & 0 deletions tests/Unit/BluemCheckoutCompatibilityTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,18 @@ protected function get_setting($key, $default = null)
}
}

namespace Automattic\WooCommerce\Utilities {
final class OrderUtil
{
public static bool $custom_orders_table_enabled = true;

public static function custom_orders_table_usage_is_enabled(): bool
{
return self::$custom_orders_table_enabled;
}
}
}

namespace {
if (!function_exists('get_option')) {
function get_option($key, $default = false)
Expand Down Expand Up @@ -89,6 +101,7 @@ final class BluemCheckoutCompatibilityTest extends TestCase
{
protected function setUp(): void
{
\Automattic\WooCommerce\Utilities\OrderUtil::$custom_orders_table_enabled = true;
$GLOBALS['bluem_test_options'] = [];
$GLOBALS['bluem_test_registered_script'] = null;
$GLOBALS['bluem_test_woocommerce'] = new \BluemTestWooCommerce(
Expand Down Expand Up @@ -116,6 +129,17 @@ public function testHposQueryMappingSupportsPaymentAndMandateCorrelation(): void
self::assertSame('bluem_mandateid', $result['meta_query'][3]['key']);
}

public function testLegacyOrderStorageKeepsCustomCorrelationArguments(): void
{
\Automattic\WooCommerce\Utilities\OrderUtil::$custom_orders_table_enabled = false;

$arguments = [
'bluem_mandateid' => 'mandate-123',
];

self::assertSame($arguments, BluemOrderQuery::mapHposArgs($arguments));
}

public function testBlocksPaymentMethodReadsGatewaySettingsAndRegistersItsScript(): void
{
$GLOBALS['bluem_test_options']['woocommerce_bluem_payments_ideal_settings'] = [
Expand Down
Loading