Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@sidgaikwad
Copy link
Contributor

Summary

  • This feature adds support for fetching customer coupons from Stripe and showing applied
    discounts in the product view (DueToday component)
    .

Related Issues

Type of Change

  • Bug fix
  • New feature
  • Breaking change
  • Refactor
  • Other (please describe):

Checklist

  • I have read the CONTRIBUTING.md
  • My code follows the code style of this project
  • I have added tests where applicable
  • I have tested my changes locally
  • I have linked relevant issues
  • I have added screenshots for UI changes (if applicable)

Screenshots (if applicable)

image

Additional Context

■ File Changes
Backend

  • cusRouter.ts
  • Added /:customer_id/coupon route.
  • handleGetCustomerCoupon.ts
  • Extracted handler logic for retrieving coupon.
    Frontend
  • CusService.ts
  • Added getCustomerCoupon method.
  • DueToday.tsx
  • Added useEffect to fetch coupon on load.
  • Added state to store coupon/discount.
  • Extended rendering to include discount block and updated final total.

■ Additional Notes

  • The discount block only appears when a valid coupon is applied on the customer in Stripe.
  • Currently supports:
  • Percentage discounts (percent_off).
  • Fixed amount discounts (amount_off).
  • Handles both recurring discounts (e.g. duration_in_months) and one-time coupons.
  • Can be extended later to display coupon metadata (e.g. internal reward program ID).

■ Next Steps

  • Add unit tests for the new API endpoint.
  • Add UI tests to confirm discount calculations.
  • (Optional) Show coupon metadata (e.g. reward program name) in the UI.

@vercel
Copy link

vercel bot commented Sep 21, 2025

@sidgaikwad is attempting to deploy a commit to the Autumn Team on Vercel.

A member of the Team first needs to authorize it.

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