Skip to content

Commit

Permalink
PayPal: Directly captured payments cannot be voided offline
Browse files Browse the repository at this point in the history
(cherry picked from commit 5819abb)
  • Loading branch information
Michael-Herzog committed Jan 14, 2025
1 parent cbb8124 commit 14a0b31
Showing 1 changed file with 12 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -626,10 +626,19 @@ private async Task HandleCaptureAsync(Order order, WebhookResource resource)
break;

case "declined":
if (order.CanVoidOffline())
var settings = await Services.SettingFactory.LoadSettingsAsync<PayPalSettings>(order.StoreId);
order.CaptureTransactionResult = status;
if (settings.Intent == PayPalTransactionType.Authorize)
{
order.CaptureTransactionResult = status;
await _orderProcessingService.VoidOfflineAsync(order);
if (order.CanVoidOffline())
{
await _orderProcessingService.VoidOfflineAsync(order);
}
}
else
{
order.PaymentStatus = PaymentStatus.Voided;
await _orderProcessingService.CancelOrderAsync(order, true);
}
break;

Expand Down

0 comments on commit 14a0b31

Please sign in to comment.