Class: ModernTreasury::ExpectedPayment

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

Overview

ExpectedPayment 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:, amount_upper_bound:, amount_lower_bound:, direction:, internal_account_id:, type:, currency:, date_upper_bound:, date_lower_bound:, description:, statement_descriptor:, metadata:, counterparty_id:, remittance_information:, reconciliation_groups:, reconciliation_filters:, transaction_id:, transaction_line_item_id:, status:, reconciliation_method:, ledger_transaction_id:) ⇒ ExpectedPayment

Returns a new instance of ExpectedPayment.



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
# File 'lib/modern_treasury/models/expected_payment.rb', line 185

def initialize(id:, object:, live_mode:, created_at:, updated_at:,
               amount_upper_bound:, amount_lower_bound:, direction:,
               internal_account_id:, type:, currency:, date_upper_bound:,
               date_lower_bound:, description:, statement_descriptor:,
               metadata:, counterparty_id:, remittance_information:,
               reconciliation_groups:, reconciliation_filters:,
               transaction_id:, transaction_line_item_id:, status:,
               reconciliation_method:, ledger_transaction_id:)
  @id = id
  @object = object
  @live_mode = live_mode
  @created_at = created_at
  @updated_at = updated_at
  @amount_upper_bound = amount_upper_bound
  @amount_lower_bound = amount_lower_bound
  @direction = direction
  @internal_account_id = 
  @type = type
  @currency = currency
  @date_upper_bound = date_upper_bound
  @date_lower_bound = date_lower_bound
  @description = description
  @statement_descriptor = statement_descriptor
  @metadata = 
  @counterparty_id = counterparty_id
  @remittance_information = remittance_information
  @reconciliation_groups = reconciliation_groups
  @reconciliation_filters = reconciliation_filters
  @transaction_id = transaction_id
  @transaction_line_item_id = transaction_line_item_id
  @status = status
  @reconciliation_method = reconciliation_method
  @ledger_transaction_id = ledger_transaction_id
end

Instance Attribute Details

#amount_lower_boundInteger

The lowest amount this expected payment may be equal to. Value in specified currency’s smallest unit. e.g. $10 would be represented as 1000.

Returns:

  • (Integer)


44
45
46
# File 'lib/modern_treasury/models/expected_payment.rb', line 44

def amount_lower_bound
  @amount_lower_bound
end

#amount_upper_boundInteger

The highest amount this expected payment may be equal to. Value in specified currency’s smallest unit. e.g. $10 would be represented as 1000.

Returns:

  • (Integer)


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

def amount_upper_bound
  @amount_upper_bound
end

#counterparty_idUUID | String

The ID of the counterparty you expect for this payment.

Returns:

  • (UUID | String)


90
91
92
# File 'lib/modern_treasury/models/expected_payment.rb', line 90

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/expected_payment.rb', line 29

def created_at
  @created_at
end

#currencyCurrency

Three-letter ISO currency code.

Returns:



62
63
64
# File 'lib/modern_treasury/models/expected_payment.rb', line 62

def currency
  @currency
end

#date_lower_boundDate

The earliest date the payment may come in. Format: yyyy-mm-dd

Returns:

  • (Date)


70
71
72
# File 'lib/modern_treasury/models/expected_payment.rb', line 70

def date_lower_bound
  @date_lower_bound
end

#date_upper_boundDate

The latest date the payment may come in. Format: yyyy-mm-dd

Returns:

  • (Date)


66
67
68
# File 'lib/modern_treasury/models/expected_payment.rb', line 66

def date_upper_bound
  @date_upper_bound
end

#descriptionString

An optional description for internal use.

Returns:

  • (String)


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

def description
  @description
end

#directionDirection1

One of credit or debit. When you are receiving money, use credit. When you are being charged, use debit.

Returns:



49
50
51
# File 'lib/modern_treasury/models/expected_payment.rb', line 49

def direction
  @direction
end

#idUUID | String

TODO: Write general description for this method

Returns:

  • (UUID | String)


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

def id
  @id
end

#internal_account_idUUID | String

The ID of the Internal Account for the expected payment.

Returns:

  • (UUID | String)


53
54
55
# File 'lib/modern_treasury/models/expected_payment.rb', line 53

def 
  @internal_account_id
end

#ledger_transaction_idUUID | String

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

Returns:

  • (UUID | String)


128
129
130
# File 'lib/modern_treasury/models/expected_payment.rb', line 128

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/expected_payment.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])


86
87
88
# File 'lib/modern_treasury/models/expected_payment.rb', line 86

def 
  @metadata
end

#objectString

TODO: Write general description for this method

Returns:

  • (String)


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

def object
  @object
end

#reconciliation_filtersObject

The reconciliation filters you have for this payment.

Returns:

  • (Object)


104
105
106
# File 'lib/modern_treasury/models/expected_payment.rb', line 104

def reconciliation_filters
  @reconciliation_filters
end

