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



352
353
354
# File 'lib/docdata/order/response.rb', line 352

def data
  body[:list_payment_methods_response]
end

#error?Boolean

Returns:

  • (Boolean)


360
361
362
# File 'lib/docdata/order/response.rb', line 360

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

#errorsObject



364
365
366
# File 'lib/docdata/order/response.rb', line 364

def errors
  data[:list_payment_methods_errors]
end

#payment_methodsObject



368
369
370
371
372
373
374
# File 'lib/docdata/order/response.rb', line 368

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].map { |issuer| [issuer.attributes["id"], issuer.to_s] }.to_h if payment_method.key?(:issuers)
    method
  end
end

#success?Boolean

Returns:

  • (Boolean)


356
357
358
# File 'lib/docdata/order/response.rb', line 356

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