Class: ModernTreasury::PaymentOrder

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/modern_treasury/models/payment_order.rb

Overview

PaymentOrder Model.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json

Constructor Details

#initialize(id:, object:, live_mode:, created_at:, updated_at:, type:, subtype:, amount:, direction:, priority:, originating_account_id:, receiving_account_id:, accounting:, accounting_category_id:, accounting_ledger_class_id:, currency:, effective_date:, description:, statement_descriptor:, remittance_information:, purpose:, metadata:, charge_bearer:, foreign_exchange_indicator:, foreign_exchange_contract:, nsf_protected:, originating_party_name:, ultimate_originating_party_name:, ultimate_originating_party_identifier:, ultimate_receiving_party_name:, ultimate_receiving_party_identifier:, send_remittance_advice:, expires_at:, status:, receiving_account:, receiving_account_type:, counterparty_id:, transaction_ids:, ledger_transaction_id:, current_return:, transaction_monitoring_enabled:, compliance_rule_metadata:, reference_numbers:, vendor_failure_reason:, decision_id:) ⇒ PaymentOrder

Returns a new instance of PaymentOrder.



335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
# File 'lib/modern_treasury/models/payment_order.rb', line 335

def initialize(id:, object:, live_mode:, created_at:, updated_at:, type:,
               subtype:, amount:, direction:, priority:,
               originating_account_id:, receiving_account_id:, accounting:,
               accounting_category_id:, accounting_ledger_class_id:,
               currency:, effective_date:, description:,
               statement_descriptor:, remittance_information:, purpose:,
               metadata:, charge_bearer:, foreign_exchange_indicator:,
               foreign_exchange_contract:, nsf_protected:,
               originating_party_name:, ultimate_originating_party_name:,
               ultimate_originating_party_identifier:,
               ultimate_receiving_party_name:,
               ultimate_receiving_party_identifier:,
               send_remittance_advice:, expires_at:, status:,
               receiving_account:, receiving_account_type:,
               counterparty_id:, transaction_ids:, ledger_transaction_id:,
               current_return:, transaction_monitoring_enabled:,
               compliance_rule_metadata:, reference_numbers:,
               vendor_failure_reason:, decision_id:)
  @id = id
  @object = object
  @live_mode = live_mode
  @created_at = created_at
  @updated_at = updated_at
  @type = type
  @subtype = subtype
  @amount = amount
  @direction = direction
  @priority = priority
  @originating_account_id = 
  @receiving_account_id = 
  @accounting = accounting
  @accounting_category_id = accounting_category_id
  @accounting_ledger_class_id = accounting_ledger_class_id
  @currency = currency
  @effective_date = effective_date
  @description = description
  @statement_descriptor = statement_descriptor
  @remittance_information = remittance_information
  @purpose = purpose
  @metadata = 
  @charge_bearer = charge_bearer
  @foreign_exchange_indicator = foreign_exchange_indicator
  @foreign_exchange_contract = foreign_exchange_contract
  @nsf_protected = nsf_protected
  @originating_party_name = originating_party_name
  @ultimate_originating_party_name = ultimate_originating_party_name
  @ultimate_originating_party_identifier = ultimate_originating_party_identifier
  @ultimate_receiving_party_name = ultimate_receiving_party_name
  @ultimate_receiving_party_identifier = ultimate_receiving_party_identifier
  @send_remittance_advice = send_remittance_advice
  @expires_at = expires_at
  @status = status
  @receiving_account = 
  @receiving_account_type = 
  @counterparty_id = counterparty_id
  @transaction_ids = transaction_ids
  @ledger_transaction_id = ledger_transaction_id
  @current_return = current_return
  @transaction_monitoring_enabled = transaction_monitoring_enabled
  @compliance_rule_metadata = 
  @reference_numbers = reference_numbers
  @vendor_failure_reason = vendor_failure_reason
  @decision_id = decision_id
end

Instance Attribute Details

#accountingAccounting

The receiving account ID. Can be an ‘external_account` or `internal_account`.

Returns:



79
80
81
# File 'lib/modern_treasury/models/payment_order.rb', line 79

def accounting
  @accounting
end

#accounting_category_idUUID | String

The ID of one of your accounting categories. Note that these will only be accessible if your accounting system has been connected.

Returns:

  • (UUID | String)


84
85
86
# File 'lib/modern_treasury/models/payment_order.rb', line 84

def accounting_category_id
  @accounting_category_id
end

#accounting_ledger_class_idUUID | String

The ID of one of your accounting ledger classes. Note that these will only be accessible if your accounting system has been connected.

Returns:

  • (UUID | String)


89
90
91
# File 'lib/modern_treasury/models/payment_order.rb', line 89

def accounting_ledger_class_id
  @accounting_ledger_class_id
end

#amountInteger

Value in specified currency’s smallest unit. e.g. $10 would be represented as 1000 (cents). For RTP, the maximum amount allowed by the network is $100,000.

Returns:

  • (Integer)


52
53
54
# File 'lib/modern_treasury/models/payment_order.rb', line 52

def amount
  @amount
end

#charge_bearerChargeBearer

The party that will pay the fees for the payment order. Only applies to wire payment orders. Can be one of shared, sender, or receiver, which correspond respectively with the SWIFT 71A values ‘SHA`, `OUR`, `BEN`.

Returns:



136
137
138
# File 'lib/modern_treasury/models/payment_order.rb', line 136

def charge_bearer
  @charge_bearer
end

#compliance_rule_metadataObject

Custom key-value pair for usage in compliance rules. Please contact support before making changes to this field.

