diff --git a/app/controllers/admin/stripe_accounts_controller.rb b/app/controllers/admin/stripe_accounts_controller.rb index 3f837e5931..98f3386472 100644 --- a/app/controllers/admin/stripe_accounts_controller.rb +++ b/app/controllers/admin/stripe_accounts_controller.rb @@ -47,9 +47,9 @@ module Admin event = Stripe::Event.construct_from(params) return render nothing: true, status: 400 unless event.type == "account.application.deauthorized" - destroyed = StripeAccount.where(stripe_user_id: event.stripe_account.id).destroy_all + destroyed = StripeAccount.where(stripe_user_id: event.account).destroy_all if destroyed.any? - render text: "Account #{event.stripe_account.id} deauthorized", status: 200 + render text: "Account #{event.account} deauthorized", status: 200 else render nothing: true, status: 400 end diff --git a/spec/controllers/admin/stripe_accounts_controller_spec.rb b/spec/controllers/admin/stripe_accounts_controller_spec.rb index d81ad363ff..87b33605fc 100644 --- a/spec/controllers/admin/stripe_accounts_controller_spec.rb +++ b/spec/controllers/admin/stripe_accounts_controller_spec.rb @@ -99,7 +99,7 @@ describe Admin::StripeAccountsController, type: :controller do "object" => "event", "data" => { "object" => { "id" => "ca_9B" } }, "type" => "account.application.deauthorized", - "stripe_account" => { "id" => "webhook_id" } + "account" => "webhook_id" } end @@ -112,7 +112,7 @@ describe Admin::StripeAccountsController, type: :controller do context "when the stripe_account id on the event does not match any known accounts" do before do - params["stripe_account"]["id"] = "webhook_id1" + params["account"] = "webhook_id1" end it "does nothing" do