lib/active_merchant/billing/gateways/trexle.rb in activemerchant-1.85.0 vs lib/active_merchant/billing/gateways/trexle.rb in activemerchant-1.86.0

- old
+ new

@@ -152,25 +152,25 @@ result['X-Partner-Key'] = params[:partner_key] if params[:partner_key] result['X-Safe-Card'] = params[:safe_card] if params[:safe_card] result end - + def commit(method, action, params, options) url = "#{test? ? test_url : live_url}/#{action}" raw_response = ssl_request(method, url, post_data(params), headers(options)) parsed_response = parse(raw_response) - success_response(parsed_response) + success_response(parsed_response) rescue ResponseError => e error_response(parse(e.response.body)) rescue JSON::ParserError unparsable_response(raw_response) end - + def success_response(body) return invalid_response unless body['response'] - + response = body['response'] Response.new( true, response['status_message'], body, @@ -193,11 +193,11 @@ def unparsable_response(raw_response) message = 'Invalid JSON response received from Trexle. Please contact support@trexle.com if you continue to receive this message.' message += " (The raw response returned by the API was #{raw_response.inspect})" return Response.new(false, message) end - + def invalid_response message = 'Invalid response.' return Response.new(false, message) end @@ -205,10 +205,10 @@ response['token'] end def parse(body) return {} if body.blank? - JSON.parse(body) + JSON.parse(body) end def post_data(parameters = {}) parameters.to_json end