Class: PagSeguro::PaymentMethod

Inherits:
Object
  • Object
show all
Defined in:
lib/pag_seguro/payment_method.rb

Constant Summary collapse

CREDIT_CARD =

Payment Method types

1
BANK_BILL =
2
ONLINE_DEBIT =
3
PAG_SEGURO_BALANCE =
4
OI_PAGGO =
5

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ PaymentMethod

Returns a new instance of PaymentMethod.



13
14
15
16
# File 'lib/pag_seguro/payment_method.rb', line 13

def initialize(options = {})
  @code = options[:code]
  @type = options[:type]
end

Instance Attribute Details

#codeObject

Returns the value of attribute code.



4
5
6
# File 'lib/pag_seguro/payment_method.rb', line 4

def code
  @code
end

#typeObject

Returns the value of attribute type.



4
5
6
# File 'lib/pag_seguro/payment_method.rb', line 4

def type
  @type
end

Instance Method Details

#bank_bill?Boolean

Returns:

  • (Boolean)


30
31
32
# File 'lib/pag_seguro/payment_method.rb', line 30

def bank_bill?
  BANK_BILL == type
end

#credit_card?Boolean

Returns:

  • (Boolean)


26
27
28
# File 'lib/pag_seguro/payment_method.rb', line 26

def credit_card?
  CREDIT_CARD == type
end

#nameObject



46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
# File 'lib/pag_seguro/payment_method.rb', line 46

def name
  case code
  when 101 then "Cartão de crédito Visa"
  when 102 then "Cartão de crédito MasterCard"
  when 103 then "Cartão de crédito American Express"
  when 104 then "Cartão de crédito Diners"
  when 105 then "Cartão de crédito Hipercard"
  when 106 then "Cartão de crédito Aura"
  when 107 then "Cartão de crédito Elo"
  when 108 then "Cartão de crédito PLENOCard"
  when 109 then "Cartão de crédito PersonalCard"
  when 201 then "Boleto Bradesco"
  when 202 then "Boleto Santander"
  when 301 then "Débito online Bradesco"
  when 302 then "Débito online Itaú"
  when 303 then "Débito online Unibanco"
  when 304 then "Débito online Banco do Brasil"
  when 305 then "Débito online Banco Real"
  when 306 then "Débito online Banrisul"
  when 307 then "Débito online HSBC"
  when 401 then "Saldo PagSeguro"
  when 501 then "Oi Paggo"
  else "Desconhecido"
  end
end

#oi_paggo?Boolean

Returns:

  • (Boolean)


42
43
44
# File 'lib/pag_seguro/payment_method.rb', line 42

def oi_paggo?
  OI_PAGGO == type
end

#online_debit?Boolean

Returns:

  • (Boolean)


34
35
36
# File 'lib/pag_seguro/payment_method.rb', line 34

def online_debit?
  ONLINE_DEBIT == type
end

#pag_seguro_balance?Boolean

Returns:

  • (Boolean)


38
39
40
# File 'lib/pag_seguro/payment_method.rb', line 38

def pag_seguro_balance?
  PAG_SEGURO_BALANCE == type
end