Class: InterApi::PaymentError

Inherits:
Object
  • Object
show all
Defined in:
lib/inter_api/payment_error.rb

Constant Summary collapse

STATUS_ERROR =
[400, 403, 404, 503]

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(json_response) ⇒ PaymentError

Returns a new instance of PaymentError.



5
6
7
# File 'lib/inter_api/payment_error.rb', line 5

def initialize json_response
  @json_response = json_response
end

Instance Attribute Details

#json_responseObject

Returns the value of attribute json_response.



4
5
6
# File 'lib/inter_api/payment_error.rb', line 4

def json_response
  @json_response
end

Instance Method Details

#internal_errorObject



9
10
11
12
# File 'lib/inter_api/payment_error.rb', line 9

def internal_error
  return nil unless json_response["violacoes"] || STATUS_ERROR.include?(json_response["status"])
  failed_message_error || rejected_message_error || "Pagamento recusado."
end