Class: Akatus::PaymentMethods

Inherits:
Object
  • Object
show all
Defined in:
lib/akatus/payment_methods.rb

Constant Summary collapse

ALL =
[
  MASTER   = :master,
  VISA     = :visa,
  AMEX     = :amex,
  ELO      = :elo,
  DINERS   = :diners,
  BOLETO   = :boleto,
  ITAU     = :itau,
  BB       = :bb,
  BRADESCO = :bradesco
].freeze

Class Method Summary collapse

Class Method Details

.availableObject



18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/akatus/payment_methods.rb', line 18

def self.available
  builder = Nokogiri::XML::Builder.new do |xml|
    xml.meios_de_pagamento {
      xml.correntista {
        xml.api_key Akatus.seller_api_key
        xml.email   Akatus.seller_email
      }
    }
  end
  request = HTTPI::Request.new(Akatus.akatus_api_uri + '/meios-de-pagamento.xml')
  request.body = builder.to_xml
  request.open_timeout = 10 # sec
  request.read_timeout = 30 # sec

  parsed_response = parse_response(HTTPI.post request)
  splited_payment_methods = split_by_kind(parsed_response)
end