Class: ModernTreasury::IncomingPaymentDetail

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

Overview

IncomingPaymentDetail 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:, internal_account_id:, virtual_account_id:, virtual_account:, transaction_line_item_id:, transaction_id:, ledger_transaction_id:, type:, data:, amount:, currency:, direction:, status:, metadata:, as_of_date:, vendor_id:, originating_routing_number:, originating_routing_number_type:, originating_account_number_safe:, originating_account_number_type:, originating_account_number: SKIP) ⇒ IncomingPaymentDetail

Returns a new instance of IncomingPaymentDetail.



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

def initialize(id:, object:, live_mode:, created_at:, updated_at:,
               internal_account_id:, virtual_account_id:, virtual_account:,
               transaction_line_item_id:, transaction_id:,
               ledger_transaction_id:, type:, data:, amount:, currency:,
               direction:, status:, metadata:, as_of_date:, vendor_id:,
               originating_routing_number:,
               originating_routing_number_type:,
               originating_account_number_safe:,
               originating_account_number_type:,
               originating_account_number: SKIP)
  @id = id
  @object = object
  @live_mode = live_mode
  @created_at = created_at
  @updated_at = updated_at
  @internal_account_id = 
  @virtual_account_id = 
  @virtual_account = 
  @transaction_line_item_id = transaction_line_item_id
  @transaction_id = transaction_id
  @ledger_transaction_id = ledger_transaction_id
  @type = type
  @data = data
  @amount = amount
  @currency = currency
  @direction = direction
  @status = status
  @metadata = 
  @as_of_date = as_of_date
  @vendor_id = vendor_id
  @originating_routing_number = originating_routing_number
  @originating_routing_number_type = originating_routing_number_type
  unless  == SKIP
    @originating_account_number =
      
  end
  @originating_account_number_safe = 
  @originating_account_number_type = 
end

Instance Attribute Details

#amountInteger

Value in specified currency’s smallest unit. e.g. $10 would be represented as 1000.

Returns:

  • (Integer)


77
78
79
# File 'lib/modern_treasury/models/incoming_payment_detail.rb', line 77

def amount
  @amount
end

#as_of_dateDate

The date on which the corresponding transaction will occur.

Returns:

  • (Date)


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

def as_of_date
  @as_of_date
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/incoming_payment_detail.rb', line 29

def created_at
  @created_at
end

#currencyCurrency

Three-letter ISO currency code.

Returns:



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

def currency
  @currency
end

#dataObject

The raw data from the payment pre-notification file that we get from the bank.

Returns:

  • (Object)


72
73
74
# File 'lib/modern_treasury/models/incoming_payment_detail.rb', line 72

def data
  @data
end

#directionDirection4

One of ‘credit` or `debit`.

Returns:



85
86
87
# File 'lib/modern_treasury/models/incoming_payment_detail.rb', line 85

def direction
  @direction
end

#idUUID | String

TODO: Write general description for this method

Returns:

  • (UUID | String)


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

def id
  @id
end

#internal_account_idUUID | String

The ID of the Internal Account for the incoming payment detail. This is always present.

Returns:

  • (UUID | String)


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

def 
  @internal_account_id
end

#ledger_transaction_idUUID | String

The ID of the ledger transaction linked to the incoming payment detail or ‘null`.

Returns:

  • (UUID | String)


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

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


95
96
97
# File 'lib/modern_treasury/models/incoming_payment_detail.rb', line 95

def 
  @metadata
end

#objectString

TODO: Write general description for this method

Returns:

  • (String)


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

def object
  @object
end

#originating_account_numberString

The account number of the originating account for the incoming payment detail.

Returns:

  • (String)


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

def 
  @originating_account_number
end

#originating_account_number_safeString

The last 4 digits of the originating account_number for the incoming payment detail.

Returns:

  • (String)


123
124
125
# File 'lib/modern_treasury/models/incoming_payment_detail.rb', line 123

def 
  @originating_account_number_safe
end

#originating_account_number_typeOriginatingAccountNumberType

The type of the originating account number for the incoming payment detail.



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

def 
  @originating_account_number_type
end

#originating_routing_numberString

The routing number of the originating account for the incoming payment detail.

Returns:

  • (String)


108
109
110
# File 'lib/modern_treasury/models/incoming_payment_detail.rb', line 108

def originating_routing_number
  @originating_routing_number
end

#originating_routing_number_typeOriginatingRoutingNumberType

The type of the originating routing number for the incoming payment detail.



