Class: NewStoreApi::TransactionSignatureStrategyEnum

Inherits:
Object
  • Object
show all
Defined in:
lib/new_store_api/models/transaction_signature_strategy_enum.rb

Overview

Offline transaction signature strategy that will be used while processing offline transactions. * standard-signing * Offline orders will be fiscally signed according to regulations. * Can be used in cases if the receipt would be emailed once the offline order is processed. * late-signing * Offline orders will be signed with late signing flag. * Can be used in cases if the receipt would be emailed once the offline order is processed. * manual-receipts * Offline orders will be signed with manual flag. * A receipt for the offline orders and do not need to be emailed later. * Can be used in cases if the a manual receipt was issued by the store, and an electronic receipt should not be sent. * no-signing

  • Offline orders will not be signed and should be considered completed without any signature needed. * Can be used in cases if the fiscal signature was issued outside of the NewStore platform.

Constant Summary collapse

TRANSACTION_SIGNATURE_STRATEGY_ENUM =
[
  # TODO: Write general description for STANDARDSIGNING
  STANDARDSIGNING = 'standard-signing'.freeze,

  # TODO: Write general description for LATESIGNING
  LATESIGNING = 'late-signing'.freeze,

  # TODO: Write general description for MANUALRECEIPTS
  MANUALRECEIPTS = 'manual-receipts'.freeze,

  # TODO: Write general description for NOSIGNING
  NOSIGNING = 'no-signing'.freeze
].freeze

Class Method Summary collapse

Class Method Details

.from_value(value, default_value = STANDARDSIGNING) ⇒ Object



41
42
43
44
45
46
47
48
49
50
51
52
53
54
# File 'lib/new_store_api/models/transaction_signature_strategy_enum.rb', line 41

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

  str = value.to_s.strip

  case str.downcase
  when 'standardsigning' then STANDARDSIGNING
  when 'latesigning' then LATESIGNING
  when 'manualreceipts' then MANUALRECEIPTS
  when 'nosigning' then NOSIGNING
  else
    default_value
  end
end

.validate(value) ⇒ Object



35
36
37
38
39
# File 'lib/new_store_api/models/transaction_signature_strategy_enum.rb', line 35

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

  TRANSACTION_SIGNATURE_STRATEGY_ENUM.include?(value)
end