Skip to content

feat(order): an offer may not exceed the asking price - #48

Merged
beanbocchi merged 1 commit into
mainfrom
feat/offer-not-above-asking
Aug 11, 2026
Merged

feat(order): an offer may not exceed the asking price#48
beanbocchi merged 1 commit into
mainfrom
feat/offer-not-above-asking

Conversation

@beanbocchi

Copy link
Copy Markdown
Member

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

  • Trần đọc lúc nước đi hạ xuống, không đóng băng lúc mở thương lượng: người bán hạ giá niêm yết giữa chừng thì đã hạ cho cả lượt trả giá. Hàng offer không giữ bản sao nào của giá để mà cũ đi.
  • So trên tổng tiền, không trên đơn giá suy ra: tổng là thứ hai bên gõ và là thứ escrow sẽ giữ, còn chia cho số lượng trước sẽ để một đơn giá làm tròn xuống cho lọt một tổng đã vượt.
  • Không tra được giá niêm yết (0) thì không chặn gì: từ chối mọi thương lượng vì một lượt đọc giá về rỗng còn tệ hơn chính cái luật nó bảo vệ.

Kiểm

TestOffer_NotAboveAskingPrice phủ: 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

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>
@beanbocchi
beanbocchi merged commit 740ac68 into main Aug 11, 2026
1 of 2 checks passed
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.

1 participant