AddRefundNotificationNonprofitEmailJob
This commit is contained in:
parent
cc45ec820a
commit
78e803b1d6
5 changed files with 3 additions and 34 deletions
|
@ -3,6 +3,6 @@ class RefundNotificationJob < ApplicationJob
|
||||||
|
|
||||||
def perform(refund)
|
def perform(refund)
|
||||||
RefundNotificationJobDonorEmail.perform_later(refund)
|
RefundNotificationJobDonorEmail.perform_later(refund)
|
||||||
RefundNotificationJobNonprofitEmail.perform_later(refund)
|
RefundNotificationNonprofitEmailJob.perform_later(refund)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
class RefundNotificationNonprofitEmailJob < ApplicationJob
|
class RefundNotificationNonprofitEmailJob < ApplicationJob
|
||||||
queue_as :default
|
queue_as :default
|
||||||
|
|
||||||
def perform(*args)
|
def perform(refund)
|
||||||
# Do something later
|
NonprofitMailer.refund_notification(refund.id).deliver_now
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -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
|
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
|
# Send the refund receipts in a delayed job
|
||||||
RefundNotificationJob.perform_later Refund.find(refund_row['id'])
|
RefundNotificationJob.perform_later Refund.find(refund_row['id'])
|
||||||
Delayed::Job.enqueue JobTypes::NonprofitRefundNotificationJob.new(refund_row['id'])
|
|
||||||
{ 'payment' => payment_row, 'refund' => refund_row }
|
{ 'payment' => payment_row, 'refund' => refund_row }
|
||||||
end
|
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
|
|
||||||
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
|
|
|
@ -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
|
|
Loading…
Reference in a new issue