Class: Plaid::BankTransferEvent

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/plaid/models/bank_transfer_event.rb

Overview

Represents an event in the Bank Transfers API.

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(event_id:, timestamp:, event_type:, account_id:, bank_transfer_id:, origination_account_id:, bank_transfer_type:, bank_transfer_amount:, bank_transfer_iso_currency_code:, failure_reason:, direction:, receiver_details:, additional_properties: nil) ⇒ BankTransferEvent

Returns a new instance of BankTransferEvent.



109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
# File 'lib/plaid/models/bank_transfer_event.rb', line 109

def initialize(event_id:, timestamp:, event_type:, account_id:,
               bank_transfer_id:, origination_account_id:,
               bank_transfer_type:, bank_transfer_amount:,
               bank_transfer_iso_currency_code:, failure_reason:,
               direction:, receiver_details:, additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @event_id = event_id
  @timestamp = timestamp
  @event_type = event_type
  @account_id = 
  @bank_transfer_id = bank_transfer_id
  @origination_account_id = 
  @bank_transfer_type = bank_transfer_type
  @bank_transfer_amount = bank_transfer_amount
  @bank_transfer_iso_currency_code = bank_transfer_iso_currency_code
  @failure_reason = failure_reason
  @direction = direction
  @receiver_details = receiver_details
  @additional_properties = additional_properties
end

Instance Attribute Details

#account_idString

The account ID associated with the bank transfer.

Returns:

  • (String)


39
40
41
# File 'lib/plaid/models/bank_transfer_event.rb', line 39

def 
  @account_id
end

#bank_transfer_amountString

The bank transfer amount.

Returns:

  • (String)


57
58
59
# File 'lib/plaid/models/bank_transfer_event.rb', line 57

def bank_transfer_amount
  @bank_transfer_amount
end

#bank_transfer_idString

Plaid’s unique identifier for a bank transfer.

Returns:

  • (String)


43
44
45
# File 'lib/plaid/models/bank_transfer_event.rb', line 43

def bank_transfer_id
  @bank_transfer_id
end

#bank_transfer_iso_currency_codeString

The currency of the bank transfer amount.

Returns:

  • (String)


61
62
63
# File 'lib/plaid/models/bank_transfer_event.rb', line 61

def bank_transfer_iso_currency_code
  @bank_transfer_iso_currency_code
end

#bank_transfer_typeBankTransferType

The type of bank transfer. This will be either ‘debit` or `credit`. A `debit` indicates a transfer of money into the origination account; a `credit` indicates a transfer of money out of the origination account.

Returns:



53
54
55
# File 'lib/plaid/models/bank_transfer_event.rb', line 53

def bank_transfer_type
  @bank_transfer_type
end

#directionBankTransferDirection

Indicates the direction of the transfer: ‘outbound` for API-initiated transfers, or `inbound` for payments received by the FBO account.



71
72
73
# File 'lib/plaid/models/bank_transfer_event.rb', line 71

def direction
  @direction
end

#event_idInteger

Plaid’s unique identifier for this event. IDs are sequential unsigned 64-bit integers.

Returns:

  • (Integer)


16
17
18
# File 'lib/plaid/models/bank_transfer_event.rb', line 16

def event_id
  @event_id
end

#event_typeBankTransferEventType

The type of event that this bank transfer represents. ‘pending`: A new transfer was created; it is in the pending state. `cancelled`: The transfer was cancelled by the client. `failed`: The transfer failed, no funds were moved. `posted`: The transfer has been successfully submitted to the payment network. `reversed`: A posted transfer was reversed. `receiver_pending`: The matching transfer was found as a pending transaction in the receiver’s account ‘receiver_posted`: The matching transfer was found as a posted transaction in the receiver’s account



35
36
37
# File 'lib/plaid/models/bank_transfer_event.rb', line 35

def event_type
  @event_type
end

#failure_reasonBankTransferFailure

The failure reason if the type of this transfer is ‘“failed”` or `“reversed”`. Null value otherwise.

Returns:



66
67
68
# File 'lib/plaid/models/bank_transfer_event.rb', line 66

def failure_reason
  @failure_reason
end

#origination_account_idString

The ID of the origination account that this balance belongs to.

Returns:

  • (String)


47
48
49
# File 'lib/plaid/models/bank_transfer_event.rb', line 47

def 
  @origination_account_id
end

#receiver_detailsBankTransferReceiverDetails

The receiver details if the type of this event is ‘reciever_pending` or `reciever_posted`. Null value otherwise.



76
77
78
# File 'lib/plaid/models/bank_transfer_event.rb', line 76

def receiver_details
  @receiver_details
end

#timestampDateTime

The datetime when this event occurred. This will be of the form ‘2006-01-02T15:04:05Z`.

Returns:

  • (DateTime)


21
22
23
# File 'lib/plaid/models/bank_transfer_event.rb', line 21

def timestamp
  @timestamp
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



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
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
# File 'lib/plaid/models/bank_transfer_event.rb', line 133

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  event_id = hash.key?('event_id') ? hash['event_id'] : nil
  timestamp = if hash.key?('timestamp')
                (DateTimeHelper.from_rfc3339(hash['timestamp']) if hash['timestamp'])
              end
  event_type = hash.key?('event_type') ? hash['event_type'] : nil
   = hash.key?('account_id') ? hash['account_id'] : nil
  bank_transfer_id =
    hash.key?('bank_transfer_id') ? hash['bank_transfer_id'] : nil
   =
    hash.key?('origination_account_id') ? hash['origination_account_id'] : nil
  bank_transfer_type =
    hash.key?('bank_transfer_type') ? hash['bank_transfer_type'] : nil
  bank_transfer_amount =
    hash.key?('bank_transfer_amount') ? hash['bank_transfer_amount'] : nil
  bank_transfer_iso_currency_code =
    hash.key?('bank_transfer_iso_currency_code') ? hash['bank_transfer_iso_currency_code'] : nil
  failure_reason = BankTransferFailure.from_hash(hash['failure_reason']) if
    hash['failure_reason']
  direction = hash.key?('direction') ? hash['direction'] : nil
  receiver_details = BankTransferReceiverDetails.from_hash(hash['receiver_details']) if
    hash['receiver_details']

  # 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.
  BankTransferEvent.new(event_id: event_id,
                        timestamp: timestamp,
                        event_type: event_type,
                        account_id: ,
                        bank_transfer_id: bank_transfer_id,
                        origination_account_id: ,
                        bank_transfer_type: bank_transfer_type,
                        bank_transfer_amount: bank_transfer_amount,
                        bank_transfer_iso_currency_code: bank_transfer_iso_currency_code,
                        failure_reason: failure_reason,
                        direction: direction,
                        receiver_details: receiver_details,
                        additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
# File 'lib/plaid/models/bank_transfer_event.rb', line 79

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['event_id'] = 'event_id'
  @_hash['timestamp'] = 'timestamp'
  @_hash['event_type'] = 'event_type'
  @_hash['account_id'] = 'account_id'
  @_hash['bank_transfer_id'] = 'bank_transfer_id'
  @_hash['origination_account_id'] = 'origination_account_id'
  @_hash['bank_transfer_type'] = 'bank_transfer_type'
  @_hash['bank_transfer_amount'] = 'bank_transfer_amount'
  @_hash['bank_transfer_iso_currency_code'] =
    'bank_transfer_iso_currency_code'
  @_hash['failure_reason'] = 'failure_reason'
  @_hash['direction'] = 'direction'
  @_hash['receiver_details'] = 'receiver_details'
  @_hash
end

.nullablesObject

An array for nullable fields



103
104
105
106
107
# File 'lib/plaid/models/bank_transfer_event.rb', line 103

def self.nullables
  %w[
    origination_account_id
  ]
end

.optionalsObject

An array for optional fields



98
99
100
# File 'lib/plaid/models/bank_transfer_event.rb', line 98

def self.optionals
  []
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



199
200
201
202
203
204
205
206
207
208
209
# File 'lib/plaid/models/bank_transfer_event.rb', line 199

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} event_id: #{@event_id.inspect}, timestamp: #{@timestamp.inspect},"\
  " event_type: #{@event_type.inspect}, account_id: #{@account_id.inspect}, bank_transfer_id:"\
  " #{@bank_transfer_id.inspect}, origination_account_id: #{@origination_account_id.inspect},"\
  " bank_transfer_type: #{@bank_transfer_type.inspect}, bank_transfer_amount:"\
  " #{@bank_transfer_amount.inspect}, bank_transfer_iso_currency_code:"\
  " #{@bank_transfer_iso_currency_code.inspect}, failure_reason: #{@failure_reason.inspect},"\
  " direction: #{@direction.inspect}, receiver_details: #{@receiver_details.inspect},"\
  " additional_properties: #{@additional_properties}>"
end

#to_custom_timestampObject



182
183
184
# File 'lib/plaid/models/bank_transfer_event.rb', line 182

def to_custom_timestamp
  DateTimeHelper.to_rfc3339(timestamp)
end

#to_sObject

Provides a human-readable string representation of the object.



187
188
189
190
191
192
193
194
195
196
# File 'lib/plaid/models/bank_transfer_event.rb', line 187

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} event_id: #{@event_id}, timestamp: #{@timestamp}, event_type:"\
  " #{@event_type}, account_id: #{@account_id}, bank_transfer_id: #{@bank_transfer_id},"\
  " origination_account_id: #{@origination_account_id}, bank_transfer_type:"\
  " #{@bank_transfer_type}, bank_transfer_amount: #{@bank_transfer_amount},"\
  " bank_transfer_iso_currency_code: #{@bank_transfer_iso_currency_code}, failure_reason:"\
  " #{@failure_reason}, direction: #{@direction}, receiver_details: #{@receiver_details},"\
  " additional_properties: #{@additional_properties}>"
end