-
Notifications
You must be signed in to change notification settings - Fork 99
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(dunning): Add dunning campaign to customer, database changes
## Roadmap Task 👉 https://getlago.canny.io/feature-requests/p/set-up-payment-retry-logic 👉 https://getlago.canny.io/feature-requests/p/send-reminders-for-overdue-invoices ## Context We want to automate dunning process so that our users don't have to look at each customer to maximize their chances of being paid retrying payments of overdue balances and sending email reminders. We're first automating the overdue balance payment request, before looking at individual invoices. ## Description The goal of this change is to create set the relationship between customers and dunning campaigns. A customer could have one dunning campaign applied, or, inherit its organization default campaign (none applied) or, be excluded from dunning at all (with a boolean flag). Also, when deleting a dunning campaign, all customers with the campaign assigned must be reset.
- Loading branch information
Showing
7 changed files
with
85 additions
and
52 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
14 changes: 14 additions & 0 deletions
14
db/migrate/20241016104211_add_dunning_campaign_to_customers.rb
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,14 @@ | ||
# frozen_string_literal: true | ||
|
||
class AddDunningCampaignToCustomers < ActiveRecord::Migration[7.1] | ||
def change | ||
safety_assured do | ||
change_table :customers, bulk: true do |t| | ||
t.references :applied_dunning_campaign, type: :uuid, null: true, foreign_key: {to_table: :dunning_campaigns}, index: true | ||
t.boolean :exclude_from_dunning_campaign, default: false, null: false | ||
t.integer :last_dunning_campaign_attempt, default: 0, null: false | ||
t.timestamp :last_dunning_campaign_attempt_at | ||
end | ||
end | ||
end | ||
end |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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