-
Notifications
You must be signed in to change notification settings - Fork 99
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(invoices): Ability to skip 0 invoices #2462
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
brunomiguelpinto
added
Customer
Customer management
Organization
Related to Organization
Invoice
Related to Invoices
labels
Aug 22, 2024
brunomiguelpinto
force-pushed
the
feat-skip-0-invoices
branch
3 times, most recently
from
August 23, 2024 16:07
1812509
to
339e425
Compare
brunomiguelpinto
force-pushed
the
feat-skip-0-invoices
branch
from
August 28, 2024 14:43
b5f87ae
to
a6f1622
Compare
brunomiguelpinto
changed the title
feat: add migrations to the new fields
feat(invoices):
Aug 28, 2024
brunomiguelpinto
changed the title
feat(invoices):
feat(invoices): Ability to skip 0 invoices
Aug 28, 2024
brunomiguelpinto
force-pushed
the
feat-skip-0-invoices
branch
from
August 29, 2024 13:20
a6f1622
to
3c6cf4b
Compare
rsempe
approved these changes
Aug 29, 2024
annvelents
approved these changes
Aug 30, 2024
This was referenced Sep 2, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Context
We currently finalize all invoices, including those with a total amount of $0, leading to unnecessary clutter and potential confusion. To improve flexibility and reduce unnecessary finalizations, organizations will now have the option to decide whether $0 invoices should be finalized or not. This setting can be configured at the organization level, with the option to override it for individual customers.
Description
This PR introduces a new service,
TransitionToFinalStatusService
, which checks thefinalize_zero_amount_invoice
setting to decide whether tofinalize
an invoice or move it to theclosed
state after checking the customer and organization setting ( if the invoicefees_amount_cents
is 0 )Changes
Organization Setting
Added a new parameter
finalize_zero_amount_invoice
to the organization settings:Customer Setting
Added a new parameter
finalize_zero_amount_invoice
to the customer settings to allow overriding the organization-level setting:Possible Values:
inherit
: (Default) The setting follows the organization-level configuration.finalize
: Invoices are issued and finalized, even if the total amount is $0.skip
: Invoices with a total amount of $0 are not finalized.TransitionToFinalStatusService
The service checks the
finalize_zero_amount_invoice
setting to determine whether to finalize an invoice or move it to theclosed
state after evaluating the customer, organization, and invoice amount.Invoice State:
closed
closed
state for invoices with a total amount of $0.Service Integration
The new
TransitionToFinalStatusService
was integrated into various points where invoices are finalized:Invoices::AdvanceChargesService
Invoices::CreateOneOffService
Invoices::CreatePayInAdvanceChargeService
Invoices::RefreshDraftAndFinalizeService
Invoices::SubscriptionService