Class: PagSeguro::PaymentMethod
- Inherits:
-
Object
- Object
- PagSeguro::PaymentMethod
- 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
-
#code ⇒ Object
Returns the value of attribute code.
-
#type ⇒ Object
Returns the value of attribute type.
Instance Method Summary collapse
- #bank_bill? ⇒ Boolean
- #credit_card? ⇒ Boolean
-
#initialize(options = {}) ⇒ PaymentMethod
constructor
A new instance of PaymentMethod.
- #name ⇒ Object
- #oi_paggo? ⇒ Boolean
- #online_debit? ⇒ Boolean
- #pag_seguro_balance? ⇒ Boolean
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( = {}) @code = [:code] @type = [:type] end |
Instance Attribute Details
#code ⇒ Object
Returns the value of attribute code.
4 5 6 |
# File 'lib/pag_seguro/payment_method.rb', line 4 def code @code end |
#type ⇒ Object
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
30 31 32 |
# File 'lib/pag_seguro/payment_method.rb', line 30 def bank_bill? BANK_BILL == type end |
#credit_card? ⇒ Boolean
26 27 28 |
# File 'lib/pag_seguro/payment_method.rb', line 26 def credit_card? CREDIT_CARD == type end |
#name ⇒ Object
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
42 43 44 |
# File 'lib/pag_seguro/payment_method.rb', line 42 def oi_paggo? OI_PAGGO == type end |
#online_debit? ⇒ Boolean
34 35 36 |
# File 'lib/pag_seguro/payment_method.rb', line 34 def online_debit? ONLINE_DEBIT == type end |
#pag_seguro_balance? ⇒ Boolean
38 39 40 |
# File 'lib/pag_seguro/payment_method.rb', line 38 def pag_seguro_balance? PAG_SEGURO_BALANCE == type end |