Class: PagSeguro::PaymentStatus

Inherits:
Object
  • Object
show all
Defined in:
lib/pagseguro/payment_status.rb

Constant Summary collapse

STATUSES =
{
  "0" => :initiated,
  "1" => :waiting_payment,
  "2" => :in_analysis,
  "3" => :paid,
  "4" => :available,
  "5" => :in_dispute,
  "6" => :refunded,
  "7" => :cancelled,
  "8" => :chargeback_charged,
  "9" => :contested
}.freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(id) ⇒ PaymentStatus

Returns a new instance of PaymentStatus.



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

def initialize(id)
  @id = id
end

Instance Attribute Details

#idObject (readonly)

The payment status id.



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

def id
  @id
end

Instance Method Details

#statusObject

Return a readable status.



31
32
33
# File 'lib/pagseguro/payment_status.rb', line 31

def status
  STATUSES.fetch(id.to_s) { raise "PagSeguro::PaymentStatus#id isn't mapped" }
end