Class: Payflow::OverdueAccountsJob

Inherits:
ApplicationJob show all
Defined in:
app/jobs/payflow/overdue_accounts_job.rb

Instance Method Summary collapse

Instance Method Details

#performObject



7
8
9
10
11
12
13
14
# File 'app/jobs/payflow/overdue_accounts_job.rb', line 7

def perform
  Subscription.active.find_each do |subscription|
    latest_invoice = subscription.invoices.order(created_at: :desc).first
    next unless latest_invoice&.overdue?

    subscription.update!(status: :overdue)
  end
end