Add FailedRecurringDonationPaymentJob
This commit is contained in:
parent
052474ac80
commit
fe7322c5da
7 changed files with 22 additions and 62 deletions
|
@ -0,0 +1,7 @@
|
|||
class FailedRecurringDonationPaymentDonorEmailJob < ApplicationJob
|
||||
queue_as :default
|
||||
|
||||
def perform(donation)
|
||||
DonationMailer.donor_failed_recurring_donation(donation.id).deliver_now
|
||||
end
|
||||
end
|
8
app/jobs/failed_recurring_donation_payment_job.rb
Normal file
8
app/jobs/failed_recurring_donation_payment_job.rb
Normal file
|
@ -0,0 +1,8 @@
|
|||
class FailedRecurringDonationPaymentJob < ApplicationJob
|
||||
queue_as :default
|
||||
|
||||
def perform
|
||||
FailedRecurringDonationPaymentDonorEmailJob.perform_later donation
|
||||
FailedRecurringDonationPaymentNonprofitEmailJob.perform_later donation
|
||||
end
|
||||
end
|
|
@ -0,0 +1,7 @@
|
|||
class FailedRecurringDonationPaymentNonprofitEmailJob < ApplicationJob
|
||||
queue_as :default
|
||||
|
||||
def perform(donation)
|
||||
DonationMailer.nonprofit_failed_recurring_donation(donation.id).deliver_now
|
||||
end
|
||||
end
|
|
@ -1,16 +0,0 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
# License: AGPL-3.0-or-later WITH Web-Template-Output-Additional-Permission-3.0-or-later
|
||||
module JobTypes
|
||||
class DonorFailedRecurringDonationJob < EmailJob
|
||||
attr_reader :donation_id
|
||||
|
||||
def initialize(donation_id)
|
||||
@donation_id = donation_id
|
||||
end
|
||||
|
||||
def perform
|
||||
DonationMailer.donor_failed_recurring_donation(@donation_id).deliver
|
||||
end
|
||||
end
|
||||
end
|
|
@ -1,16 +0,0 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
# License: AGPL-3.0-or-later WITH Web-Template-Output-Additional-Permission-3.0-or-later
|
||||
module JobTypes
|
||||
class NonprofitFailedRecurringDonationJob < EmailJob
|
||||
attr_reader :donation_id
|
||||
|
||||
def initialize(donation_id)
|
||||
@donation_id = donation_id
|
||||
end
|
||||
|
||||
def perform
|
||||
DonationMailer.nonprofit_failed_recurring_donation(@donation_id).deliver
|
||||
end
|
||||
end
|
||||
end
|
|
@ -1,15 +0,0 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
# License: AGPL-3.0-or-later WITH Web-Template-Output-Additional-Permission-3.0-or-later
|
||||
require 'rails_helper.rb'
|
||||
|
||||
describe JobTypes::DonorFailedRecurringDonationJob do
|
||||
describe '.perform' do
|
||||
it 'calls the correct active mailer' do
|
||||
expect(DonationMailer).to receive(:donor_failed_recurring_donation).with(1).and_wrap_original { |_m, *_args| mailer = double('object'); expect(mailer).to receive(:deliver).and_return(nil); mailer }
|
||||
|
||||
job = JobTypes::DonorFailedRecurringDonationJob.new(1)
|
||||
job.perform
|
||||
end
|
||||
end
|
||||
end
|
|
@ -1,15 +0,0 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
# License: AGPL-3.0-or-later WITH Web-Template-Output-Additional-Permission-3.0-or-later
|
||||
require 'rails_helper.rb'
|
||||
|
||||
describe JobTypes::NonprofitFailedRecurringDonationJob do
|
||||
describe '.perform' do
|
||||
it 'calls the correct active mailer' do
|
||||
expect(DonationMailer).to receive(:nonprofit_failed_recurring_donation).with(1).and_wrap_original { |_m, *_args| mailer = double('object'); expect(mailer).to receive(:deliver).and_return(nil); mailer }
|
||||
|
||||
job = JobTypes::NonprofitFailedRecurringDonationJob.new(1)
|
||||
job.perform
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Reference in a new issue