Returns:

  • (Object)


228
229
230
# File 'lib/modern_treasury/models/payment_order.rb', line 228

def 
  @compliance_rule_metadata
end

#counterparty_idUUID | String

If the payment order is tied to a specific Counterparty, their id will appear, otherwise ‘null`.

Returns:

  • (UUID | String)


203
204
205
# File 'lib/modern_treasury/models/payment_order.rb', line 203

def counterparty_id
  @counterparty_id
end

#created_atDateTime

This field will be true if this object exists in the live environment or false if it exists in the test environment.

Returns:

  • (DateTime)


29
30
31
# File 'lib/modern_treasury/models/payment_order.rb', line 29

def created_at
  @created_at
end

#currencyCurrency

Three-letter ISO currency code.

Returns:



93
94
95
# File 'lib/modern_treasury/models/payment_order.rb', line 93

def currency
  @currency
end

#current_returnReturn

The ID of the ledger transaction linked to the payment order.

Returns:



218
219
220
# File 'lib/modern_treasury/models/payment_order.rb', line 218

def current_return
  @current_return
end

#decision_idUUID | String

The ID of the compliance decision for the payment order, if transaction monitoring is enabled.

Returns:

  • (UUID | String)


243
244
245
# File 'lib/modern_treasury/models/payment_order.rb', line 243

def decision_id
  @decision_id
end

#descriptionString

An optional description for internal use.

Returns:

  • (String)


103
104
105
# File 'lib/modern_treasury/models/payment_order.rb', line 103

def description
  @description
end

#directionDirection5

One of ‘credit`, `debit`. Describes the direction money is flowing in the transaction. A `credit` moves money from your account to someone else’s. A ‘debit` pulls money from someone else’s account to your own. Note that wire, rtp, and check payments will always be ‘credit`.

Returns:



59
60
61
# File 'lib/modern_treasury/models/payment_order.rb', line 59

def direction
  @direction
end

#effective_dateDate

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.

Returns:

  • (Date)


99
100
101
# File 'lib/modern_treasury/models/payment_order.rb', line 99

def effective_date
  @effective_date
end

#expires_atDateTime

RFP payments require an expires_at. This value must be past the effective_date.

Returns:

  • (DateTime)


186
187
188
# File 'lib/modern_treasury/models/payment_order.rb', line 186

def expires_at
  @expires_at
end

#foreign_exchange_contractString

If present, indicates a specific foreign exchange contract number that has been generated by your financial institution.

Returns:

  • (String)


147
148
149
# File 'lib/modern_treasury/models/payment_order.rb', line 147

def foreign_exchange_contract
  @foreign_exchange_contract
end

#foreign_exchange_indicatorForeignExchangeIndicator

Indicates the type of FX transfer to initiate, can be either ‘variable_to_fixed`, `fixed_to_variable`, or `null` if the payment order currency matches the originating account currency.



142
143
144
# File 'lib/modern_treasury/models/payment_order.rb', line 142

def foreign_exchange_indicator
  @foreign_exchange_indicator
end

#idUUID | String

TODO: Write general description for this method

Returns:

  • (UUID | String)


15
16
17
# File 'lib/modern_treasury/models/payment_order.rb', line 15

def id
  @id
end

#ledger_transaction_idUUID | String

The ID of the ledger transaction linked to the payment order.

Returns:

  • (UUID | String)


214
215
216
# File 'lib/modern_treasury/models/payment_order.rb', line 214

def ledger_transaction_id
  @ledger_transaction_id
end

#live_modeTrueClass | FalseClass

This field will be true if this object exists in the live environment or false if it exists in the test environment.

Returns:

  • (TrueClass | FalseClass)


24
25
26
# File 'lib/modern_treasury/models/payment_order.rb', line 24

def live_mode
  @live_mode
end

#metadataHash[String, String]

Additional data represented as key-value pairs. Both the key and value must be strings.

Returns:

  • (Hash[String, String])


130
131
132
# File 'lib/modern_treasury/models/payment_order.rb', line 130

def 
  @metadata
end

#nsf_protectedTrueClass | FalseClass

A boolean to determine if NSF Protection is enabled for this payment order. Note that this setting must also be turned on in your organization settings page.

Returns:

  • (TrueClass | FalseClass)


153
154
155
# File 'lib/modern_treasury/models/payment_order.rb', line 153

def nsf_protected
  @nsf_protected
end

#objectString

TODO: Write general description for this method

Returns:

  • (String)


19
20
21
# File 'lib/modern_treasury/models/payment_order.rb', line 19

def object
  @object
end

#originating_account_idUUID | String

The ID of one of your organization’s internal accounts.

Returns:

  • (UUID | String)


69
70
71
# File 'lib/modern_treasury/models/payment_order.rb', line 69

def 
  @originating_account_id
end

#originating_party_nameString

If present, this will replace your default company name on receiver’s bank statement. This field can only be used for ACH payments currently. For ACH, only the first 16 characters of this string will be used. Any additional characters will be truncated.

Returns:

  • (String)


160
161
162
# File 'lib/modern_treasury/models/payment_order.rb', line 160

def originating_party_name
  @originating_party_name
end

#priorityPriority

Either ‘normal` or `high`. For ACH and EFT payments, `high` represents a same-day ACH or EFT transfer, respectively. For check payments, `high` can mean an overnight check rather than standard mail.

Returns:



65
66
67
# File 'lib/modern_treasury/models/payment_order.rb', line 65

def priority
  @priority
end

#purposeString

