Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions app/controllers/fees_controller.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
require 'jwt'

class FeesController < ApplicationController

rescue_from ActionController::ParameterMissing, with: :missing_params
Comment thread
davezuckerman marked this conversation as resolved.
Outdated

# This will be needed for transaction_complete since Paypal will hit that
protect_from_forgery with: :null_session

Expand Down Expand Up @@ -75,6 +78,10 @@ def transaction_complete

private

def missing_params(_error)
redirect_to 'https://lib.berkeley.edu/find/borrow-renew?section=pay-fees', allow_other_host: true
Comment thread
davezuckerman marked this conversation as resolved.
Outdated
end

def authorize!
return if Rails.env.development?

Expand Down
4 changes: 2 additions & 2 deletions spec/request/fees_request_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ def base_url_for(user_id = nil)
allow(Rails.application.config).to receive(:alma_api_key).and_return(alma_api_key)
end

it 'shows a Bad Request error if request has no jwt' do
it 'redirects to the fallback URL if there is no jwt' do
get fees_path
expect(response).to have_http_status(:bad_request)
expect(response).to redirect_to('https://lib.berkeley.edu/find/borrow-renew?section=pay-fees')
end

it 'redirects to error page if request has a non-existant alma id' do
Expand Down
Loading