Sha256: a7cfdd383a1e06dbd67001d0601e2de0905a2769d6604ccc3b2b0ad3a6563edd

Contents?: true

Size: 809 Bytes

Versions: 3

Compression:

Stored size: 809 Bytes

Contents

module Akatus

  class PaymentType
    include Transferrable
    attr_accessor :type
  end

  class CreditCard < PaymentType
    transferrable_attrs :brand, :number, :security_code, :installments, :expiration

    attr_accessor :holder_name, :holder_cpf, :holder_phone

    def to_payload
      payload = super
      payload['cartao_de_credito']['portador'] = {
        :nome     => holder_name,
        :cpf      => holder_cpf,
        :telefone => holder_phone
      }
      payload['cartao_de_credito']
    end
  end

  class ElectronicFundsTransfer < PaymentType
    transferrable_attrs :brand
    def to_payload
      { :meio_de_pagamento => brand }
    end
  end

  class BoletoBancario < PaymentType
    attr_accessor :brand
    def to_payload
      { :meio_de_pagamento => 'boleto' }
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
akatus-1.0.2 lib/akatus/payment_types.rb
akatus-1.0.1 lib/akatus/payment_types.rb
akatus-1.0.0 lib/akatus/payment_types.rb