For ‘wire`, this is usually the purpose which is transmitted via the “InstrForDbtrAgt” field in the ISO20022 file. If you are using Currencycloud, this is the `payment.purpose_code` field. For `eft`, this field is the 3 digit CPA Code that will be attached to the payment.

Returns:

  • (String)


125
126
127
# File 'lib/modern_treasury/models/payment_order.rb', line 125

def purpose
  @purpose
end

#receiving_accountObject

The receiving account. Can be an ‘external_account` or `internal_account`.

Returns:

  • (Object)


194
195
196
# File 'lib/modern_treasury/models/payment_order.rb', line 194

def 
  @receiving_account
end

#receiving_account_idUUID | String

The receiving account ID. Can be an ‘external_account` or `internal_account`.

Returns:

  • (UUID | String)


74
75
76
# File 'lib/modern_treasury/models/payment_order.rb', line 74

def 
  @receiving_account_id
end

#receiving_account_typeReceivingAccountType

The receiving account. Can be an ‘external_account` or `internal_account`.



198
199
200
# File 'lib/modern_treasury/models/payment_order.rb', line 198

def 
  @receiving_account_type
end

#reference_numbersArray[PaymentReference]

Custom key-value pair for usage in compliance rules. Please contact support before making changes to this field.

Returns:



233
234
235
# File 'lib/modern_treasury/models/payment_order.rb', line 233

def reference_numbers
  @reference_numbers
end

#remittance_informationString

For ‘ach`, this field will be passed through on an addenda record. For `wire` payments the field will be passed through as the “Originator to Beneficiary Information”, also known as OBI or Fedwire tag 6000.

Returns:

  • (String)


118
119
120
# File 'lib/modern_treasury/models/payment_order.rb', line 118

def remittance_information
  @remittance_information
end

#send_remittance_adviceTrueClass | FalseClass

Send an email to the counterparty when the payment order is sent to the bank. If ‘null`, `send_remittance_advice` on the Counterparty is used.

Returns:

  • (TrueClass | FalseClass)


181
182
183
# File 'lib/modern_treasury/models/payment_order.rb', line 181

def send_remittance_advice
  @send_remittance_advice
end

#statement_descriptorString

An optional descriptor which will appear in the receiver’s statement. For ‘check` payments this field will be used as the memo line. For `ach` the maximum length is 10 characters. Note that for ACH payments, the name on your bank account will be included automatically by the bank, so you can use the characters for other useful information. For `eft` the maximum length is 15 characters.

Returns:

  • (String)


112
113
114
# File 'lib/modern_treasury/models/payment_order.rb', line 112

def statement_descriptor
  @statement_descriptor
end

#statusStatus3

The current status of the payment order.

Returns:



190
191
192
# File 'lib/modern_treasury/models/payment_order.rb', line 190

def status
  @status
end

#subtypeSubtype

An additional layer of classification for the type of payment order you are doing. This field is only used for ‘ach` payment orders currently. For `ach` payment orders, the `subtype` represents the SEC code. We currently support `CCD`, `PPD`, `IAT`, `CTX`, `WEB`, `CIE`, and `TEL`.

Returns:



46
47
48
# File 'lib/modern_treasury/models/payment_order.rb', line 46

def subtype
  @subtype
end

#transaction_idsArray[UUID | String]

The IDs of all the transactions associated to this payment order. Usually, you will only have a single transaction ID. However, if a payment order initially results in a Return, but gets redrafted and is later successfully completed, it can have many transactions.

Returns:

  • (Array[UUID | String])


210
211
212
# File 'lib/modern_treasury/models/payment_order.rb', line 210

def transaction_ids
  @transaction_ids
end

#transaction_monitoring_enabledTrueClass | FalseClass

A flag that determines whether a payment order should go through transaction monitoring.

Returns:

  • (TrueClass | FalseClass)


223
224
225
# File 'lib/modern_treasury/models/payment_order.rb', line 223

def transaction_monitoring_enabled
  @transaction_monitoring_enabled
end

#typeType5

