Class: TqlOtrFactoringDataExchange::InvoiceType

Inherits:
Object
  • Object
show all
Defined in:
lib/tql_otr_factoring_data_exchange/models/invoice_type.rb

Overview

Indicates the purpose of the invoice being submitted. - Invoice — A standard carrier invoice for freight services rendered on a load. This is the initial, primary billing submitted by the factoring company on behalf of the carrier. - BalanceDue — A follow-up invoice for the remaining balance after a partial payment or short-pay on a previously submitted invoice. Use this type when the original invoice was paid at less than the full amount and the carrier is billing for the difference. - Supplemental — An additional invoice for charges that were not included on the original invoice. Common examples include detention charges, lumper fees, or other accessorials discovered or finalized after the initial invoice was submitted.

Constant Summary collapse

INVOICE_TYPE =
[
  # TODO: Write general description for INVOICE
  INVOICE = 'Invoice'.freeze,

  # TODO: Write general description for BALANCEDUE
  BALANCEDUE = 'BalanceDue'.freeze,

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

Class Method Summary collapse

Class Method Details

.from_value(value, default_value = INVOICE) ⇒ Object



36
37
38
39
40
41
42
43
44
45
46
47
48
# File 'lib/tql_otr_factoring_data_exchange/models/invoice_type.rb', line 36

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

  str = value.to_s.strip

  case str.downcase
  when 'invoice' then INVOICE
  when 'balancedue' then BALANCEDUE
  when 'supplemental' then SUPPLEMENTAL
  else
    default_value
  end
end

.validate(value) ⇒ Object



30
31
32
33
34
# File 'lib/tql_otr_factoring_data_exchange/models/invoice_type.rb', line 30

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

  INVOICE_TYPE.include?(value)
end