From 9c9e6bd86141ba1063c48ac4c27cac0a840e0e76 Mon Sep 17 00:00:00 2001 From: Eric Schultz Date: Thu, 7 Nov 2019 16:56:15 -0600 Subject: [PATCH] Add StripeAccountCreateJob --- app/jobs/stripe_account_create_job.rb | 7 +++++++ lib/stripe_account.rb | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) create mode 100644 app/jobs/stripe_account_create_job.rb 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