Add CreateWeMoveExecuteForDonationsJob
This commit is contained in:
parent
34e67f5577
commit
5236eda39d
5 changed files with 22 additions and 18 deletions
7
app/jobs/we_move_execute_for_donations_job.rb
Normal file
7
app/jobs/we_move_execute_for_donations_job.rb
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
class WeMoveExecuteForDonationsJob < ApplicationJob
|
||||||
|
queue_as :default
|
||||||
|
|
||||||
|
def perform(donation)
|
||||||
|
QueueDonations.execute_for_donation(donation.id)
|
||||||
|
end
|
||||||
|
end
|
|
@ -44,7 +44,7 @@ module InsertDonation
|
||||||
update_donation_keys(result)
|
update_donation_keys(result)
|
||||||
result['activity'] = InsertActivities.for_one_time_donations([result['payment'].id])
|
result['activity'] = InsertActivities.for_one_time_donations([result['payment'].id])
|
||||||
PaymentNotificationJob.perform_later result['donation'], entities[:supporter_id].locale
|
PaymentNotificationJob.perform_later result['donation'], entities[:supporter_id].locale
|
||||||
QueueDonations.delay.execute_for_donation(result['donation'].id)
|
WeMoveExecuteForDonationsJob.perform_later(result['donation'])
|
||||||
result
|
result
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -85,7 +85,7 @@ module InsertDonation
|
||||||
]).returning('*')
|
]).returning('*')
|
||||||
).first
|
).first
|
||||||
result['activity'] = InsertActivities.for_offsite_donations([result['payment']['id']])
|
result['activity'] = InsertActivities.for_offsite_donations([result['payment']['id']])
|
||||||
QueueDonations.delay.execute_for_donation(result['donation'].id)
|
WeMoveExecuteForDonationsJob.perform_later(result['donation'])
|
||||||
{ status: 200, json: result }
|
{ status: 200, json: result }
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -107,7 +107,7 @@ module InsertDonation
|
||||||
|
|
||||||
DirectDebitCreateJob.perform_later(result['donation'].id, locale_for_supporter(result['donation'].supporter.id))
|
DirectDebitCreateJob.perform_later(result['donation'].id, locale_for_supporter(result['donation'].supporter.id))
|
||||||
|
|
||||||
QueueDonations.delay.execute_for_donation(result['donation'].id)
|
WeMoveExecuteForDonationsJob.perform_later(result['donation'])
|
||||||
# do this for making test consistent
|
# do this for making test consistent
|
||||||
result['activity'] = {}
|
result['activity'] = {}
|
||||||
result
|
result
|
||||||
|
|
|
@ -71,7 +71,7 @@ module InsertRecurringDonation
|
||||||
end
|
end
|
||||||
# Send receipts
|
# Send receipts
|
||||||
PaymentNotificationJob.perform_later result['donation'], entities[:supporter_id].locale
|
PaymentNotificationJob.perform_later result['donation'], entities[:supporter_id].locale
|
||||||
QueueDonations.delay.execute_for_donation(result['donation']['id'])
|
WeMoveExecuteForDonationsJob.perform_later(result['donation'])
|
||||||
result
|
result
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -96,7 +96,7 @@ module InsertRecurringDonation
|
||||||
|
|
||||||
DonorDirectDebitNotificationJob.perform_later(Donation.find(result['donation']['id']), locale_for_supporter(result['donation']['supporter_id']);
|
DonorDirectDebitNotificationJob.perform_later(Donation.find(result['donation']['id']), locale_for_supporter(result['donation']['supporter_id']);
|
||||||
|
|
||||||
QueueDonations.delay.execute_for_donation(result['donation']['id'])
|
WeMoveExecuteForDonationsJob.perform_later(result['donation'])
|
||||||
|
|
||||||
{ status: 200, json: result }
|
{ status: 200, json: result }
|
||||||
end
|
end
|
||||||
|
|
|
@ -168,8 +168,6 @@ describe QueryPayments do
|
||||||
@stripe_charge_id = a['id']
|
@stripe_charge_id = a['id']
|
||||||
a
|
a
|
||||||
}
|
}
|
||||||
|
|
||||||
allow(QueueDonations).to receive(:execute_for_donation)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
let(:charge_amount_small) { 200 }
|
let(:charge_amount_small) { 200 }
|
||||||
|
|
|
@ -327,13 +327,13 @@ RSpec.shared_context :shared_rd_donation_value_context do
|
||||||
|
|
||||||
def before_each_success(expect_charge = true)
|
def before_each_success(expect_charge = true)
|
||||||
expect(InsertDonation).to receive(:insert_donation).and_wrap_original do |m, *args|
|
expect(InsertDonation).to receive(:insert_donation).and_wrap_original do |m, *args|
|
||||||
|
expect {
|
||||||
expect {
|
expect {
|
||||||
result = m.call(*args)
|
result = m.call(*args)
|
||||||
}.to have_enqueued_job(PaymentNotificationJob).with(result, supporter.local)
|
}.to have_enqueued_job(PaymentNotificationJob).with(result, supporter.local)
|
||||||
|
}.to have_enqueued_job(WeMoveExecuteForDonationsJob)
|
||||||
@donation_id = result.id
|
@donation_id = result.id
|
||||||
|
|
||||||
expect(QueueDonations).to receive(:execute_for_donation).with(@donation_id)
|
|
||||||
|
|
||||||
result
|
result
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -370,14 +370,13 @@ RSpec.shared_context :shared_rd_donation_value_context do
|
||||||
end
|
end
|
||||||
|
|
||||||
def before_each_sepa_success
|
def before_each_sepa_success
|
||||||
|
expect {
|
||||||
expect(InsertDonation).to receive(:insert_donation).and_wrap_original do |m, *args|
|
expect(InsertDonation).to receive(:insert_donation).and_wrap_original do |m, *args|
|
||||||
expect {
|
expect {
|
||||||
result = m.call(*args)
|
result = m.call(*args)
|
||||||
}.to have_enqueued_job(DirectDebitCreateJob).with(result.id, supporter.local)
|
}.to have_enqueued_job(DirectDebitCreateJob).with(result.id, supporter.local)
|
||||||
|
}.to have_enqueued_job(WeMoveExecuteForDonationsJob)
|
||||||
|
|
||||||
@donation_id = result.id
|
@donation_id = result.id
|
||||||
expect(QueueDonations).to receive(:execute_for_donation).with(@donation_id)
|
|
||||||
result
|
result
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue