feat(order): an offer may not exceed the asking price - #48
Merged
Conversation
Negotiation only ever moves the price down. The asking price is already an offer to sell at it, so terms above it are a proposal neither side has a reason to make — and one nobody needs this route for, since the buyer can simply buy. Held on both routes and for both parties: opening a negotiation and countering one are the two halves of the same thing, and a rule enforced only when a case is opened is a rule with one move around it. A seller countering above their own asking price is the same nonsense from the other end. The ceiling is read when the move lands rather than frozen when the negotiation opened, so a seller who drops their asking price mid-thread has lowered it for the counter too — the offer row carries no copy of the price to go stale. The comparison is on the total, not on a derived unit price: the total is what either side types and what the escrow will hold, and dividing by the quantity first would let a rounded-down unit price pass a total that is over the line. An asking price the caller could not resolve (zero) enforces nothing — refusing every negotiation because a price lookup came back empty would be worse than the rule it protects. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
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.
Luật
Thương lượng chỉ đi xuống. Giá niêm yết vốn đã là lời đề nghị bán ở mức đó, nên một đề xuất cao hơn nó là thứ không bên nào có lý do gõ — và cũng không cần route này, vì người mua chỉ việc bấm mua.
Giữ ở cả hai route và cho cả hai bên: mở một thương lượng và trả giá là hai nửa của cùng một việc, và một luật chỉ áp lúc mở là một luật có đúng một nước đi vòng qua nó. Người bán trả giá cao hơn chính giá niêm yết của mình cũng là chuyện vô lý y hệt từ đầu kia.
Vài quyết định
Kiểm
TestOffer_NotAboveAskingPricephủ: mở trên trần bị từ chối, đúng bằng trần thì qua, trần nhân theo số lượng, trả giá trên trần bị từ chối và không đổi gì trên hàng, giá niêm yết không rõ thì không chặn.go test ./...xanh (49 package).api/openapi.gen.yamlđã chạy lại.Client: shopnexus/app#17.
🤖 Generated with Claude Code