Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
2 changes: 1 addition & 1 deletion lib/adyen/client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ def call_adyen_api(service, action, request_data, headers, version, with_applica
when 401
raise Adyen::AuthenticationError.new("Invalid API authentication; https://docs.adyen.com/user-management/how-to-get-the-api-key", request_data)
when 403
raise Adyen::PermissionError.new("Missing user permissions; https://docs.adyen.com/user-management/user-roles", request_data)
raise Adyen::PermissionError.new("Missing user permissions; https://docs.adyen.com/user-management/user-roles", request_data, response.response_body)
end

formatted_response = AdyenResult.new(response.body, response.headers, response.status)
Expand Down
4 changes: 2 additions & 2 deletions lib/adyen/errors.rb
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,8 @@ def initialize(msg, request)
end

class PermissionError < AdyenError
def initialize(msg, request)
super(request, nil, msg, 403)
def initialize(msg, request, response)
super(request, response, msg, 403)
end
end

Expand Down
2 changes: 1 addition & 1 deletion spec/errors_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
expect(Adyen::AdyenError.new(@shared_values[:request], nil, nil, 'code').to_s).to eq("Adyen::AdyenError code:code, request:#{@shared_values[:request]}")
end
it 'uses the proper error class name' do
expect(Adyen::PermissionError.new('message', @shared_values[:request]).to_s).to eq("Adyen::PermissionError code:403, msg:message, request:#{@shared_values[:request]}")
expect(Adyen::PermissionError.new('message', @shared_values[:request], 'response').to_s).to eq("Adyen::PermissionError code:403, msg:message, request:#{@shared_values[:request]}, response:response")
end
end
describe '#masking' do
Expand Down