Skip to content

Refuse a full refund once part of the payment has been refunded - #1092

Merged
KrzysztofPajak merged 1 commit into
developfrom
fix/full-refund-guard
Nov 23, 2026
Merged

KrzysztofPajak merged 1 commit into
developfrom
fix/full-refund-guard

Conversation

@KrzysztofPajak

Copy link
Copy Markdown
Member

The full refund command refunded and recorded the whole paid amount without checking the transaction. The Refund button is hidden after a partial refund, but the action still accepted the post. The command then added the full paid amount to what was already refunded, and a provider without its own check refunded the money again.

Changes

  • RefundCommandHandler: sends CanRefundQuery before refunding and throws when it is refused, the same way PartiallyRefundCommandHandler and RefundOfflineCommandHandler already check their queries. The payment transaction screen shows the error.

Tests

  • RefundCommandHandlerTests.Handle_CannotRefund_Throws_AndRefundsNothing (new).
  • Grand.Business.Checkout.Tests (1117) pass.

The full refund command refunded and recorded the whole paid amount without checking the transaction. After a partial refund, a full refund posted from the payment transaction screen counted the paid amount on top of what was already refunded, and providers without their own check refunded it again.

The command now asks CanRefundQuery first, as the partial and offline refunds already ask their queries, and stops with an error when the refund is not allowed.
Copilot AI balanced review requested due to automatic review settings November 22, 2026 19:37

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

@KrzysztofPajak
KrzysztofPajak merged commit f04fede into develop Nov 23, 2026
9 checks passed
@KrzysztofPajak
KrzysztofPajak deleted the fix/full-refund-guard branch November 25, 2026 09:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants