Repository navigation
Hide abandoned checkouts in the payment transaction list - #1066
Merged
Merged
Conversation
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); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Type: bugfix
Issue
The panel's payment transaction list showed every transaction, including those of a checkout that never became an order.
PlaceOrderCommandHandlercreates the transaction withTemp = truebefore the payment is processed, so every failed or unfinished payment stays in the list as aPendingpayment 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 onTempwould 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
PlaceOrderCommandHandlerrecords the gateway's answer on the transaction (status, paid amount,Temp = false) right after the payment succeeds, before the order is written.Tempnow means exactly "the payment never went through": in progress, failed or abandoned.GetPaymentTransactionQuery.IncludeTemp(defaulttrue): when false, transactions withTempset 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 onlyTempones. Otherwise a Pending transaction would be deletable in the moment between recording the payment and writing the order.Admin.Orders.PaymentTransaction.List.ShowAbandoned(+.Hint) inDefaultLanguage.xmlandUpgrade/en_250.xml(applied by the existing 2.5 resource migration).Temphas been stored on every transaction since the start, and the list is already narrowed by store and date.Breaking changes
None.
IPaymentTransactionServiceis 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
dotnet test src/Tests/Grand.Business.Checkout.Tests(884 passed) anddotnet test src/Tests/Grand.Web.Admin.Tests --filter FullyQualifiedName~PaymentTransaction(46 passed).