mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-24 20:36:49 +00:00
Update deauthorize webhook to latest version of API (again)
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user