Skip to content

Conversation

@xabg2
Copy link
Collaborator

@xabg2 xabg2 commented Nov 25, 2025

When a coupon discount exceeds the product’s original price, we must calculate taxes based on €0 instead of the resulting negative amount. Stripe rejects negative prices, so adjusting the taxable amount to zero prevents errors.

@xabg2 xabg2 self-assigned this Nov 25, 2025
@xabg2 xabg2 requested a review from sg-gs as a code owner November 25, 2025 14:56
@xabg2 xabg2 added the bug Something isn't working label Nov 25, 2025
@sonarqubecloud
Copy link

});
});

test('When the user provides a promo code with a discount that is more than the product price, then the price should be 0 instead of a negative price', async () => {
Copy link
Member

Choose a reason for hiding this comment

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

To not block you know, I will leave it as a suggestion: if the controller allows it (because it is valid), consider handling these things at the business case level the next time (services/domains).

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I'll keep that in mind. Thanks for the feedback! 🙌🏽

@xabg2 xabg2 merged commit 594f050 into master Nov 25, 2025
11 checks passed
@xabg2 xabg2 deleted the fix/negative-amount-when-calculating-taxes branch November 25, 2025 15:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working ready-for-preview

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants