Class: Batches::StatusBatchesTransactionsStatus

Inherits:
Object
  • Object
show all
Defined in:
lib/batches/models/status_batches_transactions_status.rb

Overview

Indicates where a transaction is in its lifecycle. * BATCHED - A Transaction has been successfully Batched * CAPTURED - A Transaction has been successfully authorized and captured. The funding process will commence once the transaction remains in this status.

Constant Summary collapse

STATUS_BATCHES_TRANSACTIONS_STATUS =
[
  # TODO: Write general description for BATCHED
  BATCHED = 'BATCHED'.freeze,

  # TODO: Write general description for CAPTURED
  CAPTURED = 'CAPTURED'.freeze
].freeze

Class Method Summary collapse

Class Method Details

.from_value(value, default_value = BATCHED) ⇒ Object



26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/batches/models/status_batches_transactions_status.rb', line 26

def self.from_value(value, default_value = BATCHED)
  return default_value if value.nil?

  str = value.to_s.strip

  case str.downcase
  when 'batched' then BATCHED
  when 'captured' then CAPTURED
  else
    default_value
  end
end

.validate(value) ⇒ Object



20
21
22
23
24
# File 'lib/batches/models/status_batches_transactions_status.rb', line 20

def self.validate(value)
  return false if value.nil?

  STATUS_BATCHES_TRANSACTIONS_STATUS.include?(value)
end