One of ‘ach`, `eft`, `wire`, `check`, `sen`, `book`, `rtp`, `sepa`, `bacs`, `au_becs`, `interac`, `signet`, `provexchange`.

Returns:



39
40
41
# File 'lib/modern_treasury/models/payment_order.rb', line 39

def type
  @type
end

#ultimate_originating_party_identifierString

Identifier of the ultimate originator of the payment order.

Returns:

  • (String)


168
169
170
# File 'lib/modern_treasury/models/payment_order.rb', line 168

def ultimate_originating_party_identifier
  @ultimate_originating_party_identifier
end

#ultimate_originating_party_nameString

Name of the ultimate originator of the payment order.

Returns:

  • (String)


164
165
166
# File 'lib/modern_treasury/models/payment_order.rb', line 164

def ultimate_originating_party_name
  @ultimate_originating_party_name
end

#ultimate_receiving_party_identifierString

Identifier of the ultimate originator of the payment order.

Returns:

  • (String)


176
177
178
# File 'lib/modern_treasury/models/payment_order.rb', line 176

def ultimate_receiving_party_identifier
  @ultimate_receiving_party_identifier
end

#ultimate_receiving_party_nameString

Identifier of the ultimate originator of the payment order.

Returns:

  • (String)


172
173
174
# File 'lib/modern_treasury/models/payment_order.rb', line 172

def ultimate_receiving_party_name
  @ultimate_receiving_party_name
end

#updated_atDateTime

This field will be true if this object exists in the live environment or false if it exists in the test environment.

Returns:

  • (DateTime)


34
35
36
# File 'lib/modern_treasury/models/payment_order.rb', line 34

def updated_at
  @updated_at
end

#vendor_failure_reasonString

This field will be populated if a vendor (e.g. Currencycloud) failure occurs. Logic shouldn’t be built on its value as it is free-form.

Returns:

  • (String)


238
239
240
# File 'lib/modern_treasury/models/payment_order.rb', line 238

def vendor_failure_reason
  @vendor_failure_reason
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
# File 'lib/modern_treasury/models/payment_order.rb', line 401

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  id = hash.key?('id') ? hash['id'] : nil
  object = hash.key?('object') ? hash['object'] : nil
  live_mode = hash.key?('live_mode') ? hash['live_mode'] : nil
  created_at = if hash.key?('created_at')
                 (DateTimeHelper.from_rfc3339(hash['created_at']) if hash['created_at'])
               end
  updated_at = if hash.key?('updated_at')
                 (DateTimeHelper.from_rfc3339(hash['updated_at']) if hash['updated_at'])
               end
  type = hash.key?('type') ? hash['type'] : nil
  subtype = hash.key?('subtype') ? hash['subtype'] : nil
  amount = hash.key?('amount') ? hash['amount'] : nil
  direction = hash.key?('direction') ? hash['direction'] : nil
  priority = hash.key?('priority') ? hash['priority'] : nil
   =
    hash.key?('originating_account_id') ? hash['originating_account_id'] : nil
   =
    hash.key?('receiving_account_id') ? hash['receiving_account_id'] : nil
  accounting = Accounting.from_hash(hash['accounting']) if hash['accounting']
  accounting_category_id =
    hash.key?('accounting_category_id') ? hash['accounting_category_id'] : nil
  accounting_ledger_class_id =
    hash.key?('accounting_ledger_class_id') ? hash['accounting_ledger_class_id'] : nil
  currency = hash.key?('currency') ? hash['currency'] : nil
  effective_date =
    hash.key?('effective_date') ? hash['effective_date'] : nil
  description = hash.key?('description') ? hash['description'] : nil
  statement_descriptor =
    hash.key?('statement_descriptor') ? hash['statement_descriptor'] : nil
  remittance_information =
    hash.key?('remittance_information') ? hash['remittance_information'] : nil
  purpose = hash.key?('purpose') ? hash['purpose'] : nil
   = hash.key?('metadata') ? hash['metadata'] : nil
  charge_bearer = hash.key?('charge_bearer') ? hash['charge_bearer'] : nil
  foreign_exchange_indicator =
    hash.key?('foreign_exchange_indicator') ? hash['foreign_exchange_indicator'] : nil
  foreign_exchange_contract =
    hash.key?('foreign_exchange_contract') ? hash['foreign_exchange_contract'] : nil
  nsf_protected = hash.key?('nsf_protected') ? hash['nsf_protected'] : nil
  originating_party_name =
    hash.key?('originating_party_name') ? hash['originating_party_name'] : nil
  ultimate_originating_party_name =
    hash.key?('ultimate_originating_party_name') ? hash['ultimate_originating_party_name'] : nil
  ultimate_originating_party_identifier =
    hash.key?('ultimate_originating_party_identifier') ? hash['ultimate_originating_party_identifier'] : nil
  ultimate_receiving_party_name =
    hash.key?('ultimate_receiving_party_name') ? hash['ultimate_receiving_party_name'] : nil
  ultimate_receiving_party_identifier =
    hash.key?('ultimate_receiving_party_identifier') ? hash['ultimate_receiving_party_identifier'] : nil
  send_remittance_advice =
    hash.key?('send_remittance_advice') ? hash['send_remittance_advice'] : nil
  expires_at = if hash.key?('expires_at')
                 (DateTimeHelper.from_rfc3339(hash['expires_at']) if hash['expires_at'])
               end
  status = hash.key?('status') ? hash['status'] : nil
   = hash.key?('receiving_account') ? APIHelper.deserialize_union_type(
    UnionTypeLookUp.get(:PaymentOrderReceivingAccount), hash['receiving_account']
  ) : nil
   =
    hash.key?('receiving_account_type') ? hash['receiving_account_type'] : nil
  counterparty_id =
    hash.key?('counterparty_id') ? hash['counterparty_id'] : nil
  transaction_ids =
    hash.key?('transaction_ids') ? hash['transaction_ids'] : nil
  ledger_transaction_id =
    hash.key?('ledger_transaction_id') ? hash['ledger_transaction_id'] : nil
  current_return = Return.from_hash(hash['current_return']) if hash['current_return']
  transaction_monitoring_enabled =
    hash.key?('transaction_monitoring_enabled') ? hash['transaction_monitoring_enabled'] : nil
   =
    hash.key?('compliance_rule_metadata') ? hash['compliance_rule_metadata'] : nil
  # Parameter is an array, so we need to iterate through it
  reference_numbers = nil
  unless hash['reference_numbers'].nil?
    reference_numbers = []
    hash['reference_numbers'].each do |structure|
      reference_numbers << (PaymentReference.from_hash(structure) if structure)
    end
  end

  reference_numbers = nil unless hash.key?('reference_numbers')
  vendor_failure_reason =
    hash.key?('vendor_failure_reason') ? hash['vendor_failure_reason'] : nil
  decision_id = hash.key?('decision_id') ? hash['decision_id'] : nil

  # Create object from extracted values.
  PaymentOrder.new(id: id,
                   object: object,
                   live_mode: live_mode,
                   created_at: created_at,
                   updated_at: updated_at,
                   type: type,
                   subtype: subtype,
                   amount: amount,
                   direction: direction,
                   priority: priority,
                   originating_account_id: ,
                   receiving_account_id: ,
                   accounting: accounting,
                   accounting_category_id: accounting_category_id,
                   accounting_ledger_class_id: accounting_ledger_class_id,
                   currency: currency,
                   effective_date: effective_date,
                   description: description,
                   statement_descriptor: statement_descriptor,
                   remittance_information: remittance_information,
                   purpose: purpose,
                   metadata: ,
                   charge_bearer: charge_bearer,
                   foreign_exchange_indicator: foreign_exchange_indicator,
                   foreign_exchange_contract: foreign_exchange_contract,
                   nsf_protected: nsf_protected,
                   originating_party_name: originating_party_name,
                   ultimate_originating_party_name: ultimate_originating_party_name,
                   ultimate_originating_party_identifier: ultimate_originating_party_identifier,
                   ultimate_receiving_party_name: ultimate_receiving_party_name,
                   ultimate_receiving_party_identifier: ultimate_receiving_party_identifier,
                   send_remittance_advice: send_remittance_advice,
                   expires_at: expires_at,
                   status: status,
                   receiving_account: ,
                   receiving_account_type: ,
                   counterparty_id: counterparty_id,
                   transaction_ids: transaction_ids,
                   ledger_transaction_id: ledger_transaction_id,
                   current_return: current_return,
                   transaction_monitoring_enabled: transaction_monitoring_enabled,
                   compliance_rule_metadata: ,
                   reference_numbers: reference_numbers,
                   vendor_failure_reason: vendor_failure_reason,
                   decision_id: decision_id)
end

.namesObject

A mapping from model property names to API property names.



246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
# File 'lib/modern_treasury/models/payment_order.rb', line 246

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['id'] = 'id'
  @_hash['object'] = 'object'
  @_hash['live_mode'] = 'live_mode'
  @_hash['created_at'] = 'created_at'
  @_hash['updated_at'] = 'updated_at'
  @_hash['type'] = 'type'
  @_hash['subtype'] = 'subtype'
  @_hash['amount'] = 'amount'
  @_hash['direction'] = 'direction'
  @_hash['priority'] = 'priority'
  @_hash['originating_account_id'] = 'originating_account_id'
  @_hash['receiving_account_id'] = 'receiving_account_id'
  @_hash['accounting'] = 'accounting'
  @_hash['accounting_category_id'] = 'accounting_category_id'
  @_hash['accounting_ledger_class_id'] = 'accounting_ledger_class_id'
  @_hash['currency'] = 'currency'
  @_hash['effective_date'] = 'effective_date'
  @_hash['description'] = 'description'
  @_hash['statement_descriptor'] = 'statement_descriptor'
  @_hash['remittance_information'] = 'remittance_information'
  @_hash['purpose'] = 'purpose'
  @_hash['metadata'] = 'metadata'
  @_hash['charge_bearer'] = 'charge_bearer'
  @_hash['foreign_exchange_indicator'] = 'foreign_exchange_indicator'
  @_hash['foreign_exchange_contract'] = 'foreign_exchange_contract'
  @_hash['nsf_protected'] = 'nsf_protected'
  @_hash['originating_party_name'] = 'originating_party_name'
  @_hash['ultimate_originating_party_name'] =
    'ultimate_originating_party_name'
  @_hash['ultimate_originating_party_identifier'] =
    'ultimate_originating_party_identifier'
  @_hash['ultimate_receiving_party_name'] =
    'ultimate_receiving_party_name'
  @_hash['ultimate_receiving_party_identifier'] =
    'ultimate_receiving_party_identifier'
  @_hash['send_remittance_advice'] = 'send_remittance_advice'
  @_hash['expires_at'] = 'expires_at'
  @_hash['status'] = 'status'
  @_hash['receiving_account'] = 'receiving_account'
  @_hash['receiving_account_type'] = 'receiving_account_type'
  @_hash['counterparty_id'] = 'counterparty_id'
  @_hash['transaction_ids'] = 'transaction_ids'
  @_hash['ledger_transaction_id'] = 'ledger_transaction_id'
  @_hash['current_return'] = 'current_return'
  @_hash['transaction_monitoring_enabled'] =
    'transaction_monitoring_enabled'
  @_hash['compliance_rule_metadata'] = 'compliance_rule_metadata'
  @_hash['reference_numbers'] = 'reference_numbers'
  @_hash['vendor_failure_reason'] = 'vendor_failure_reason'
  @_hash['decision_id'] = 'decision_id'
  @_hash
end

.nullablesObject

An array for nullable fields



307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
# File 'lib/modern_treasury/models/payment_order.rb', line 307

def self.nullables
  %w[
    subtype
    accounting_category_id
    accounting_ledger_class_id
    description
    statement_descriptor
    remittance_information
    purpose
    charge_bearer
    foreign_exchange_indicator
    foreign_exchange_contract
    originating_party_name
    ultimate_originating_party_name
    ultimate_originating_party_identifier
    ultimate_receiving_party_name
    ultimate_receiving_party_identifier
    send_remittance_advice
    expires_at
    receiving_account
    counterparty_id
    ledger_transaction_id
    compliance_rule_metadata
    vendor_failure_reason
    decision_id
  ]
end

.optionalsObject

An array for optional fields



302
303
304
# File 'lib/modern_treasury/models/payment_order.rb', line 302

def self.optionals
  []
end

.validate(value) ⇒ Object

Validates an instance of the object from a given value.

Parameters:

  • The (PaymentOrder | Hash)

    value against the validation is performed.



552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
# File 'lib/modern_treasury/models/payment_order.rb', line 552

def self.validate(value)
  if value.instance_of? self
    return (
      APIHelper.valid_type?(value.id,
                            ->(val) { val.instance_of? String }) and
        APIHelper.valid_type?(value.object,
                              ->(val) { val.instance_of? String }) and
        APIHelper.valid_type?(value.live_mode,
                              ->(val) { val.instance_of? TrueClass or val.instance_of? FalseClass }) and
        APIHelper.valid_type?(value.created_at,
                              ->(val) { val.instance_of? DateTime }) and
        APIHelper.valid_type?(value.updated_at,
                              ->(val) { val.instance_of? DateTime }) and
        APIHelper.valid_type?(value.type,
                              ->(val) { Type5.validate(val) }) and
        APIHelper.valid_type?(value.subtype,
                              ->(val) { Subtype.validate(val) }) and
        APIHelper.valid_type?(value.amount,
                              ->(val) { val.instance_of? Integer }) and
        APIHelper.valid_type?(value.direction,
                              ->(val) { Direction5.validate(val) }) and
        APIHelper.valid_type?(value.priority,
                              ->(val) { Priority.validate(val) }) and
        APIHelper.valid_type?(value.,
                              ->(val) { val.instance_of? String }) and
        APIHelper.valid_type?(value.,
                              ->(val) { val.instance_of? String }) and
        APIHelper.valid_type?(value.accounting,
                              ->(val) { Accounting.validate(val) },
                              is_model_hash: true) and
        APIHelper.valid_type?(value.accounting_category_id,
                              ->(val) { val.instance_of? String }) and
        APIHelper.valid_type?(value.accounting_ledger_class_id,
                              ->(val) { val.instance_of? String }) and
        APIHelper.valid_type?(value.currency,
                              ->(val) { Currency.validate(val) }) and
        APIHelper.valid_type?(value.effective_date,
                              ->(val) { val.instance_of? String }) and
        APIHelper.valid_type?(value.description,
                              ->(val) { val.instance_of? String }) and
        APIHelper.valid_type?(value.statement_descriptor,
                              ->(val) { val.instance_of? String }) and
        APIHelper.valid_type?(value.remittance_information,
                              ->(val) { val.instance_of? String }) and
        APIHelper.valid_type?(value.purpose,
                              ->(val) { val.instance_of? String }) and
        APIHelper.valid_type?(value.,
                              ->(val) { val.instance_of? String }) and
        APIHelper.valid_type?(value.charge_bearer,
                              ->(val) { ChargeBearer.validate(val) }) and
        APIHelper.valid_type?(value.foreign_exchange_indicator,
                              ->(val) { ForeignExchangeIndicator.validate(val) }) and
        APIHelper.valid_type?(value.foreign_exchange_contract,
                              ->(val) { val.instance_of? String }) and
        APIHelper.valid_type?(value.nsf_protected,
                              ->(val) { val.instance_of? TrueClass or val.instance_of? FalseClass }) and
        APIHelper.valid_type?(value.originating_party_name,
                              ->(val) { val.instance_of? String }) and
        APIHelper.valid_type?(value.ultimate_originating_party_name,
                              ->(val) { val.instance_of? String }) and
        APIHelper.valid_type?(value.ultimate_originating_party_identifier,
                              ->(val) { val.instance_of? String }) and
        APIHelper.valid_type?(value.ultimate_receiving_party_name,
                              ->(val) { val.instance_of? String }) and
        APIHelper.valid_type?(value.ultimate_receiving_party_identifier,
                              ->(val) { val.instance_of? String }) and
        APIHelper.valid_type?(value.send_remittance_advice,
                              ->(val) { val.instance_of? TrueClass or val.instance_of? FalseClass }) and
        APIHelper.valid_type?(value.expires_at,
                              ->(val) { val.instance_of? DateTime }) and
        APIHelper.valid_type?(value.status,
                              ->(val) { Status3.validate(val) }) and
        UnionTypeLookUp.get(:PaymentOrderReceivingAccount)
                       .validate(value.) and
        APIHelper.valid_type?(value.,
                              ->(val) { ReceivingAccountType.validate(val) }) and
        APIHelper.valid_type?(value.counterparty_id,
                              ->(val) { val.instance_of? String }) and
        APIHelper.valid_type?(value.transaction_ids,
                              ->(val) { val.instance_of? String }) and
        APIHelper.valid_type?(value.ledger_transaction_id,
                              ->(val) { val.instance_of? String }) and
        APIHelper.valid_type?(value.current_return,
                              ->(val) { Return.validate(val) },
                              is_model_hash: true) and
        APIHelper.valid_type?(value.transaction_monitoring_enabled,
                              ->(val) { val.instance_of? TrueClass or val.instance_of? FalseClass }) and
        APIHelper.valid_type?(value.,
                              ->(val) { val.instance_of? Object }) and
        APIHelper.valid_type?(value.reference_numbers,
                              ->(val) { PaymentReference.validate(val) },
                              is_model_hash: true,
                              is_inner_model_hash: true) and
        APIHelper.valid_type?(value.vendor_failure_reason,
                              ->(val) { val.instance_of? String }) and
        APIHelper.valid_type?(value.decision_id,
                              ->(val) { val.instance_of? String })
    )
  end

  return false unless value.instance_of? Hash

  (
    APIHelper.valid_type?(value['id'],
                          ->(val) { val.instance_of? String }) and
      APIHelper.valid_type?(value['object'],
                            ->(val) { val.instance_of? String }) and
      APIHelper.valid_type?(value['live_mode'],
                            ->(val) { val.instance_of? TrueClass or val.instance_of? FalseClass }) and
      APIHelper.valid_type?(value['created_at'],
                            ->(val) { val.instance_of? String }) and
      APIHelper.valid_type?(value['updated_at'],
                            ->(val) { val.instance_of? String }) and
      APIHelper.valid_type?(value['type'],
                            ->(val) { Type5.validate(val) }) and
      APIHelper.valid_type?(value['subtype'],
                            ->(val) { Subtype.validate(val) }) and
      APIHelper.valid_type?(value['amount'],
                            ->(val) { val.instance_of? Integer }) and
      APIHelper.valid_type?(value['direction'],
                            ->(val) { Direction5.validate(val) }) and
      APIHelper.valid_type?(value['priority'],
                            ->(val) { Priority.validate(val) }) and
      APIHelper.valid_type?(value['originating_account_id'],
                            ->(val) { val.instance_of? String }) and
      APIHelper.valid_type?(value['receiving_account_id'],
                            ->(val) { val.instance_of? String }) and
      APIHelper.valid_type?(value['accounting'],
                            ->(val) { Accounting.validate(val) },
                            is_model_hash: true) and
      APIHelper.valid_type?(value['accounting_category_id'],
                            ->(val) { val.instance_of? String }) and
      APIHelper.valid_type?(value['accounting_ledger_class_id'],
                            ->(val) { val.instance_of? String }) and
      APIHelper.valid_type?(value['currency'],
                            ->(val) { Currency.validate(val) }) and
      APIHelper.valid_type?(value['effective_date'],
                            ->(val) { val.instance_of? String }) and
      APIHelper.valid_type?(value['description'],
                            ->(val) { val.instance_of? String }) and
      APIHelper.valid_type?(value['statement_descriptor'],
                            ->(val) { val.instance_of? String }) and
      APIHelper.valid_type?(value['remittance_information'],
                            ->(val) { val.instance_of? String }) and
      APIHelper.valid_type?(value['purpose'],
                            ->(val) { val.instance_of? String }) and
      APIHelper.valid_type?(value['metadata'],
                            ->(val) { val.instance_of? String }) and
      APIHelper.valid_type?(value['charge_bearer'],
                            ->(val) { ChargeBearer.validate(val) }) and
      APIHelper.valid_type?(value['foreign_exchange_indicator'],
                            ->(val) { ForeignExchangeIndicator.validate(val) }) and
      APIHelper.valid_type?(value['foreign_exchange_contract'],
                            ->(val) { val.instance_of? String }) and
      APIHelper.valid_type?(value['nsf_protected'],
                            ->(val) { val.instance_of? TrueClass or val.instance_of? FalseClass }) and
      APIHelper.valid_type?(value['originating_party_name'],
                            ->(val) { val.instance_of? String }) and
      APIHelper.valid_type?(value['ultimate_originating_party_name'],
                            ->(val) { val.instance_of? String }) and
      APIHelper.valid_type?(value['ultimate_originating_party_identifier'],
                            ->(val) { val.instance_of? String }) and
      APIHelper.valid_type?(value['ultimate_receiving_party_name'],
                            ->(val) { val.instance_of? String }) and
      APIHelper.valid_type?(value['ultimate_receiving_party_identifier'],
                            ->(val) { val.instance_of? String }) and
      APIHelper.valid_type?(value['send_remittance_advice'],
                            ->(val) { val.instance_of? TrueClass or val.instance_of? FalseClass }) and
      APIHelper.valid_type?(value['expires_at'],
                            ->(val) { val.instance_of? String }) and
      APIHelper.valid_type?(value['status'],
                            ->(val) { Status3.validate(val) }) and
      UnionTypeLookUp.get(:PaymentOrderReceivingAccount)
                     .validate(value['receiving_account']) and
      APIHelper.valid_type?(value['receiving_account_type'],
                            ->(val) { ReceivingAccountType.validate(val) }) and
      APIHelper.valid_type?(value['counterparty_id'],
                            ->(val) { val.instance_of? String }) and
      APIHelper.valid_type?(value['transaction_ids'],
                            ->(val) { val.instance_of? String }) and
      APIHelper.valid_type?(value['ledger_transaction_id'],
                            ->(val) { val.instance_of? String }) and
      APIHelper.valid_type?(value['current_return'],
                            ->(val) { Return.validate(val) },
                            is_model_hash: true) and
      APIHelper.valid_type?(value['transaction_monitoring_enabled'],
                            ->(val) { val.instance_of? TrueClass or val.instance_of? FalseClass }) and
      APIHelper.valid_type?(value['compliance_rule_metadata'],
                            ->(val) { val.instance_of? Object }) and
      APIHelper.valid_type?(value['reference_numbers'],
                            ->(val) { PaymentReference.validate(val) },
                            is_model_hash: true,
                            is_inner_model_hash: true) and
      APIHelper.valid_type?(value['vendor_failure_reason'],
                            ->(val) { val.instance_of? String }) and
      APIHelper.valid_type?(value['decision_id'],
                            ->(val) { val.instance_of? String })
  )
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
# File 'lib/modern_treasury/models/payment_order.rb', line 782

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} id: #{@id.inspect}, object: #{@object.inspect}, live_mode:"\
  " #{@live_mode.inspect}, created_at: #{@created_at.inspect}, updated_at:"\
  " #{@updated_at.inspect}, type: #{@type.inspect}, subtype: #{@subtype.inspect}, amount:"\
  " #{@amount.inspect}, direction: #{@direction.inspect}, priority: #{@priority.inspect},"\
  " originating_account_id: #{@originating_account_id.inspect}, receiving_account_id:"\
  " #{@receiving_account_id.inspect}, accounting: #{@accounting.inspect},"\
  " accounting_category_id: #{@accounting_category_id.inspect}, accounting_ledger_class_id:"\
  " #{@accounting_ledger_class_id.inspect}, currency: #{@currency.inspect}, effective_date:"\
  " #{@effective_date.inspect}, description: #{@description.inspect}, statement_descriptor:"\
  " #{@statement_descriptor.inspect}, remittance_information:"\
  " #{@remittance_information.inspect}, purpose: #{@purpose.inspect}, metadata:"\
  " #{@metadata.inspect}, charge_bearer: #{@charge_bearer.inspect},"\
  " foreign_exchange_indicator: #{@foreign_exchange_indicator.inspect},"\
  " foreign_exchange_contract: #{@foreign_exchange_contract.inspect}, nsf_protected:"\
  " #{@nsf_protected.inspect}, originating_party_name: #{@originating_party_name.inspect},"\
  " ultimate_originating_party_name: #{@ultimate_originating_party_name.inspect},"\
  " ultimate_originating_party_identifier: #{@ultimate_originating_party_identifier.inspect},"\
  " ultimate_receiving_party_name: #{@ultimate_receiving_party_name.inspect},"\
  " ultimate_receiving_party_identifier: #{@ultimate_receiving_party_identifier.inspect},"\
  " send_remittance_advice: #{@send_remittance_advice.inspect}, expires_at:"\
  " #{@expires_at.inspect}, status: #{@status.inspect}, receiving_account:"\
  " #{@receiving_account.inspect}, receiving_account_type: #{@receiving_account_type.inspect},"\
  " counterparty_id: #{@counterparty_id.inspect}, transaction_ids:"\
  " #{@transaction_ids.inspect}, ledger_transaction_id: #{@ledger_transaction_id.inspect},"\
  " current_return: #{@current_return.inspect}, transaction_monitoring_enabled:"\
  " #{@transaction_monitoring_enabled.inspect}, compliance_rule_metadata:"\
  " #{@compliance_rule_metadata.inspect}, reference_numbers: #{@reference_numbers.inspect},"\
  " vendor_failure_reason: #{@vendor_failure_reason.inspect}, decision_id:"\
  " #{@decision_id.inspect}>"
end

#to_custom_created_atObject



538
539
540
# File 'lib/modern_treasury/models/payment_order.rb', line 538

def to_custom_created_at
  DateTimeHelper.to_rfc3339(created_at)
end

#to_custom_expires_atObject



546
547
548
# File 'lib/modern_treasury/models/payment_order.rb', line 546

def to_custom_expires_at
  DateTimeHelper.to_rfc3339(expires_at)
end

#to_custom_updated_atObject



542
543
544
# File 'lib/modern_treasury/models/payment_order.rb', line 542

def to_custom_updated_at
  DateTimeHelper.to_rfc3339(updated_at)
end

#to_sObject

Provides a human-readable string representation of the object.



753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
# File 'lib/modern_treasury/models/payment_order.rb', line 753

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} id: #{@id}, object: #{@object}, live_mode: #{@live_mode}, created_at:"\
  " #{@created_at}, updated_at: #{@updated_at}, type: #{@type}, subtype: #{@subtype}, amount:"\
  " #{@amount}, direction: #{@direction}, priority: #{@priority}, originating_account_id:"\
  " #{@originating_account_id}, receiving_account_id: #{@receiving_account_id}, accounting:"\
  " #{@accounting}, accounting_category_id: #{@accounting_category_id},"\
  " accounting_ledger_class_id: #{@accounting_ledger_class_id}, currency: #{@currency},"\
  " effective_date: #{@effective_date}, description: #{@description}, statement_descriptor:"\
  " #{@statement_descriptor}, remittance_information: #{@remittance_information}, purpose:"\
  " #{@purpose}, metadata: #{@metadata}, charge_bearer: #{@charge_bearer},"\
  " foreign_exchange_indicator: #{@foreign_exchange_indicator}, foreign_exchange_contract:"\
  " #{@foreign_exchange_contract}, nsf_protected: #{@nsf_protected}, originating_party_name:"\
  " #{@originating_party_name}, ultimate_originating_party_name:"\
  " #{@ultimate_originating_party_name}, ultimate_originating_party_identifier:"\
  " #{@ultimate_originating_party_identifier}, ultimate_receiving_party_name:"\
  " #{@ultimate_receiving_party_name}, ultimate_receiving_party_identifier:"\
  " #{@ultimate_receiving_party_identifier}, send_remittance_advice:"\
  " #{@send_remittance_advice}, expires_at: #{@expires_at}, status: #{@status},"\
  " receiving_account: #{@receiving_account}, receiving_account_type:"\
  " #{@receiving_account_type}, counterparty_id: #{@counterparty_id}, transaction_ids:"\
  " #{@transaction_ids}, ledger_transaction_id: #{@ledger_transaction_id}, current_return:"\
  " #{@current_return}, transaction_monitoring_enabled: #{@transaction_monitoring_enabled},"\
  " compliance_rule_metadata: #{@compliance_rule_metadata}, reference_numbers:"\
  " #{@reference_numbers}, vendor_failure_reason: #{@vendor_failure_reason}, decision_id:"\
  " #{@decision_id}>"
end