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 <top (required)>'
```
This commit is contained in:
Matt-Yorkley
2021-02-18 13:49:17 +00:00
parent 3976f8ef89
commit 76009c259f

View File

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