Class: DnaPaymentsPartnerReportingSettlementApIs::Status

Inherits:
Object
  • Object
show all
Defined in:
lib/dna_payments_partner_reporting_settlement_ap_is/models/status.rb

Overview

open: all operations allowed. suspended/pending-closure: merchant-initiated operations prohibited, settlements/disputes still allowed. closed: no activity allowed.

Constant Summary collapse

STATUS =
[
  # TODO: Write general description for OPEN
  OPEN = 'open'.freeze,

  # TODO: Write general description for SUSPENDED
  SUSPENDED = 'suspended'.freeze,

  # TODO: Write general description for PENDINGCLOSURE
  PENDINGCLOSURE = 'pending-closure'.freeze,

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

Class Method Summary collapse

Class Method Details

.from_value(value, default_value = OPEN) ⇒ Object



31
32
33
34
35
36
37
38
39
40
41
42
43
44
# File 'lib/dna_payments_partner_reporting_settlement_ap_is/models/status.rb', line 31

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

  str = value.to_s.strip

  case str.downcase
  when 'open' then OPEN
  when 'suspended' then SUSPENDED
  when 'pendingclosure' then PENDINGCLOSURE
  when 'closed' then CLOSED
  else
    default_value
  end
end

.validate(value) ⇒ Object



25
26
27
28
29
# File 'lib/dna_payments_partner_reporting_settlement_ap_is/models/status.rb', line 25

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

  STATUS.include?(value)
end