113
114
115
# File 'lib/modern_treasury/models/incoming_payment_detail.rb', line 113

def originating_routing_number_type
  @originating_routing_number_type
end

#statusStatus2

The current status of the incoming payment order. One of ‘pending`, `completed`, or `returned`.

Returns:



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

def status
  @status
end

#transaction_idUUID | String

The ID of the reconciled Transaction or ‘null`.

Returns:

  • (UUID | String)


57
58
59
# File 'lib/modern_treasury/models/incoming_payment_detail.rb', line 57

def transaction_id
  @transaction_id
end

#transaction_line_item_idUUID | String

The ID of the reconciled Transaction Line Item or ‘null`.

Returns:

  • (UUID | String)


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

def transaction_line_item_id
  @transaction_line_item_id
end

#typeType4

One of: ‘ach`, `book`, `check`, `eft`, `interac`, `rtp`, `sepa`, `signet`, or `wire`.

Returns:



67
68
69
# File 'lib/modern_treasury/models/incoming_payment_detail.rb', line 67

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/incoming_payment_detail.rb', line 34

def updated_at
  @updated_at
end

#vendor_idUUID | String

The identifier of the vendor bank.

Returns:

  • (UUID | String)


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

def vendor_id
  @vendor_id
end

#virtual_accountVirtualAccount

If the incoming payment detail is in a virtual account, the ID of the Virtual Account.

Returns:



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

def 
  @virtual_account
end

#virtual_account_idUUID | String

If the incoming payment detail is in a virtual account, the ID of the Virtual Account.

Returns:

  • (UUID | String)


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

def 
  @virtual_account_id
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



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
296
297
298
299
# File 'lib/modern_treasury/models/incoming_payment_detail.rb', line 228

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
   =
    hash.key?('internal_account_id') ? hash['internal_account_id'] : nil
   =
    hash.key?('virtual_account_id') ? hash['virtual_account_id'] : nil
   = VirtualAccount.from_hash(hash['virtual_account']) if
    hash['virtual_account']
  transaction_line_item_id =
    hash.key?('transaction_line_item_id') ? hash['transaction_line_item_id'] : nil
  transaction_id =
    hash.key?('transaction_id') ? hash['transaction_id'] : nil
  ledger_transaction_id =
    hash.key?('ledger_transaction_id') ? hash['ledger_transaction_id'] : nil
  type = hash.key?('type') ? hash['type'] : nil
  data = hash.key?('data') ? hash['data'] : nil
  amount = hash.key?('amount') ? hash['amount'] : nil
  currency = hash.key?('currency') ? hash['currency'] : nil
  direction = hash.key?('direction') ? hash['direction'] : nil
  status = hash.key?('status') ? hash['status'] : nil
   = hash.key?('metadata') ? hash['metadata'] : nil
  as_of_date = hash.key?('as_of_date') ? hash['as_of_date'] : nil
  vendor_id = hash.key?('vendor_id') ? hash['vendor_id'] : nil
  originating_routing_number =
    hash.key?('originating_routing_number') ? hash['originating_routing_number'] : nil
  originating_routing_number_type =
    hash.key?('originating_routing_number_type') ? hash['originating_routing_number_type'] : nil
   =
    hash.key?('originating_account_number_safe') ? hash['originating_account_number_safe'] : nil
   =
    hash.key?('originating_account_number_type') ? hash['originating_account_number_type'] : nil
   =
    hash.key?('originating_account_number') ? hash['originating_account_number'] : SKIP

  # Create object from extracted values.
  IncomingPaymentDetail.new(id: id,
                            object: object,
                            live_mode: live_mode,
                            created_at: created_at,
                            updated_at: updated_at,
                            internal_account_id: ,
                            virtual_account_id: ,
                            virtual_account: ,
                            transaction_line_item_id: transaction_line_item_id,
                            transaction_id: transaction_id,
                            ledger_transaction_id: ledger_transaction_id,
                            type: type,
                            data: data,
                            amount: amount,
                            currency: currency,
                            direction: direction,
                            status: status,
                            metadata: ,
                            as_of_date: as_of_date,
                            vendor_id: vendor_id,
                            originating_routing_number: originating_routing_number,
                            originating_routing_number_type: originating_routing_number_type,
                            originating_account_number_safe: ,
                            originating_account_number_type: ,
                            originating_account_number: )
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
160
161
162
# File 'lib/modern_treasury/models/incoming_payment_detail.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['internal_account_id'] = 'internal_account_id'
  @_hash['virtual_account_id'] = 'virtual_account_id'
  @_hash['virtual_account'] = 'virtual_account'
  @_hash['transaction_line_item_id'] = 'transaction_line_item_id'
  @_hash['transaction_id'] = 'transaction_id'
  @_hash['ledger_transaction_id'] = 'ledger_transaction_id'
  @_hash['type'] = 'type'
  @_hash['data'] = 'data'
  @_hash['amount'] = 'amount'
  @_hash['currency'] = 'currency'
  @_hash['direction'] = 'direction'
  @_hash['status'] = 'status'
  @_hash['metadata'] = 'metadata'
  @_hash['as_of_date'] = 'as_of_date'
  @_hash['vendor_id'] = 'vendor_id'
  @_hash['originating_routing_number'] = 'originating_routing_number'
  @_hash['originating_routing_number_type'] =
    'originating_routing_number_type'
  @_hash['originating_account_number'] = 'originating_account_number'
  @_hash['originating_account_number_safe'] =
    'originating_account_number_safe'
  @_hash['originating_account_number_type'] =
    'originating_account_number_type'
  @_hash
