Update deauthorize webhook to latest version of API (again)

This commit is contained in:
Rob Harrington
2017-09-22 16:30:49 +10:00
parent 90007d7114
commit dd3d205536
2 changed files with 4 additions and 4 deletions

View File

@@ -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

View File

@@ -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