Class: PagSeguro::PaymentMethod

Inherits:
Object
  • Object
show all
Includes:
Extensions::MassAssignment
Defined in:
lib/pagseguro/payment_method.rb

Constant Summary collapse

TYPES =
{
  ""  => :not_set,
  "1" => :credit_card,
  "2" => :boleto,
  "3" => :online_transfer,
  "4" => :balance,
  "5" => :oi_paggo,
  "7" => :direct_deposit
}.freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Extensions::MassAssignment

#initialize

Instance Attribute Details

#codeObject

The payment method code.



17
18
19
# File 'lib/pagseguro/payment_method.rb', line 17

def code
  @code
end

#type_idObject

The payment method type.



20
21
22
# File 'lib/pagseguro/payment_method.rb', line 20

def type_id
  @type_id
end

Instance Method Details

#descriptionObject

Return the payment method’s description.



35
36
37
# File 'lib/pagseguro/payment_method.rb', line 35

def description
  I18n.t(code, scope: "pagseguro.payment_methods")
end

#typeObject

Return the type in a readable manner.



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

def type
  TYPES.fetch(type_id.to_s) { raise "PagSeguro::PaymentMethod#type_id isn't mapped" }
end