-
Notifications
You must be signed in to change notification settings - Fork 112
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(trial): Invoice subscription fee at the end of the trial period (#…
…1847) ## Context When a subscription has a trial period, we want to invoice the customer at the end of the trial, not at the beginning. Following #1820 and #1821 ## Description * Disable billing when creating a new subscription if there is a trial * Disable billing when activating a pending subscription if there is a trial * Run the `Subscriptions::FreeTrialBillingService` introduced in #1821 every hour * Migrate data for existing subscription with trial already ended * Ensure we don't bill customers if an invoice was created when the subscription started (for sub created before this feature) ### Free trial reminder Keep in mind that if you're trial ends on day X, this day is *NOT FREE*. If the 10 days free trial start on the 10th at 14:00, it will end on the 20th at 14:00. You get the 10th to the 19th for free. Day 20 is your first pay day even if you're still in trial for a few hours. This was not changed in this PR or other related PRs. ## Note * Introduction of `invoice.skip_charge` * Refactor of charge fees for first invoice, see: #1836 * Handle grace_period * Handle minimum_commitment --------- Co-authored-by: Romain Sempé <[email protected]>
- Loading branch information
1 parent
62da25d
commit 329cb47
Showing
30 changed files
with
862 additions
and
91 deletions.
There are no files selected for viewing
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# frozen_string_literal: true | ||
|
||
module Clock | ||
class FreeTrialSubscriptionsBillerJob < ApplicationJob | ||
queue_as 'clock' | ||
|
||
def perform | ||
Subscriptions::FreeTrialBillingService.call | ||
end | ||
end | ||
end |
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
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
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
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
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
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
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
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
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
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
Oops, something went wrong.