diff --git a/app/jobs/stripe_account_create_job.rb b/app/jobs/stripe_account_create_job.rb new file mode 100644 index 00000000..97ead65e --- /dev/null +++ b/app/jobs/stripe_account_create_job.rb @@ -0,0 +1,7 @@ +class StripeAccountCreateJob < ApplicationJob + queue_as :default + + def perform(nonprofit) + NonprofitMailer.setup_verification(nonprofit.id).deliver_now + end +end diff --git a/lib/stripe_account.rb b/lib/stripe_account.rb index a4c111dd..3883000b 100644 --- a/lib/stripe_account.rb +++ b/lib/stripe_account.rb @@ -46,7 +46,7 @@ module StripeAccount acct = Stripe::Account.create(params) Qx.update(:nonprofits).set(stripe_account_id: acct.id).where(id: np['id']).execute - NonprofitMailer.delay.setup_verification(np['id']) + StripeAccountCreateJob.perform_later(Nonprofit.find(np['id'])) acct.id end end