#reconciliation_groupsObject

The reconciliation groups you have for this payment.

Returns:

  • (Object)


100
101
102
# File 'lib/modern_treasury/models/expected_payment.rb', line 100

def reconciliation_groups
  @reconciliation_groups
end

#reconciliation_methodReconciliationMethod

One of manual if this expected payment was manually reconciled in the dashboard, automatic if it was automatically reconciled by Modern Treasury, or null if it is unreconciled.



124
125
126
# File 'lib/modern_treasury/models/expected_payment.rb', line 124

def reconciliation_method
  @reconciliation_method
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)


96
97
98
# File 'lib/modern_treasury/models/expected_payment.rb', line 96

def remittance_information
  @remittance_information
end

#statement_descriptorString

The statement description you expect to see on the transaction. For ACH payments, this will be the full line item passed from the bank. For wire payments, this will be the OBI field on the wire. For check payments, this will be the memo field.

Returns:

  • (String)


81
82
83
# File 'lib/modern_treasury/models/expected_payment.rb', line 81

def statement_descriptor
  @statement_descriptor
end

#statusStatus1

One of unreconciled, reconciled, or archived.

Returns:



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

def status
  @status
end

#transaction_idUUID | String

The ID of the Transaction this expected payment object has been matched to.

Returns:

  • (UUID | String)


109
110
111
# File 'lib/modern_treasury/models/expected_payment.rb', line 109

def transaction_id
  @transaction_id
end

#transaction_line_item_idUUID | String

The ID of the Transaction Line Item this expected payment has been matched to.

Returns:

  • (UUID | String)


114
115
116
# File 'lib/modern_treasury/models/expected_payment.rb', line 114

def transaction_line_item_id
  @transaction_line_item_id
end

#typeType1

One of: ach, au_becs, bacs, book, check, eft, interac, provxchange, rtp, sen, sepa, signet, wire.

Returns:



58
59
60
# File 'lib/modern_treasury/models/expected_payment.rb', line 58

def type
  @type
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/expected_payment.rb', line 34

def updated_at
  @updated_at
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
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
# File 'lib/modern_treasury/models/expected_payment.rb', line 221

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
  amount_upper_bound =
    hash.key?('amount_upper_bound') ? hash['amount_upper_bound'] : nil
  amount_lower_bound =
    hash.key?('amount_lower_bound') ? hash['amount_lower_bound'] : nil
  direction = hash.key?('direction') ? hash['direction'] : nil
   =
    hash.key?('internal_account_id') ? hash['internal_account_id'] : nil
  type = hash.key?('type') ? hash['type'] : nil
  currency = hash.key?('currency') ? hash['currency'] : nil
  date_upper_bound =
    hash.key?('date_upper_bound') ? hash['date_upper_bound'] : nil
  date_lower_bound =
    hash.key?('date_lower_bound') ? hash['date_lower_bound'] : nil
  description = hash.key?('description') ? hash['description'] : nil
  statement_descriptor =
    hash.key?('statement_descriptor') ? hash['statement_descriptor'] : nil
   = hash.key?('metadata') ? hash['metadata'] : nil
  counterparty_id =
    hash.key?('counterparty_id') ? hash['counterparty_id'] : nil
  remittance_information =
    hash.key?('remittance_information') ? hash['remittance_information'] : nil
  reconciliation_groups =
    hash.key?('reconciliation_groups') ? hash['reconciliation_groups'] : nil
  reconciliation_filters =
    hash.key?('reconciliation_filters') ? hash['reconciliation_filters'] : nil
  transaction_id =
    hash.key?('transaction_id') ? hash['transaction_id'] : nil
  transaction_line_item_id =
    hash.key?('transaction_line_item_id') ? hash['transaction_line_item_id'] : nil
  status = hash.key?('status') ? hash['status'] : nil
  reconciliation_method =
    hash.key?('reconciliation_method') ? hash['reconciliation_method'] : nil
  ledger_transaction_id =
    hash.key?('ledger_transaction_id') ? hash['ledger_transaction_id'] : nil

  # Create object from extracted values.
  ExpectedPayment.new(id: id,
                      object: object,
                      live_mode: live_mode,
                      created_at: created_at,
                      updated_at: updated_at,
                      amount_upper_bound: amount_upper_bound,
                      amount_lower_bound: amount_lower_bound,
                      direction: direction,
                      internal_account_id: ,
                      type: type,
                      currency: currency,
                      date_upper_bound: date_upper_bound,
                      date_lower_bound: date_lower_bound,
                      description: description,
                      statement_descriptor: statement_descriptor,
                      metadata: ,
                      counterparty_id: counterparty_id,
                      remittance_information: remittance_information,
                      reconciliation_groups: reconciliation_groups,
                      reconciliation_filters: reconciliation_filters,
                      transaction_id: transaction_id,
                      transaction_line_item_id: transaction_line_item_id,
                      status: status,
                      reconciliation_method: reconciliation_method,
                      ledger_transaction_id: ledger_transaction_id)
