Skip to content

Hide abandoned checkouts in the payment transaction list - #1066

Merged
KrzysztofPajak merged 3 commits into
developfrom
fix/payment-transaction-temp-list
Nov 18, 2026
Merged

KrzysztofPajak merged 3 commits into
developfrom
fix/payment-transaction-temp-list

Conversation

@KrzysztofPajak

@KrzysztofPajak KrzysztofPajak commented Nov 18, 2026 •

Copy link
Copy Markdown
Member

Type: bugfix

Issue

The panel's payment transaction list showed every transaction, including those of a checkout that never became an order. PlaceOrderCommandHandler creates the transaction with Temp = true before the payment is processed, so every failed or unfinished payment stays in the list as a Pending payment with no order number. On a busy store these rows bury the real payments.

Before this change the flag was cleared only at the very end, after the order was saved and completed. If saving the order or a handler of its inserted event failed after the gateway had taken the payment, the transaction kept Temp = true, so a filter on Temp would hide the one row an admin needs for a refund.

To reproduce: start a checkout with a payment method that fails (or close the browser on the gateway page before the order is placed), then open Sales → Payment transactions: a Pending row without an order number is listed.

Solution

  • PlaceOrderCommandHandler records the gateway's answer on the transaction (status, paid amount, Temp = false) right after the payment succeeds, before the order is written. Temp now means exactly "the payment never went through": in progress, failed or abandoned.
  • GetPaymentTransactionQuery.IncludeTemp (default true): when false, transactions with Temp set are left out. The panel list (Admin and Store, shared controller and view) sends the query with the new "Show abandoned checkouts" filter, off by default. Searching by order number always includes them, so the list agrees with "Go to order number".
  • CanDeletePaymentTransactionQuery (Refuse to delete a payment transaction that belongs to an order #1065): the one-hour "checkout may still be in progress" wait now applies to every transaction, not only Temp ones. Otherwise a Pending transaction would be deletable in the moment between recording the payment and writing the order.
  • Resources Admin.Orders.PaymentTransaction.List.ShowAbandoned (+ .Hint) in DefaultLanguage.xml and Upgrade/en_250.xml (applied by the existing 2.5 resource migration).
  • No cleanup task, no migration, no index: Temp has been stored on every transaction since the start, and the list is already narrowed by store and date.

Breaking changes

None. IPaymentTransactionService is unchanged. Behavior changes: the panel list hides abandoned checkouts by default; the payment transaction is updated before the order is inserted instead of after it is completed; a Pending transaction without an order can be deleted only one hour after its last change.

Testing

  1. Leave at least one checkout unfinished so a transaction without an order exists (see Issue), and place one normal order.
  2. Admin → Sales → Payment transactions → Search: only the transaction of the placed order is listed.
  3. Open Filters, tick "Show abandoned checkouts", Search: the abandoned Pending transaction (no order number) is listed too.
  4. Repeat in the Store panel as a store manager.
  5. dotnet test src/Tests/Grand.Business.Checkout.Tests (884 passed) and dotnet test src/Tests/Grand.Web.Admin.Tests --filter FullyQualifiedName~PaymentTransaction (46 passed).

Copilot AI balanced review requested due to automatic review settings November 18, 2026 16:25

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.

support added 2 commits November 18, 2026 18:53
…ction-temp-list

# Conflicts:
#	src/Web/Grand.Web/App_Data/Resources/DefaultLanguage.xml
#	src/Web/Grand.Web/App_Data/Resources/Upgrade/en_250.xml
A transaction stayed Temp when saving the order or a handler of its
inserted event failed after the gateway took the payment, so the list
hid it as an abandoned checkout. The payment is now recorded right after
the gateway answers. Deleting waits an hour after any change, not only
on Temp ones, and searching by order number shows the transaction
whatever state it is in. The list sends GetPaymentTransactionQuery
itself, leaving IPaymentTransactionService unchanged.

//what the gateway did stays visible, and the transaction is not taken for an abandoned checkout
_paymentTransactions.Verify(x => x.UpdatePaymentTransaction(It.Is<PaymentTransaction>(t =>
t.Id == "tx" && !t.Temp && t.TransactionAmount == details.OrderTotal)), Times.Once);
@KrzysztofPajak
KrzysztofPajak merged commit 4402296 into develop Nov 18, 2026
9 checks passed
@KrzysztofPajak
KrzysztofPajak deleted the fix/payment-transaction-temp-list branch November 18, 2026 18:22
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