Prepare durable discount decisions with exact sale receipts - #1011
Closed
sridharkalaibala wants to merge 4 commits into
Closed
sridharkalaibala wants to merge 4 commits into
sridharkalaibala wants to merge 4 commits into
Conversation
This was referenced Sep 28, 2026
Contributor
Author
|
The complete Business companion stack, including this change, is integrated into develop through #1023. All checks, including CodeQL, passed before merge. Closing this superseded stacked PR. |
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.
Remote discount decisions need to identify the exact bill and distinguish owner approval from application at checkout. Add a durable decision ledger with scoped revision checks, expiry, cancellation, one execution claim and an atomic audit timeline. This is an internal foundation: no phone or till route enables remote approval yet.
The bounded pricing preview reuses checkout tax/header calculations without numbering, stock, payment, register-lock or kitchen writes. A pre-commit gate receives the actual write pricing and can persist an immutable decision receipt with the sale. Acknowledgement verifies that receipt against the source, operation, approver, revision, execution and exact amounts. Uncertain retries reconcile the existing execution instead of running a second sale.
The first intent contract supports a new paid sale with a bill-level discount and two-decimal currency; unsupported combinations fail explicitly. Existing local manager approval is unchanged. Desktop/Gateway authentication, recent step-up, routes, mobile UI and automatic recovery remain integration gates in docs/BUSINESS_DECISIONS.md.
Validation: 602 related unit tests and eight real-Mongo integration tests pass. Coverage includes concurrent approvers, idempotent retries, expiry, self/scope denial, edited bills, stock rollback, actual Mongoose pricing/receipt persistence, nested receipt immutability, mismatched receipts and lost-response reconciliation. Formatting, attribution and collection classification pass; lint has no errors and existing warnings remain. No new CI jobs were added. Stacked on #1010.