Class: ModernTreasury::InvoiceUpdateRequest
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- ModernTreasury::InvoiceUpdateRequest
- Defined in:
- lib/modern_treasury/models/invoice_update_request.rb
Overview
InvoiceUpdateRequest Model.
Instance Attribute Summary collapse
-
#contact_details ⇒ Array[ContactDetail]
The invoicer’s contact details displayed at the top of the invoice.
-
#counterparty_billing_address ⇒ CounterpartyBillingAddress
The counterparty’s billing address.
-
#counterparty_id ⇒ String
The ID of the counterparty receiving the invoice.
-
#counterparty_shipping_address ⇒ CounterpartyShippingAddress
The counterparty’s shipping address where physical goods should be delivered.
-
#currency ⇒ Currency
Three-letter ISO currency code.
-
#description ⇒ String
A free-form description of the invoice.
-
#due_date ⇒ DateTime
A future date by when the invoice needs to be paid.
-
#invoicer_address ⇒ InvoicerAddress
The invoice issuer’s business address.
-
#originating_account_id ⇒ String
The ID of the internal account the invoice should be paid to.
-
#payment_effective_date ⇒ Date
Date transactions are to be posted to the participants’ account.
-
#payment_method ⇒ PaymentMethod1
The method by which the invoice can be paid.
-
#payment_type ⇒ PaymentType6
One of ‘ach`, `eft`, `wire`, `check`, `sen`, `book`, `rtp`, `sepa`, `bacs`, `au_becs`, `interac`, `signet`, `provexchange`.
-
#receiving_account_id ⇒ UUID | String
The receiving account ID.
-
#status ⇒ String
Invoice status must be updated in a ‘PATCH` request that does not modify any other invoice attributes.
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(contact_details: SKIP, counterparty_id: SKIP, counterparty_billing_address: SKIP, counterparty_shipping_address: SKIP, currency: SKIP, description: SKIP, due_date: SKIP, invoicer_address: SKIP, originating_account_id: SKIP, receiving_account_id: SKIP, payment_effective_date: SKIP, payment_type: SKIP, payment_method: SKIP, status: SKIP, additional_properties: nil) ⇒ InvoiceUpdateRequest
constructor
A new instance of InvoiceUpdateRequest.
-
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
- #to_custom_due_date ⇒ 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(contact_details: SKIP, counterparty_id: SKIP, counterparty_billing_address: SKIP, counterparty_shipping_address: SKIP, currency: SKIP, description: SKIP, due_date: SKIP, invoicer_address: SKIP, originating_account_id: SKIP, receiving_account_id: SKIP, payment_effective_date: SKIP, payment_type: SKIP, payment_method: SKIP, status: SKIP, additional_properties: nil) ⇒ InvoiceUpdateRequest
Returns a new instance of InvoiceUpdateRequest.
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 163 |
# File 'lib/modern_treasury/models/invoice_update_request.rb', line 131 def initialize(contact_details: SKIP, counterparty_id: SKIP, counterparty_billing_address: SKIP, counterparty_shipping_address: SKIP, currency: SKIP, description: SKIP, due_date: SKIP, invoicer_address: SKIP, originating_account_id: SKIP, receiving_account_id: SKIP, payment_effective_date: SKIP, payment_type: SKIP, payment_method: SKIP, status: SKIP, additional_properties: nil) # Add additional model properties to the instance additional_properties = {} if additional_properties.nil? @contact_details = contact_details unless contact_details == SKIP @counterparty_id = counterparty_id unless counterparty_id == SKIP unless counterparty_billing_address == SKIP @counterparty_billing_address = counterparty_billing_address end unless counterparty_shipping_address == SKIP @counterparty_shipping_address = counterparty_shipping_address end @currency = currency unless currency == SKIP @description = description unless description == SKIP @due_date = due_date unless due_date == SKIP @invoicer_address = invoicer_address unless invoicer_address == SKIP @originating_account_id = originating_account_id unless originating_account_id == SKIP @receiving_account_id = receiving_account_id unless receiving_account_id == SKIP @payment_effective_date = payment_effective_date unless payment_effective_date == SKIP @payment_type = payment_type unless payment_type == SKIP @payment_method = payment_method unless payment_method == SKIP @status = status unless status == SKIP @additional_properties = additional_properties end |
Instance Attribute Details
#contact_details ⇒ Array[ContactDetail]
The invoicer’s contact details displayed at the top of the invoice.
15 16 17 |
# File 'lib/modern_treasury/models/invoice_update_request.rb', line 15 def contact_details @contact_details end |
#counterparty_billing_address ⇒ CounterpartyBillingAddress
The counterparty’s billing address.
23 24 25 |
# File 'lib/modern_treasury/models/invoice_update_request.rb', line 23 def counterparty_billing_address @counterparty_billing_address end |
#counterparty_id ⇒ String
The ID of the counterparty receiving the invoice.
19 20 21 |
# File 'lib/modern_treasury/models/invoice_update_request.rb', line 19 def counterparty_id @counterparty_id end |
#counterparty_shipping_address ⇒ CounterpartyShippingAddress
The counterparty’s shipping address where physical goods should be delivered.
28 29 30 |
# File 'lib/modern_treasury/models/invoice_update_request.rb', line 28 def counterparty_shipping_address @counterparty_shipping_address end |
#currency ⇒ Currency
Three-letter ISO currency code.
32 33 34 |
# File 'lib/modern_treasury/models/invoice_update_request.rb', line 32 def currency @currency end |
#description ⇒ String
A free-form description of the invoice.
36 37 38 |
# File 'lib/modern_treasury/models/invoice_update_request.rb', line 36 def description @description end |
#due_date ⇒ DateTime
A future date by when the invoice needs to be paid.
40 41 42 |
# File 'lib/modern_treasury/models/invoice_update_request.rb', line 40 def due_date @due_date end |
#invoicer_address ⇒ InvoicerAddress
The invoice issuer’s business address.
44 45 46 |
# File 'lib/modern_treasury/models/invoice_update_request.rb', line 44 def invoicer_address @invoicer_address end |
#originating_account_id ⇒ String
The ID of the internal account the invoice should be paid to.
48 49 50 |
# File 'lib/modern_treasury/models/invoice_update_request.rb', line 48 def originating_account_id @originating_account_id end |
#payment_effective_date ⇒ Date
Date transactions are to be posted to the participants’ account. Defaults to the current business day or the next business day if the current day is a bank holiday or weekend. Format: yyyy-mm-dd.
58 59 60 |
# File 'lib/modern_treasury/models/invoice_update_request.rb', line 58 def payment_effective_date @payment_effective_date end |
#payment_method ⇒ PaymentMethod1
The method by which the invoice can be paid. ‘ui` will show the embedded payment collection flow. `automatic` will automatically initiate payment based upon the account details of the receiving_account id.nIf the invoice amount is positive, the automatically initiated payment order’s direction will be debit. If the invoice amount is negative, the automatically initiated payment order’s direction will be credit. One of ‘manual`, `ui`, or `automatic`.
73 74 75 |
# File 'lib/modern_treasury/models/invoice_update_request.rb', line 73 def payment_method @payment_method end |
#payment_type ⇒ PaymentType6
One of ‘ach`, `eft`, `wire`, `check`, `sen`, `book`, `rtp`, `sepa`, `bacs`, `au_becs`, `interac`, `signet`, `provexchange`.
63 64 65 |
# File 'lib/modern_treasury/models/invoice_update_request.rb', line 63 def payment_type @payment_type end |
#receiving_account_id ⇒ UUID | String
The receiving account ID. Can be an ‘external_account`.
52 53 54 |
# File 'lib/modern_treasury/models/invoice_update_request.rb', line 52 def receiving_account_id @receiving_account_id end |
#status ⇒ String
Invoice status must be updated in a ‘PATCH` request that does not modify any other invoice attributes. Valid state transitions are `draft` to `unpaid` and `draft` or `unpaid` to `voided`.
79 80 81 |
# File 'lib/modern_treasury/models/invoice_update_request.rb', line 79 def status @status end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 |
# File 'lib/modern_treasury/models/invoice_update_request.rb', line 166 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. # Parameter is an array, so we need to iterate through it contact_details = nil unless hash['contact_details'].nil? contact_details = [] hash['contact_details'].each do |structure| contact_details << (ContactDetail.from_hash(structure) if structure) end end contact_details = SKIP unless hash.key?('contact_details') counterparty_id = hash.key?('counterparty_id') ? hash['counterparty_id'] : SKIP if hash['counterparty_billing_address'] counterparty_billing_address = CounterpartyBillingAddress.from_hash(hash['counterparty_billing_address']) end if hash['counterparty_shipping_address'] counterparty_shipping_address = CounterpartyShippingAddress.from_hash(hash['counterparty_shipping_address']) end currency = hash.key?('currency') ? hash['currency'] : SKIP description = hash.key?('description') ? hash['description'] : SKIP due_date = if hash.key?('due_date') (DateTimeHelper.from_rfc3339(hash['due_date']) if hash['due_date']) else SKIP end invoicer_address = InvoicerAddress.from_hash(hash['invoicer_address']) if hash['invoicer_address'] originating_account_id = hash.key?('originating_account_id') ? hash['originating_account_id'] : SKIP receiving_account_id = hash.key?('receiving_account_id') ? hash['receiving_account_id'] : SKIP payment_effective_date = hash.key?('payment_effective_date') ? hash['payment_effective_date'] : SKIP payment_type = hash.key?('payment_type') ? hash['payment_type'] : SKIP payment_method = hash.key?('payment_method') ? hash['payment_method'] : SKIP status = hash.key?('status') ? hash['status'] : SKIP # 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. InvoiceUpdateRequest.new(contact_details: contact_details, counterparty_id: counterparty_id, counterparty_billing_address: counterparty_billing_address, counterparty_shipping_address: counterparty_shipping_address, currency: currency, description: description, due_date: due_date, invoicer_address: invoicer_address, originating_account_id: originating_account_id, receiving_account_id: receiving_account_id, payment_effective_date: payment_effective_date, payment_type: payment_type, payment_method: payment_method, status: status, additional_properties: additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 |
# File 'lib/modern_treasury/models/invoice_update_request.rb', line 82 def self.names @_hash = {} if @_hash.nil? @_hash['contact_details'] = 'contact_details' @_hash['counterparty_id'] = 'counterparty_id' @_hash['counterparty_billing_address'] = 'counterparty_billing_address' @_hash['counterparty_shipping_address'] = 'counterparty_shipping_address' @_hash['currency'] = 'currency' @_hash['description'] = 'description' @_hash['due_date'] = 'due_date' @_hash['invoicer_address'] = 'invoicer_address' @_hash['originating_account_id'] = 'originating_account_id' @_hash['receiving_account_id'] = 'receiving_account_id' @_hash['payment_effective_date'] = 'payment_effective_date' @_hash['payment_type'] = 'payment_type' @_hash['payment_method'] = 'payment_method' @_hash['status'] = 'status' @_hash end |
.nullables ⇒ Object
An array for nullable fields
123 124 125 126 127 128 129 |
# File 'lib/modern_treasury/models/invoice_update_request.rb', line 123 def self.nullables %w[ counterparty_billing_address counterparty_shipping_address invoicer_address ] end |
.optionals ⇒ Object
An array for optional fields
103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 |
# File 'lib/modern_treasury/models/invoice_update_request.rb', line 103 def self.optionals %w[ contact_details counterparty_id counterparty_billing_address counterparty_shipping_address currency description due_date invoicer_address originating_account_id receiving_account_id payment_effective_date payment_type payment_method status ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
251 252 253 254 255 256 257 258 259 260 261 262 263 |
# File 'lib/modern_treasury/models/invoice_update_request.rb', line 251 def inspect class_name = self.class.name.split('::').last "<#{class_name} contact_details: #{@contact_details.inspect}, counterparty_id:"\ " #{@counterparty_id.inspect}, counterparty_billing_address:"\ " #{@counterparty_billing_address.inspect}, counterparty_shipping_address:"\ " #{@counterparty_shipping_address.inspect}, currency: #{@currency.inspect}, description:"\ " #{@description.inspect}, due_date: #{@due_date.inspect}, invoicer_address:"\ " #{@invoicer_address.inspect}, originating_account_id: #{@originating_account_id.inspect},"\ " receiving_account_id: #{@receiving_account_id.inspect}, payment_effective_date:"\ " #{@payment_effective_date.inspect}, payment_type: #{@payment_type.inspect},"\ " payment_method: #{@payment_method.inspect}, status: #{@status.inspect},"\ " additional_properties: #{@additional_properties}>" end |
#to_custom_due_date ⇒ Object
233 234 235 |
# File 'lib/modern_treasury/models/invoice_update_request.rb', line 233 def to_custom_due_date DateTimeHelper.to_rfc3339(due_date) end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
238 239 240 241 242 243 244 245 246 247 248 |
# File 'lib/modern_treasury/models/invoice_update_request.rb', line 238 def to_s class_name = self.class.name.split('::').last "<#{class_name} contact_details: #{@contact_details}, counterparty_id: #{@counterparty_id},"\ " counterparty_billing_address: #{@counterparty_billing_address},"\ " counterparty_shipping_address: #{@counterparty_shipping_address}, currency: #{@currency},"\ " description: #{@description}, due_date: #{@due_date}, invoicer_address:"\ " #{@invoicer_address}, originating_account_id: #{@originating_account_id},"\ " receiving_account_id: #{@receiving_account_id}, payment_effective_date:"\ " #{@payment_effective_date}, payment_type: #{@payment_type}, payment_method:"\ " #{@payment_method}, status: #{@status}, additional_properties: #{@additional_properties}>" end |