Skip to content

fix: ignore unusable coupons in the cart and recalculate VAT per line - #5

Open
bahriy-dev wants to merge 1 commit into
feat/discount-couponsfrom
fix/coupon-cart-and-vat
Open

bahriy-dev wants to merge 1 commit into
feat/discount-couponsfrom
fix/coupon-cart-and-vat

Conversation

@bahriy-dev

Copy link
Copy Markdown
Owner

Fixes the two issues found in the review of #3.

What changed

  • Cart shows unusable coupons honestly: an expired, used-up or below-minimum coupon stays visible with usable: false and a reason, but no longer reduces the totals. Before, the cart advertised a discount that checkout then rejected with 409.
  • VAT is rounded once: the discount is spread over the cart lines (largest-remainder, so it adds up exactly) and VAT is recalculated per line on the discounted amount. Scaling the already-rounded VAT could be off by a kuruş (e.g. a 3 kuruş item with a 1 kuruş discount).
  • README updated; 4 new tests (40 total).

The cart now shows an expired, used-up or below-minimum coupon with usable: false and a
reason instead of applying a discount that checkout would reject. The discount is spread
over the lines and VAT is recalculated per line on the discounted amount, so it is rounded
once. Adds 4 tests.
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 9, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-09T11:05:11.271602Z dc9b4eb PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

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