From a6cd33677b20de1470e4420ec5cdc2fe64329f8a Mon Sep 17 00:00:00 2001 From: Joaquim d'Souza Date: Tue, 20 Jan 2026 14:04:49 +0100 Subject: [PATCH] feat: add parameter to exclude gocardless mandate from deletion --- packages/join-block/join.php | 2 +- packages/join-block/readme.txt | 2 +- .../join-block/src/Services/GocardlessService.php | 12 ++++++++---- packages/join-flow/src/index.tsx | 2 +- 4 files changed, 11 insertions(+), 7 deletions(-) diff --git a/packages/join-block/join.php b/packages/join-block/join.php index 55c02d7..7f5d458 100644 --- a/packages/join-block/join.php +++ b/packages/join-block/join.php @@ -3,7 +3,7 @@ /** * Plugin Name: Common Knowledge Join Flow * Description: Common Knowledge join flow plugin. - * Version: 0.2.22 + * Version: 0.2.23 * Author: Common Knowledge * Text Domain: common-knowledge-join-flow * License: GPLv2 or later diff --git a/packages/join-block/readme.txt b/packages/join-block/readme.txt index dc2c196..8b64631 100644 --- a/packages/join-block/readme.txt +++ b/packages/join-block/readme.txt @@ -4,7 +4,7 @@ Tags: membership, subscription, join Contributors: commonknowledgecoop Requires at least: 5.4 Tested up to: 6.8 -Stable tag: 0.2.22 +Stable tag: 0.2.23 Requires PHP: 7.4 License: GPLv2 or later License URI: https://www.gnu.org/licenses/gpl-2.0.html diff --git a/packages/join-block/src/Services/GocardlessService.php b/packages/join-block/src/Services/GocardlessService.php index a9a489f..ef0ba07 100644 --- a/packages/join-block/src/Services/GocardlessService.php +++ b/packages/join-block/src/Services/GocardlessService.php @@ -171,7 +171,7 @@ public static function removeCustomerById($customerId) } } - public static function removeCustomerMandates($customerId) + public static function removeCustomerMandates($customerId, $dontRemoveId = null) { global $joinBlockLog; $joinBlockLog->info("Removing existing mandates for customer {$customerId}"); @@ -180,12 +180,16 @@ public static function removeCustomerMandates($customerId) "params" => ["customer" => $customerId] ]); foreach ($mandates->records as $mandate) { + if ($mandate->id === $dontRemoveId) { + $joinBlockLog->info("Not removing mandate for customer {$customerId}" . $mandate->id); + continue; + } try { - $joinBlockLog->info("Removing existing mandate for customer " . $mandate->id); + $joinBlockLog->info("Removing existing mandate for customer {$customerId}" . $mandate->id); $client->mandates()->cancel($mandate->id); - $joinBlockLog->info("Removed existing mandate for customer " . $mandate->id); + $joinBlockLog->info("Removed existing mandate for customer {$customerId}" . $mandate->id); } catch (\Exception $e) { - $joinBlockLog->error("Failed to delete customer mandate {$mandate->id}: " . $e->getMessage()); + $joinBlockLog->error("Failed to delete customer {$customerId} mandate {$mandate->id}: " . $e->getMessage()); } } } diff --git a/packages/join-flow/src/index.tsx b/packages/join-flow/src/index.tsx index 3cd6f62..b59055a 100644 --- a/packages/join-flow/src/index.tsx +++ b/packages/join-flow/src/index.tsx @@ -24,7 +24,7 @@ const init = () => { const sentryDsn = getEnvStr("SENTRY_DSN") Sentry.init({ dsn: sentryDsn, - release: "1.2.22" + release: "0.2.23" }); if (getEnv('USE_CHARGEBEE')) {