Class: PagSeguro::PaymentMethod

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

Constant Summary collapse

TYPES =
{
  "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.



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

def code
  @code
end

#type_idObject

The payment method type.



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

def type_id
  @type_id
end

Instance Method Details

#descriptionObject

Return the payment method’s description.



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

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

#typeObject

Return the type in a readable manner.



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

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