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(invoice-preview): add logic for applying coupons on preview invoice #3073

Merged
merged 4 commits into from
Jan 21, 2025

Conversation

lovrocolic
Copy link
Collaborator

Context

Preview feature enables fetching first Lago invoice. This invoice is not persisted and is calculated on the fly.

Description

This PR adds service for applying coupons on preview invoice. The goal was not to affect heavily main service for applying coupons on invoices.

In order not to repeat the code, some common logic is extracted s that it can be used on both places

Copy link
Contributor

@ancorcruz ancorcruz left a comment

Choose a reason for hiding this comment

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

left a few comments...

app/models/applied_coupon.rb Show resolved Hide resolved
spec/models/fee_spec.rb Show resolved Hide resolved
spec/services/applied_coupons/amount_service_spec.rb Outdated Show resolved Hide resolved
spec/services/invoices/preview_service_spec.rb Outdated Show resolved Hide resolved
app/services/coupons/preview_service.rb Show resolved Hide resolved
Copy link
Contributor

@ancorcruz ancorcruz left a comment

Choose a reason for hiding this comment

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

Looks great thanks for addressing all the feedback. 🚀

@lovrocolic lovrocolic merged commit cf691a0 into main Jan 21, 2025
6 checks passed
@lovrocolic lovrocolic deleted the add-preview-coupons-service branch January 21, 2025 10:46
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.

2 participants