Skip to content

Feat/cart promo api#521

Open
hashhhh-16 wants to merge 5 commits into
niharika-mente:mainfrom
hashhhh-16:feat/cart-promo-api
Open

Feat/cart promo api#521
hashhhh-16 wants to merge 5 commits into
niharika-mente:mainfrom
hashhhh-16:feat/cart-promo-api

Conversation

@hashhhh-16

Copy link
Copy Markdown
Contributor

Description

Implemented promo code application support for carts by reusing the existing Coupon validation system.

Changes Made

  • Added POST /api/cart/apply-promo endpoint

  • Added cart route registration

  • Reused existing Coupon model for promo validation

  • Added discount calculation and validation logic

  • Added test coverage for:

    • Valid percentage coupons
    • Valid flat coupons
    • Invalid coupons
    • Expired coupons
    • Usage limits
    • Minimum order amount validation
    • Missing coupon code
    • Flat discount exceeding cart total

Why

The repository already contains a Coupon model and validation infrastructure. This implementation avoids duplicating discount logic while providing the cart-specific promo application endpoint requested in #447.

closes #447

@vercel

vercel Bot commented Jun 27, 2026

Copy link
Copy Markdown

Someone is attempting to deploy a commit to the niharika-mente's projects Team on Vercel.

A member of the Team first needs to authorize it.

Aamod007
Aamod007 previously approved these changes Jul 2, 2026

@Aamod007 Aamod007 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@Aamod007 Aamod007 self-requested a review July 2, 2026 17:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: implement an API to apply discount promo codes to a cart

2 participants