end

.nullablesObject

An array for nullable fields



172
173
174
175
176
177
178
179
180
181
182
183
184
185
# File 'lib/modern_treasury/models/incoming_payment_detail.rb', line 172

def self.nullables
  %w[
    virtual_account_id
    transaction_line_item_id
    transaction_id
    ledger_transaction_id
    vendor_id
    originating_routing_number
    originating_routing_number_type
    originating_account_number
    originating_account_number_safe
    originating_account_number_type
  ]
end

.optionalsObject

An array for optional fields



165
166
167
168
169
# File 'lib/modern_treasury/models/incoming_payment_detail.rb', line 165

def self.optionals
  %w[
    originating_account_number
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
# File 'lib/modern_treasury/models/incoming_payment_detail.rb', line 327

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}, internal_account_id: #{@internal_account_id.inspect},"\
  " virtual_account_id: #{@virtual_account_id.inspect}, virtual_account:"\
  " #{@virtual_account.inspect}, transaction_line_item_id:"\
  " #{@transaction_line_item_id.inspect}, transaction_id: #{@transaction_id.inspect},"\
  " ledger_transaction_id: #{@ledger_transaction_id.inspect}, type: #{@type.inspect}, data:"\
  " #{@data.inspect}, amount: #{@amount.inspect}, currency: #{@currency.inspect}, direction:"\
  " #{@direction.inspect}, status: #{@status.inspect}, metadata: #{@metadata.inspect},"\
  " as_of_date: #{@as_of_date.inspect}, vendor_id: #{@vendor_id.inspect},"\
  " originating_routing_number: #{@originating_routing_number.inspect},"\
  " originating_routing_number_type: #{@originating_routing_number_type.inspect},"\
  " originating_account_number: #{@originating_account_number.inspect},"\
  " originating_account_number_safe: #{@originating_account_number_safe.inspect},"\
  " originating_account_number_type: #{@originating_account_number_type.inspect}>"
end

#to_custom_created_atObject



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

def to_custom_created_at
  DateTimeHelper.to_rfc3339(created_at)
end

#to_custom_updated_atObject



305
306
307
# File 'lib/modern_treasury/models/incoming_payment_detail.rb', line 305

def to_custom_updated_at
  DateTimeHelper.to_rfc3339(updated_at)
end

#to_sObject

Provides a human-readable string representation of the object.



310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
# File 'lib/modern_treasury/models/incoming_payment_detail.rb', line 310

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}, internal_account_id: #{@internal_account_id},"\
  " virtual_account_id: #{@virtual_account_id}, virtual_account: #{@virtual_account},"\
  " transaction_line_item_id: #{@transaction_line_item_id}, transaction_id:"\
  " #{@transaction_id}, ledger_transaction_id: #{@ledger_transaction_id}, type: #{@type},"\
  " data: #{@data}, amount: #{@amount}, currency: #{@currency}, direction: #{@direction},"\
  " status: #{@status}, metadata: #{@metadata}, as_of_date: #{@as_of_date}, vendor_id:"\
  " #{@vendor_id}, originating_routing_number: #{@originating_routing_number},"\
  " originating_routing_number_type: #{@originating_routing_number_type},"\
  " originating_account_number: #{@originating_account_number},"\
  " originating_account_number_safe: #{@originating_account_number_safe},"\
  " originating_account_number_type: #{@originating_account_number_type}>"
end