Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feat] Coupon system #66

Merged
merged 5 commits into from
Apr 26, 2024
Merged

[Feat] Coupon system #66

merged 5 commits into from
Apr 26, 2024

Conversation

rafaelsideguide
Copy link
Collaborator

WIP. Idea for solving #57

WIP. Idea for solving #57
@nickscamara
Copy link
Member

  • Change the order in bill to check coupon before subscription

  • Make sure to decrease the coupon credits when billed

  • On the check credits, make sure to check for the sum of the coupons

  • Make sure people with no subscriptions can use coupons and people with subscriptions as well.

@rafaelsideguide
Copy link
Collaborator Author

rafaelsideguide commented Apr 26, 2024

X = Number of free credits

Test Cases:

  • User with No Subscription and No Coupons
    Expected Result: User should have access to X free credits.

  • User with No Subscription and One 10-Credit Coupon
    Expected Result: User should have a total of X + 10 credits available; after use, the coupon balance should be zero.

  • User with No Subscription and Five 10-Credit Coupons (Using 30 Credits)
    Expected Result: User should utilize 30 credits from the coupons; three coupons should be fully used (zero balance) and two coupons should remain with 10 credits each.

  • User with No Subscription and Five 10-Credit Coupons (Using X + 50 Credits)
    Expected Result: User should utilize 150 credits; all five coupons should have zero balance at the end.

  • User with Subscription and One 10-Credit Coupon (Using 20 Credits)
    Expected Result: User should use 10 credits from the coupon (leaving it with zero balance) and 10 credits from the subscription.

  • User with Subscription and Five 10-Credit Coupons (Using 30 Credits)
    Expected Result: User should use 30 credits from the coupons; three coupons should be depleted (zero balance) and two should have 10 credits each remaining.

  • User with Subscription and Five 10-Credit Coupons (Using 70 Credits)[
    Expected Result: User should use 50 credits from the coupons (leaving them with zero balance) and 20 credits from the subscription.

@rafaelsideguide rafaelsideguide marked this pull request as ready for review April 26, 2024 19:28
Copy link
Member

@nickscamara nickscamara left a comment

Choose a reason for hiding this comment

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

Lgtm! Great job Rafa!

@nickscamara nickscamara merged commit fb08f28 into main Apr 26, 2024
1 check passed
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.

2 participants