Class: TqlOtrFactoringDataExchange::InvoiceStatusResponse
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- TqlOtrFactoringDataExchange::InvoiceStatusResponse
- Defined in:
- lib/tql_otr_factoring_data_exchange/models/invoice_status_response.rb
Overview
Current processing state of an invoice, including any outstanding exceptions that require resolution.
Instance Attribute Summary collapse
-
#completed_at ⇒ DateTime
UTC timestamp when processing completed (null if still in progress).
-
#currency ⇒ String
[ISO 4217](www.iso.org/iso-4217-currency-codes.html) currency code.
-
#documents ⇒ Array[DocumentType]
Documents uploaded and linked to this invoice.
-
#exceptions ⇒ Array[InvoiceException]
Outstanding exceptions that need resolution.
-
#invoice_number ⇒ String
The factoring company’s invoice number.
-
#load_number ⇒ String
The TQL load number this invoice was submitted against.
-
#received_at ⇒ DateTime
UTC timestamp when the invoice was received.
-
#status ⇒ InvoiceStatus
Processing and payment status of an invoice.
-
#total_charge_amount ⇒ Float
Sum of all charge amounts on the invoice.
Class Method Summary collapse
-
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
-
.names ⇒ Object
A mapping from model property names to API property names.
-
.nullables ⇒ Object
An array for nullable fields.
-
.optionals ⇒ Object
An array for optional fields.
Instance Method Summary collapse
-
#initialize(load_number: SKIP, invoice_number: SKIP, status: SKIP, received_at: SKIP, completed_at: SKIP, total_charge_amount: SKIP, currency: SKIP, documents: SKIP, exceptions: SKIP, additional_properties: nil) ⇒ InvoiceStatusResponse
constructor
A new instance of InvoiceStatusResponse.
-
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
- #to_custom_completed_at ⇒ Object
- #to_custom_received_at ⇒ Object
-
#to_s ⇒ Object
Provides a human-readable string representation of the object.
Methods inherited from BaseModel
#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json
Constructor Details
#initialize(load_number: SKIP, invoice_number: SKIP, status: SKIP, received_at: SKIP, completed_at: SKIP, total_charge_amount: SKIP, currency: SKIP, documents: SKIP, exceptions: SKIP, additional_properties: nil) ⇒ InvoiceStatusResponse
Returns a new instance of InvoiceStatusResponse.
92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 |
# File 'lib/tql_otr_factoring_data_exchange/models/invoice_status_response.rb', line 92 def initialize(load_number: SKIP, invoice_number: SKIP, status: SKIP, received_at: SKIP, completed_at: SKIP, total_charge_amount: SKIP, currency: SKIP, documents: SKIP, exceptions: SKIP, additional_properties: nil) # Add additional model properties to the instance additional_properties = {} if additional_properties.nil? @load_number = load_number unless load_number == SKIP @invoice_number = invoice_number unless invoice_number == SKIP @status = status unless status == SKIP @received_at = received_at unless received_at == SKIP @completed_at = completed_at unless completed_at == SKIP @total_charge_amount = total_charge_amount unless total_charge_amount == SKIP @currency = currency unless currency == SKIP @documents = documents unless documents == SKIP @exceptions = exceptions unless exceptions == SKIP @additional_properties = additional_properties end |
Instance Attribute Details
#completed_at ⇒ DateTime
UTC timestamp when processing completed (null if still in progress).
35 36 37 |
# File 'lib/tql_otr_factoring_data_exchange/models/invoice_status_response.rb', line 35 def completed_at @completed_at end |
#currency ⇒ String
[ISO 4217](www.iso.org/iso-4217-currency-codes.html) currency code.
44 45 46 |
# File 'lib/tql_otr_factoring_data_exchange/models/invoice_status_response.rb', line 44 def currency @currency end |
#documents ⇒ Array[DocumentType]
Documents uploaded and linked to this invoice. Each entry indicates the document type. Empty array means no documents have been received yet.
49 50 51 |
# File 'lib/tql_otr_factoring_data_exchange/models/invoice_status_response.rb', line 49 def documents @documents end |
#exceptions ⇒ Array[InvoiceException]
Outstanding exceptions that need resolution. Empty array means no issues.
53 54 55 |
# File 'lib/tql_otr_factoring_data_exchange/models/invoice_status_response.rb', line 53 def exceptions @exceptions end |
#invoice_number ⇒ String
The factoring company’s invoice number.
20 21 22 |
# File 'lib/tql_otr_factoring_data_exchange/models/invoice_status_response.rb', line 20 def invoice_number @invoice_number end |
#load_number ⇒ String
The TQL load number this invoice was submitted against.
16 17 18 |
# File 'lib/tql_otr_factoring_data_exchange/models/invoice_status_response.rb', line 16 def load_number @load_number end |
#received_at ⇒ DateTime
UTC timestamp when the invoice was received.
31 32 33 |
# File 'lib/tql_otr_factoring_data_exchange/models/invoice_status_response.rb', line 31 def received_at @received_at end |
#status ⇒ InvoiceStatus
Processing and payment status of an invoice. The lifecycle typically flows: ‘Received` → `Validating` → `Processing` → `Approved` → `NotPaid` →`Paid`. Branches include `AwaitingDocuments`, `PendingExceptions`, and `Rejected`.
27 28 29 |
# File 'lib/tql_otr_factoring_data_exchange/models/invoice_status_response.rb', line 27 def status @status end |
#total_charge_amount ⇒ Float
Sum of all charge amounts on the invoice.
39 40 41 |
# File 'lib/tql_otr_factoring_data_exchange/models/invoice_status_response.rb', line 39 def total_charge_amount @total_charge_amount end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 |
# File 'lib/tql_otr_factoring_data_exchange/models/invoice_status_response.rb', line 112 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. load_number = hash.key?('loadNumber') ? hash['loadNumber'] : SKIP invoice_number = hash.key?('invoiceNumber') ? hash['invoiceNumber'] : SKIP status = hash.key?('status') ? hash['status'] : SKIP received_at = if hash.key?('receivedAt') (DateTimeHelper.from_rfc3339(hash['receivedAt']) if hash['receivedAt']) else SKIP end completed_at = if hash.key?('completedAt') (DateTimeHelper.from_rfc3339(hash['completedAt']) if hash['completedAt']) else SKIP end total_charge_amount = hash.key?('totalChargeAmount') ? hash['totalChargeAmount'] : SKIP currency = hash.key?('currency') ? hash['currency'] : SKIP documents = hash.key?('documents') ? hash['documents'] : SKIP # Parameter is an array, so we need to iterate through it exceptions = nil unless hash['exceptions'].nil? exceptions = [] hash['exceptions'].each do |structure| exceptions << (InvoiceException.from_hash(structure) if structure) end end exceptions = SKIP unless hash.key?('exceptions') # Create a new hash for additional properties, removing known properties. new_hash = hash.reject { |k, _| names.value?(k) } additional_properties = APIHelper.get_additional_properties( new_hash, proc { |value| value } ) # Create object from extracted values. InvoiceStatusResponse.new(load_number: load_number, invoice_number: invoice_number, status: status, received_at: received_at, completed_at: completed_at, total_charge_amount: total_charge_amount, currency: currency, documents: documents, exceptions: exceptions, additional_properties: additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
56 57 58 59 60 61 62 63 64 65 66 67 68 |
# File 'lib/tql_otr_factoring_data_exchange/models/invoice_status_response.rb', line 56 def self.names @_hash = {} if @_hash.nil? @_hash['load_number'] = 'loadNumber' @_hash['invoice_number'] = 'invoiceNumber' @_hash['status'] = 'status' @_hash['received_at'] = 'receivedAt' @_hash['completed_at'] = 'completedAt' @_hash['total_charge_amount'] = 'totalChargeAmount' @_hash['currency'] = 'currency' @_hash['documents'] = 'documents' @_hash['exceptions'] = 'exceptions' @_hash end |
.nullables ⇒ Object
An array for nullable fields
86 87 88 89 90 |
# File 'lib/tql_otr_factoring_data_exchange/models/invoice_status_response.rb', line 86 def self.nullables %w[ completed_at ] end |
.optionals ⇒ Object
An array for optional fields
71 72 73 74 75 76 77 78 79 80 81 82 83 |
# File 'lib/tql_otr_factoring_data_exchange/models/invoice_status_response.rb', line 71 def self.optionals %w[ load_number invoice_number status received_at completed_at total_charge_amount currency documents exceptions ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
183 184 185 186 187 188 189 190 191 |
# File 'lib/tql_otr_factoring_data_exchange/models/invoice_status_response.rb', line 183 def inspect class_name = self.class.name.split('::').last "<#{class_name} load_number: #{@load_number.inspect}, invoice_number:"\ " #{@invoice_number.inspect}, status: #{@status.inspect}, received_at:"\ " #{@received_at.inspect}, completed_at: #{@completed_at.inspect}, total_charge_amount:"\ " #{@total_charge_amount.inspect}, currency: #{@currency.inspect}, documents:"\ " #{@documents.inspect}, exceptions: #{@exceptions.inspect}, additional_properties:"\ " #{@additional_properties}>" end |
#to_custom_completed_at ⇒ Object
168 169 170 |
# File 'lib/tql_otr_factoring_data_exchange/models/invoice_status_response.rb', line 168 def to_custom_completed_at DateTimeHelper.to_rfc3339(completed_at) end |
#to_custom_received_at ⇒ Object
164 165 166 |
# File 'lib/tql_otr_factoring_data_exchange/models/invoice_status_response.rb', line 164 def to_custom_received_at DateTimeHelper.to_rfc3339(received_at) end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
173 174 175 176 177 178 179 180 |
# File 'lib/tql_otr_factoring_data_exchange/models/invoice_status_response.rb', line 173 def to_s class_name = self.class.name.split('::').last "<#{class_name} load_number: #{@load_number}, invoice_number: #{@invoice_number}, status:"\ " #{@status}, received_at: #{@received_at}, completed_at: #{@completed_at},"\ " total_charge_amount: #{@total_charge_amount}, currency: #{@currency}, documents:"\ " #{@documents}, exceptions: #{@exceptions}, additional_properties:"\ " #{@additional_properties}>" end |