Repository navigation
Fix auction bid-to-order link, bid currency, stuck auctions and buy-it-now - #1178
Open
grandnode-dev wants to merge 8 commits into
Open
grandnode-dev wants to merge 8 commits into
grandnode-dev wants to merge 8 commits into
Conversation
added 6 commits
December 3, 2026 12:52
The bid was looked up by the cart item id, so an auction win never got its order id: cancelling or deleting that order left the bid untouched, staff could delete the winning bid, and My auctions showed no order. A cancelled win now leaves the auction ended and recomputes the highest bid from the remaining bids without naming a bidder.
A bid typed in a non-primary working currency was stored as if it were in the primary store currency, and the bid input and the after-bid popup started from primary amounts. The bid is now converted to the primary store currency before it is validated and saved, and both show amounts in the working currency.
When the customer of the highest bid no longer exists, or the bid cannot be added to their cart, the task logged and left the auction open, so it was picked up again on every run and never ended. It now ends without a winner, clears the highest bidder and tells the store owner the auction expired.
Buy-it-now stayed available after the highest bid had reached or passed the buy-it-now price, so the item could be bought for less than a customer had already bid. It is now hidden on the product page and refused by the cart. After a buy-it-now, the other bidders get the auction-lost message.
…price Catalog and search listings still offered add-to-cart for an auction whose bidding had reached the buy-it-now price; the cart refused it. Listings now show the bid button instead, like the product page.
The buy-it-now message already goes to every other bidder (AuctionEnded.CustomerNotificationBin), so the auction-lost message added for them sent each bidder two mails for one sale. Found in E2E.
added 2 commits
December 3, 2026 17:13
- CancelBidByOrder removes every bid linked to the order, publishes EntityDeleted for each, and leaves the cancelling customer's earlier bids out of the recomputed highest bid - UpdateBids links only a winning bid that has no order yet - A bid converted to the primary currency is rounded to 2 decimals - The product page converts the start price and highest bid for auctions only
Two bids checked against the same product state both passed validation, and the later write won even when it was lower. The highest bid is now written only forward, with a filter on the stored amount. The highest bid and the auction-ended flag are written as single fields instead of the whole product, which came from the cache and could undo changes made since it was read. The latest bid is read with one sorted query instead of loading every bid.
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
Five bugs in auction products (
ProductType.Auction):PlaceOrderCommandHandler.UpdateBidslooked bids up withGetBidsByProductId(sc.Id), the cart item id instead of the product id, soBid.OrderIdstayed empty for every auction win. Cancelling or deleting that order left the bid untouched, staff could delete the winning bid of a placed order (BidDeleteonly blocks bids with an order), and My auctions showed no order. When it did run,CancelBidByOrderset the highest bid to 0 although other bids remained, and re-opened an auction whose end date had already passed, so the next task run handed the item to the next-highest bidder without anyone deciding that.AddBidstored the typed amount without conversion. With EUR selected and USD as the primary currency, a bid of 950 EUR was stored as 950 USD.EndAuctionsTasklogged and moved on without ending the auction.GetAuctionsToEndreturned it again on every run, forever.Solution
UpdateBidslooks up the product's bids and takes the customer's winning bid that has no order yet.CancelBidByOrderdeletes every bid of the order (one order can hold several auction items) and publishesEntityDeletedfor each, recomputes the highest bid from the remaining bids of other customers and leaves the auction ended with no bidder named; the store owner decides whether to list it again (the existing order-cancelled message already tells them).AddBidconverts the bid from the working currency to the primary store currency before it is validated and saved, and rounds it to 2 decimals after the conversion. The product page converts the start price and highest bid for auctions only. The bid input and the after-bid popup show amounts in the working currency.EndAuctionsTaskends such an auction without a winner, clears the highest bidder and logs a warning with the reason. It sends the existingAuctionExpired.StoreOwnerNotification(seeded inactive, as before for auctions without bids).Product.IsBuyNowOutbid()(auction with a highest bid at or above the price). The product page and listings hide buy-it-now, andShoppingCartStandardValidatorrefuses it withShoppingCart.BuyingDisabled. An auction without bids behaves as before. The other bidders are already told by the existing buy-it-now message (AuctionEnded.CustomerNotificationBin).NewBidwrites the highest bid only forward (a filter on the stored amount), andUpdateHighestBid/UpdateAuctionEndedwrite their fields instead of the whole product.GetLatestBidreads one sorted row instead of loading every bid.Breaking changes
GetAddToCartHandler(Grand.Web) takesICurrencyServicein its constructor. It is resolved by DI; only a class deriving from it would need a change.No other public signatures change; no settings, resources or migrations.
Testing
dotnet test src/Tests/Grand.Business.Checkout.Tests --filter "PlaceOrderCommandHandlerAuctionTests|AuctionBuyNow",dotnet test src/Tests/Grand.Business.Catalog.Tests --filter AuctionServiceTests,dotnet test src/Tests/Grand.Modules.Tests --filter EndAuctionsTaskTests,dotnet test src/Tests/Grand.Web.Tests --filter ActionCartControllerAddBidTests. Each new test fails without its fix.dotnet test GrandNode.slnx -m:1passes (all 23 test projects). Run in parallel, some reservation, report and SCIM tests fail intermittently; they pass on their own and do not touch this code.