end

.namesObject

A mapping from model property names to API property names.



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
# File 'lib/modern_treasury/models/expected_payment.rb', line 131

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['amount_upper_bound'] = 'amount_upper_bound'
  @_hash['amount_lower_bound'] = 'amount_lower_bound'
  @_hash['direction'] = 'direction'
  @_hash['internal_account_id'] = 'internal_account_id'
  @_hash['type'] = 'type'
  @_hash['currency'] = 'currency'
  @_hash['date_upper_bound'] = 'date_upper_bound'
  @_hash['date_lower_bound'] = 'date_lower_bound'
  @_hash['description'] = 'description'
  @_hash['statement_descriptor'] = 'statement_descriptor'
  @_hash['metadata'] = 'metadata'
  @_hash['counterparty_id'] = 'counterparty_id'
  @_hash['remittance_information'] = 'remittance_information'
  @_hash['reconciliation_groups'] = 'reconciliation_groups'
  @_hash['reconciliation_filters'] = 'reconciliation_filters'
  @_hash['transaction_id'] = 'transaction_id'
  @_hash['transaction_line_item_id'] = 'transaction_line_item_id'
  @_hash['status'] = 'status'
  @_hash['reconciliation_method'] = 'reconciliation_method'
  @_hash['ledger_transaction_id'] = 'ledger_transaction_id'
  @_hash
end

.nullablesObject

An array for nullable fields



167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
# File 'lib/modern_treasury/models/expected_payment.rb', line 167

def self.nullables
  %w[
    type
    date_upper_bound
    date_lower_bound
    description
    statement_descriptor
    counterparty_id
    remittance_information
    reconciliation_groups
    reconciliation_filters
    transaction_id
    transaction_line_item_id
    reconciliation_method
    ledger_transaction_id
  ]
end

.optionalsObject

An array for optional fields



162
163
164
# File 'lib/modern_treasury/models/expected_payment.rb', line 162

def self.optionals
  []
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
# File 'lib/modern_treasury/models/expected_payment.rb', line 322

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}, amount_upper_bound: #{@amount_upper_bound.inspect},"\
  " amount_lower_bound: #{@amount_lower_bound.inspect}, direction: #{@direction.inspect},"\
  " internal_account_id: #{@internal_account_id.inspect}, type: #{@type.inspect}, currency:"\
  " #{@currency.inspect}, date_upper_bound: #{@date_upper_bound.inspect}, date_lower_bound:"\
  " #{@date_lower_bound.inspect}, description: #{@description.inspect}, statement_descriptor:"\
  " #{@statement_descriptor.inspect}, metadata: #{@metadata.inspect}, counterparty_id:"\
  " #{@counterparty_id.inspect}, remittance_information: #{@remittance_information.inspect},"\
  " reconciliation_groups: #{@reconciliation_groups.inspect}, reconciliation_filters:"\
  " #{@reconciliation_filters.inspect}, transaction_id: #{@transaction_id.inspect},"\
  " transaction_line_item_id: #{@transaction_line_item_id.inspect}, status:"\
  " #{@status.inspect}, reconciliation_method: #{@reconciliation_method.inspect},"\
  " ledger_transaction_id: #{@ledger_transaction_id.inspect}>"
end

#to_custom_created_atObject



297
298
299
# File 'lib/modern_treasury/models/expected_payment.rb', line 297

def to_custom_created_at
  DateTimeHelper.to_rfc3339(created_at)
end

#to_custom_updated_atObject



301
302
303
# File 'lib/modern_treasury/models/expected_payment.rb', line 301

def to_custom_updated_at
  DateTimeHelper.to_rfc3339(updated_at)
end

#to_sObject

Provides a human-readable string representation of the object.



306
307
308
309
310
311
312
313
314
315
316
317
318
319
# File 'lib/modern_treasury/models/expected_payment.rb', line 306

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}, amount_upper_bound: #{@amount_upper_bound},"\
  " amount_lower_bound: #{@amount_lower_bound}, direction: #{@direction}, internal_account_id:"\
  " #{@internal_account_id}, type: #{@type}, currency: #{@currency}, date_upper_bound:"\
  " #{@date_upper_bound}, date_lower_bound: #{@date_lower_bound}, description:"\
  " #{@description}, statement_descriptor: #{@statement_descriptor}, metadata: #{@metadata},"\
  " counterparty_id: #{@counterparty_id}, remittance_information: #{@remittance_information},"\
  " reconciliation_groups: #{@reconciliation_groups}, reconciliation_filters:"\
  " #{@reconciliation_filters}, transaction_id: #{@transaction_id}, transaction_line_item_id:"\
  " #{@transaction_line_item_id}, status: #{@status}, reconciliation_method:"\
  " #{@reconciliation_method}, ledger_transaction_id: #{@ledger_transaction_id}>"
end