+
BTCPay Server: ' . wp_kses_post( $message ) ?>
getDefaultOrderStateMappings();
}
+ // Check if the order is already in a final state, if so do not update it if the orders are protected.
+ $protectedOrders = get_option('btcpay_gf_protect_order_status', 'no');
+
+ if ($protectedOrders === 'yes') {
+ // Check if the order status is either 'processing' or 'completed'
+ if ($order->has_status(array('processing', 'completed'))) {
+ $note = sprintf(
+ __('Webhook (%s) received from BTCPay, but the order is already processing or completed, skipping to update order status. Please manually check if everything is alright.', 'btcpay-greenfield-for-woocommerce'),
+ $webhookData->type
+ );
+ $order->add_order_note($note);
+ return;
+ }
+ }
+
switch ($webhookData->type) {
case 'InvoiceReceivedPayment':
if ($webhookData->afterExpiration) {
diff --git a/src/Helper/UpdateManager.php b/src/Helper/UpdateManager.php
index ec8ab8c..231a666 100644
--- a/src/Helper/UpdateManager.php
+++ b/src/Helper/UpdateManager.php
@@ -7,7 +7,8 @@
class UpdateManager {
private static $updates = [
- '1.0.3' => 'update-1.0.3.php'
+ '1.0.3' => 'update-1.0.3.php',
+ '2.4.1' => 'update-2.4.1.php'
];
/**
diff --git a/updates/update-2.4.1.php b/updates/update-2.4.1.php
new file mode 100644
index 0000000..b5fba32
--- /dev/null
+++ b/updates/update-2.4.1.php
@@ -0,0 +1,12 @@
+