From 9ee5ce95ca7b2678130ac5dd42604ec1dd7fb555 Mon Sep 17 00:00:00 2001 From: Michael Herzog Date: Wed, 22 May 2024 17:37:32 +0200 Subject: [PATCH] PayPal: Only void orders via webhook if payment wasn't captured yet --- .../Smartstore.PayPal/Controllers/PayPalController.cs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/Smartstore.Modules/Smartstore.PayPal/Controllers/PayPalController.cs b/src/Smartstore.Modules/Smartstore.PayPal/Controllers/PayPalController.cs index 561861cf2d..8c6b5696e8 100644 --- a/src/Smartstore.Modules/Smartstore.PayPal/Controllers/PayPalController.cs +++ b/src/Smartstore.Modules/Smartstore.PayPal/Controllers/PayPalController.cs @@ -488,9 +488,11 @@ private async Task HandleCaptureAsync(Order order, WebhookResource resource) break; case "declined": - order.CaptureTransactionResult = status; - order.PaymentStatus = PaymentStatus.Voided; - await _orderProcessingService.VoidOfflineAsync(order); + if (order.CanVoidOffline()) + { + order.CaptureTransactionResult = status; + await _orderProcessingService.VoidOfflineAsync(order); + } break; case "refunded":