File tree Expand file tree Collapse file tree 2 files changed +9
-4
lines changed
Expand file tree Collapse file tree 2 files changed +9
-4
lines changed Original file line number Diff line number Diff line change 11require 'jwt'
22
33class FeesController < ApplicationController
4+
5+ rescue_from ActionController ::ParameterMissing , with : :missing_params
6+
47 # This will be needed for transaction_complete since Paypal will hit that
58 protect_from_forgery with : :null_session
69
@@ -13,6 +16,10 @@ def index
1316 redirect_to ( action : :transaction_error )
1417 end
1518
19+ def missing_params ( _error )
20+ redirect_to 'https://lib.berkeley.edu/find/borrow-renew?section=pay-fees' , allow_other_host : true
21+ end
22+
1623 def efee
1724 @jwt = params . require ( :jwt )
1825 secret = EfeesInvoice . secret
@@ -73,8 +80,6 @@ def transaction_complete
7380 render json : { status : 'silent post received' }
7481 end
7582
76- private
77-
7883 def authorize!
7984 return if Rails . env . development?
8085
Original file line number Diff line number Diff line change @@ -12,9 +12,9 @@ def base_url_for(user_id = nil)
1212 allow ( Rails . application . config ) . to receive ( :alma_api_key ) . and_return ( alma_api_key )
1313 end
1414
15- it 'shows a Bad Request error if request has no jwt' do
15+ it 'redirects to the fallback URL if there is no jwt' do
1616 get fees_path
17- expect ( response ) . to have_http_status ( :bad_request )
17+ expect ( response ) . to redirect_to ( 'https://lib.berkeley.edu/find/borrow-renew?section=pay-fees' )
1818 end
1919
2020 it 'redirects to error page if request has a non-existant alma id' do
You can’t perform that action at this time.
0 commit comments