From 76009c259fd34969a3e13a79ffc519778b6d6b9a Mon Sep 17 00:00:00 2001 From: Matt-Yorkley <9029026+Matt-Yorkley@users.noreply.github.com> Date: Thu, 18 Feb 2021 13:49:17 +0000 Subject: [PATCH] Ensure encodable object in StripeAccountsController Fixes: ``` Admin::StripeAccountsController#connect redirects to Stripe Authorization url constructed OAuth Failure/Error: url_params = { state: JWT.encode(payload, key, 'HS256'), scope: "read_write" } JSON::GeneratorError: only generation of JSON objects or arrays allowed # ./app/controllers/admin/stripe_accounts_controller.rb:8:in `connect' # ./spec/controllers/admin/stripe_accounts_controller_spec.rb:18:in `block (3 levels) in ' ``` --- app/controllers/admin/stripe_accounts_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/admin/stripe_accounts_controller.rb b/app/controllers/admin/stripe_accounts_controller.rb index c848714b80..91ae8a3403 100644 --- a/app/controllers/admin/stripe_accounts_controller.rb +++ b/app/controllers/admin/stripe_accounts_controller.rb @@ -3,7 +3,7 @@ require 'stripe/account_connector' module Admin class StripeAccountsController < Spree::Admin::BaseController def connect - payload = params.permit(:enterprise_id) + payload = params.permit(:enterprise_id).to_h key = Openfoodnetwork::Application.config.secret_token url_params = { state: JWT.encode(payload, key, 'HS256'), scope: "read_write" } redirect_to Stripe::OAuth.authorize_url(url_params)