diff --git a/app/jobs/refund_notification_job.rb b/app/jobs/refund_notification_job.rb index ec024089..401aba71 100644 --- a/app/jobs/refund_notification_job.rb +++ b/app/jobs/refund_notification_job.rb @@ -3,6 +3,6 @@ class RefundNotificationJob < ApplicationJob def perform(refund) RefundNotificationJobDonorEmail.perform_later(refund) - RefundNotificationJobNonprofitEmail.perform_later(refund) + RefundNotificationNonprofitEmailJob.perform_later(refund) end end diff --git a/app/jobs/refund_notification_nonprofit_email_job.rb b/app/jobs/refund_notification_nonprofit_email_job.rb index 67efbeb0..26c970a6 100644 --- a/app/jobs/refund_notification_nonprofit_email_job.rb +++ b/app/jobs/refund_notification_nonprofit_email_job.rb @@ -1,7 +1,7 @@ class RefundNotificationNonprofitEmailJob < ApplicationJob queue_as :default - def perform(*args) - # Do something later + def perform(refund) + NonprofitMailer.refund_notification(refund.id).deliver_now end end diff --git a/lib/insert/insert_refunds.rb b/lib/insert/insert_refunds.rb index 2e4ddc44..46fcd035 100644 --- a/lib/insert/insert_refunds.rb +++ b/lib/insert/insert_refunds.rb @@ -67,7 +67,6 @@ module InsertRefunds Qx.update(:payments).set("refund_total=refund_total + #{h['amount'].to_i}").ts.where(id: original_payment['id']).execute # Send the refund receipts in a delayed job RefundNotificationJob.perform_later Refund.find(refund_row['id']) - Delayed::Job.enqueue JobTypes::NonprofitRefundNotificationJob.new(refund_row['id']) { 'payment' => payment_row, 'refund' => refund_row } end end diff --git a/lib/job_types/nonprofit_refund_notification_job.rb b/lib/job_types/nonprofit_refund_notification_job.rb deleted file mode 100644 index ea08ae3a..00000000 --- a/lib/job_types/nonprofit_refund_notification_job.rb +++ /dev/null @@ -1,15 +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 NonprofitRefundNotificationJob < EmailJob - attr_reader :refund_id - def initialize(refund_id) - @refund_id = refund_id - end - - def perform - NonprofitMailer.refund_notification(@refund_id).deliver - end - end -end diff --git a/spec/lib/job_types/nonprofit_refund_notification_job_spec.rb b/spec/lib/job_types/nonprofit_refund_notification_job_spec.rb deleted file mode 100644 index d90e5b67..00000000 --- a/spec/lib/job_types/nonprofit_refund_notification_job_spec.rb +++ /dev/null @@ -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::NonprofitRefundNotificationJob do - describe '.perform' do - it 'calls the correct active mailer' do - expect(NonprofitMailer).to receive(:refund_notification).with(1).and_wrap_original { |_m, *_args| mailer = double('object'); expect(mailer).to receive(:deliver).and_return(nil); mailer } - - job = JobTypes::NonprofitRefundNotificationJob.new(1) - job.perform - end - end -end