Class: MpApi::PaymentError

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(json_response:) ⇒ PaymentError

Returns a new instance of PaymentError.



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

def initialize(json_response:)
  @json_response = json_response
end

Instance Attribute Details

#json_responseObject (readonly)

Returns the value of attribute json_response.



3
4
5
# File 'lib/mp_api/payment_error.rb', line 3

def json_response
  @json_response
end

Instance Method Details

#errorObject



8
9
10
# File 'lib/mp_api/payment_error.rb', line 8

def error
  rejected_payment_error || failed_payment_error || "Pagamento recusado."
end

#internal_errorObject



12
13
14
# File 'lib/mp_api/payment_error.rb', line 12

def internal_error
  json_response["cause"].first["description"]
end