Class: Docdata::Order::ListPaymentMethodsResponse

Inherits:
Response
  • Object
show all
Defined in:
lib/docdata/order/response.rb

Overview

Response to a list payment methods operation.

Instance Attribute Summary

Attributes inherited from Response

#options, #response

Instance Method Summary collapse

Methods inherited from Response

#body, #error_code, #error_message, #initialize

Constructor Details

This class inherits a constructor from Docdata::Order::Response

Instance Method Details

#dataObject



368
369
370
# File 'lib/docdata/order/response.rb', line 368

def data
  body[:list_payment_methods_response]
end

#error?Boolean

Returns:

  • (Boolean)


376
377
378
# File 'lib/docdata/order/response.rb', line 376

def error?
  data.key?(:list_payment_methods_errors)
end

#errorsObject



380
381
382
# File 'lib/docdata/order/response.rb', line 380

def errors
  data[:list_payment_methods_errors]
end

#payment_methodsObject



384
385
386
387
388
389
390
# File 'lib/docdata/order/response.rb', line 384

def payment_methods
  data[:list_payment_methods_success][:payment_method].map do |payment_method|
    method = PaymentMethod.new(payment_method[:name])
    method.issuers = payment_method[:issuers][:issuer].to_h { |issuer| [issuer.attributes['id'], issuer.to_s] } if payment_method.key?(:issuers)
    method
  end
end

#success?Boolean

Returns:

  • (Boolean)


372
373
374
# File 'lib/docdata/order/response.rb', line 372

def success?
  data.key?(:list_payment_methods_success)
end