Skip to content

fix(coupon): properly update usage_count on promo_codes table in recordCouponUsage - #1707

Open
Pratyush-Panda-2006 wants to merge 1 commit into
AnthropicBots:mainfrom
Pratyush-Panda-2006:fix/coupon-promo-usage-tracking
Open

fix(coupon): properly update usage_count on promo_codes table in recordCouponUsage#1707
Pratyush-Panda-2006 wants to merge 1 commit into
AnthropicBots:mainfrom
Pratyush-Panda-2006:fix/coupon-promo-usage-tracking

Conversation

@Pratyush-Panda-2006

Copy link
Copy Markdown
Contributor

Description

Fixes promo code usage tracking in \�ackend/services/couponService.js. Previously,
ecordCouponUsage\ exclusively updated the \coupons\ table, meaning coupons redeemed from the fallback \promo_codes\ table never had their \usage_count\ incremented, resulting in unlimited redemptions.

Related Issue

Closes #1692

Clean Architecture & Changes

  • Supported \isPromoTable\ parameter and added automatic fallback to \promo_codes\ table when \coupons\ update does not match any rows.
  • Incremented \usage_count\ properly on \promo_codes.
  • Added unit tests in \�ackend/tests/promoCodeUsage.test.js\ validating \promo_codes\ usage updates.

Verification

  • Run
    px jest tests/promoCodeUsage.test.js\ (All unit tests passing cleanly).

@hydra-maintainer

Copy link
Copy Markdown

🔍 Quality Gate Report

✅ All quality gates passed!

Status Check Details
Linked Issue PR description references a closing issue ✅

@vercel

vercel Bot commented Aug 27, 2026

Copy link
Copy Markdown

@Pratyush-Panda-2006 is attempting to deploy a commit to the Bhuvansh's projects Team on Vercel.

A member of the Team first needs to authorize it.

@hydra-maintainer

Copy link
Copy Markdown

🤖 AI Code Review

🔴 Score: 50/100 | comment

AI review unavailable at this time.


Automated AI review — a human maintainer will also review.

@hydra-maintainer

Copy link
Copy Markdown

💡 Suggested reviewers based on relevant file history: @Aditya8369, @MOHITKOURAV01

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.

[Bug] Promo Code Usage Limit Not Incremented After Order Completion in Coupon Service

1 participant