mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-24 20:36:49 +00:00
Adding billing tasks to whenever schedule
This commit is contained in:
@@ -25,13 +25,13 @@
|
||||
%fieldset.no-border-bottom
|
||||
%legend Update Invoices
|
||||
= f.check_box :auto_update_invoices
|
||||
= f.label :auto_update_invoices, "Auto-update invoices nightly at 2am"
|
||||
= f.label :auto_update_invoices, "Auto-update invoices nightly at 1:00am"
|
||||
|
||||
.six.columns.omega
|
||||
%fieldset.no-border-bottom
|
||||
%legend Finalise Invoices
|
||||
= f.check_box :auto_finalize_invoices
|
||||
= f.label :auto_finalize_invoices, "Auto-finalise invoices monthly on the 2nd"
|
||||
= f.label :auto_finalize_invoices, "Auto-finalise invoices monthly on the 2nd at 1:30am"
|
||||
|
||||
.row
|
||||
.twelve.columns.alpha.omega.form-buttons{"data-hook" => "buttons"}
|
||||
|
||||
@@ -18,3 +18,12 @@ end
|
||||
every 4.hours do
|
||||
rake 'db2fog:backup'
|
||||
end
|
||||
|
||||
every 1.day, at: '1:00am' do
|
||||
rake 'openfoodnetwork:billing:update_user_invoices'
|
||||
end
|
||||
|
||||
# On the 2nd of every month at 1:30am
|
||||
every '30 1 2 * *' do
|
||||
rake 'openfoodnetwork:billing:finalize_user_invoices'
|
||||
end
|
||||
|
||||
13
lib/tasks/billing.rake
Normal file
13
lib/tasks/billing.rake
Normal file
@@ -0,0 +1,13 @@
|
||||
namespace :openfoodnetwork do
|
||||
namespace :billing do
|
||||
desc 'Update enterprise user invoices'
|
||||
task update_user_invoices: :environment do
|
||||
Delayed::Job.enqueue(UpdateUserInvoices.new) if Spree::Config[:auto_update_invoices]
|
||||
end
|
||||
|
||||
desc 'Finalize enterprise user invoices'
|
||||
task finalize_user_invoices: :environment do
|
||||
Delayed::Job.enqueue(FinalizeUserInvoices.new) if Spree::Config[:auto_finalize_invoices]
|
||||
end
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user