Class: ThePlaidApi::TransferEvent
- Defined in:
- lib/the_plaid_api/models/transfer_event.rb
Overview
Represents an event in the Transfers API.
Instance Attribute Summary collapse
-
#account_id ⇒ String
The account ID associated with the transfer.
-
#event_id ⇒ Integer
Plaid’s unique identifier for this event.
-
#event_type ⇒ TransferEventType
The type of event that this transfer represents.
-
#failure_reason ⇒ TransferFailure
The failure reason if the event type for a transfer is ‘“failed”` or `“returned”`.
-
#funding_account_id ⇒ String
The id of the associated funding account, available in the Plaid Dashboard.
-
#intent_id ⇒ String
The ‘id` returned by the /transfer/intent/create endpoint, for transfers created via Transfer UI.
-
#ledger_id ⇒ String
Plaid’s unique identifier for a Plaid Ledger Balance.
-
#origination_account_id ⇒ String
The ID of the origination account that this balance belongs to.
-
#originator_client_id ⇒ String
The Plaid client ID that is the originator of the transfer that this event applies to.
-
#refund_id ⇒ String
Plaid’s unique identifier for a refund.
-
#sweep_amount ⇒ String
A signed amount of how much was ‘swept` or `return_swept` for this transfer (decimal string with two digits of precision e.g. “-5.50”).
-
#sweep_id ⇒ String
Plaid’s unique identifier for a sweep.
-
#timestamp ⇒ DateTime
The datetime when this event occurred.
-
#transfer_amount ⇒ String
The amount of the transfer (decimal string with two digits of precision e.g. “10.00”).
-
#transfer_id ⇒ String
Plaid’s unique identifier for a transfer.
-
#transfer_type ⇒ OmittableTransferType
The type of transfer.
-
#wire_return_fee ⇒ String
The fee amount deducted from the original transfer during a wire return, if applicable.
Class Method Summary collapse
-
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
-
.names ⇒ Object
A mapping from model property names to API property names.
-
.nullables ⇒ Object
An array for nullable fields.
-
.optionals ⇒ Object
An array for optional fields.
Instance Method Summary collapse
-
#initialize(event_id:, timestamp:, event_type:, funding_account_id:, transfer_id:, origination_account_id:, failure_reason:, sweep_id:, sweep_amount:, refund_id:, originator_client_id:, account_id: SKIP, ledger_id: SKIP, transfer_type: SKIP, transfer_amount: SKIP, intent_id: SKIP, wire_return_fee: SKIP, additional_properties: nil) ⇒ TransferEvent
constructor
A new instance of TransferEvent.
-
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
- #to_custom_timestamp ⇒ Object
-
#to_s ⇒ Object
Provides a human-readable string representation of the object.
Methods inherited from BaseModel
#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json
Constructor Details
#initialize(event_id:, timestamp:, event_type:, funding_account_id:, transfer_id:, origination_account_id:, failure_reason:, sweep_id:, sweep_amount:, refund_id:, originator_client_id:, account_id: SKIP, ledger_id: SKIP, transfer_type: SKIP, transfer_amount: SKIP, intent_id: SKIP, wire_return_fee: SKIP, additional_properties: nil) ⇒ TransferEvent
Returns a new instance of TransferEvent.
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/the_plaid_api/models/transfer_event.rb', line 191 def initialize(event_id:, timestamp:, event_type:, funding_account_id:, transfer_id:, origination_account_id:, failure_reason:, sweep_id:, sweep_amount:, refund_id:, originator_client_id:, account_id: SKIP, ledger_id: SKIP, transfer_type: SKIP, transfer_amount: SKIP, intent_id: SKIP, wire_return_fee: SKIP, additional_properties: nil) # Add additional model properties to the instance additional_properties = {} if additional_properties.nil? @event_id = event_id @timestamp = @event_type = event_type @account_id = account_id unless account_id == SKIP @funding_account_id = funding_account_id @ledger_id = ledger_id unless ledger_id == SKIP @transfer_id = transfer_id @origination_account_id = origination_account_id @transfer_type = transfer_type unless transfer_type == SKIP @transfer_amount = transfer_amount unless transfer_amount == SKIP @failure_reason = failure_reason @sweep_id = sweep_id @sweep_amount = sweep_amount @refund_id = refund_id @originator_client_id = originator_client_id @intent_id = intent_id unless intent_id == SKIP @wire_return_fee = wire_return_fee unless wire_return_fee == SKIP @additional_properties = additional_properties end |
Instance Attribute Details
#account_id ⇒ String
The account ID associated with the transfer. This field is omitted for Plaid Ledger Sweep events.
71 72 73 |
# File 'lib/the_plaid_api/models/transfer_event.rb', line 71 def account_id @account_id end |
#event_id ⇒ Integer
Plaid’s unique identifier for this event. IDs are sequential unsigned 64-bit integers.
16 17 18 |
# File 'lib/the_plaid_api/models/transfer_event.rb', line 16 def event_id @event_id end |
#event_type ⇒ TransferEventType
The type of event that this transfer represents. Event types with prefix ‘sweep` represents events for Plaid Ledger sweeps. `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. `settled`: The transfer has been successfully completed by the payment network. `funds_available`: Funds from the transfer have been released from hold and applied to the ledger’s available balance. (Only applicable to ACH debits.) ‘returned`: A posted transfer was returned. `swept`: The transfer was swept to / from the sweep account. `swept_settled`: Credits are available to be withdrawn or debits have been deducted from the customer’s business checking account. `return_swept`: Due to the transfer being returned, funds were pulled from or pushed back to the sweep account. `sweep.pending`: A new ledger sweep was created; it is in the pending state. `sweep.posted`: The ledger sweep has been successfully submitted to the payment network. `sweep.settled`: The transaction has settled in the funding account. This means that funds withdrawn from Plaid Ledger balance have reached the funding account, or funds to be deposited into the Plaid Ledger Balance have been pulled, and the hold period has begun. `sweep.returned`: A posted ledger sweep was returned. `sweep.failed`: The ledger sweep failed, no funds were moved. `sweep.funds_available`: Funds from the ledger sweep have been released from hold and applied to the ledger’s available balance. This is only applicable to debits. ‘refund.pending`: A new refund was created; it is in the pending state. `refund.cancelled`: The refund was cancelled. `refund.failed`: The refund failed, no funds were moved. `refund.posted`: The refund has been successfully submitted to the payment network. `refund.settled`: The refund transaction has settled in the Plaid linked account. `refund.returned`: A posted refund was returned. `refund.swept`: The refund was swept from the sweep account. `refund.return_swept`: Due to the refund being returned, funds were pushed back to the sweep account.
66 67 68 |
# File 'lib/the_plaid_api/models/transfer_event.rb', line 66 def event_type @event_type end |
#failure_reason ⇒ TransferFailure
The failure reason if the event type for a transfer is ‘“failed”` or `“returned”`. Null value otherwise.
107 108 109 |
# File 'lib/the_plaid_api/models/transfer_event.rb', line 107 def failure_reason @failure_reason end |
#funding_account_id ⇒ String
The id of the associated funding account, available in the Plaid Dashboard. If present, this indicates which of your business checking accounts will be credited or debited.
77 78 79 |
# File 'lib/the_plaid_api/models/transfer_event.rb', line 77 def funding_account_id @funding_account_id end |
#intent_id ⇒ String
The ‘id` returned by the /transfer/intent/create endpoint, for transfers created via Transfer UI. For transfers not created by Transfer UI, the value is `null`. This will currently only be populated for RfP transfers.
133 134 135 |
# File 'lib/the_plaid_api/models/transfer_event.rb', line 133 def intent_id @intent_id end |
#ledger_id ⇒ String
Plaid’s unique identifier for a Plaid Ledger Balance.
81 82 83 |
# File 'lib/the_plaid_api/models/transfer_event.rb', line 81 def ledger_id @ledger_id end |
#origination_account_id ⇒ String
The ID of the origination account that this balance belongs to.
90 91 92 |
# File 'lib/the_plaid_api/models/transfer_event.rb', line 90 def origination_account_id @origination_account_id end |
#originator_client_id ⇒ String
The Plaid client ID that is the originator of the transfer that this event applies to. Only present if the transfer was created on behalf of another client as a third-party sender (TPS).
127 128 129 |
# File 'lib/the_plaid_api/models/transfer_event.rb', line 127 def originator_client_id @originator_client_id end |
#refund_id ⇒ String
Plaid’s unique identifier for a refund. A non-null value indicates the event is for the associated refund of the transfer.
121 122 123 |
# File 'lib/the_plaid_api/models/transfer_event.rb', line 121 def refund_id @refund_id end |
#sweep_amount ⇒ String
A signed amount of how much was ‘swept` or `return_swept` for this transfer (decimal string with two digits of precision e.g. “-5.50”).
116 117 118 |
# File 'lib/the_plaid_api/models/transfer_event.rb', line 116 def sweep_amount @sweep_amount end |
#sweep_id ⇒ String
Plaid’s unique identifier for a sweep.
111 112 113 |
# File 'lib/the_plaid_api/models/transfer_event.rb', line 111 def sweep_id @sweep_id end |
#timestamp ⇒ DateTime
The datetime when this event occurred. This will be of the form ‘2006-01-02T15:04:05Z`.
21 22 23 |
# File 'lib/the_plaid_api/models/transfer_event.rb', line 21 def @timestamp end |
#transfer_amount ⇒ String
The amount of the transfer (decimal string with two digits of precision e.g. “10.00”). This field is omitted for Plaid Ledger Sweep events.
102 103 104 |
# File 'lib/the_plaid_api/models/transfer_event.rb', line 102 def transfer_amount @transfer_amount end |
#transfer_id ⇒ String
Plaid’s unique identifier for a transfer. This field is an empty string for Plaid Ledger Sweep events.
86 87 88 |
# File 'lib/the_plaid_api/models/transfer_event.rb', line 86 def transfer_id @transfer_id end |
#transfer_type ⇒ OmittableTransferType
The type of transfer. Valid values are ‘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. This field is omitted for Plaid Ledger Sweep events.
97 98 99 |
# File 'lib/the_plaid_api/models/transfer_event.rb', line 97 def transfer_type @transfer_type end |
#wire_return_fee ⇒ String
The fee amount deducted from the original transfer during a wire return, if applicable.
138 139 140 |
# File 'lib/the_plaid_api/models/transfer_event.rb', line 138 def wire_return_fee @wire_return_fee 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 |
# File 'lib/the_plaid_api/models/transfer_event.rb', line 221 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. event_id = hash.key?('event_id') ? hash['event_id'] : nil = if hash.key?('timestamp') (DateTimeHelper.from_rfc3339(hash['timestamp']) if hash['timestamp']) end event_type = hash.key?('event_type') ? hash['event_type'] : nil funding_account_id = hash.key?('funding_account_id') ? hash['funding_account_id'] : nil transfer_id = hash.key?('transfer_id') ? hash['transfer_id'] : nil origination_account_id = hash.key?('origination_account_id') ? hash['origination_account_id'] : nil failure_reason = TransferFailure.from_hash(hash['failure_reason']) if hash['failure_reason'] sweep_id = hash.key?('sweep_id') ? hash['sweep_id'] : nil sweep_amount = hash.key?('sweep_amount') ? hash['sweep_amount'] : nil refund_id = hash.key?('refund_id') ? hash['refund_id'] : nil originator_client_id = hash.key?('originator_client_id') ? hash['originator_client_id'] : nil account_id = hash.key?('account_id') ? hash['account_id'] : SKIP ledger_id = hash.key?('ledger_id') ? hash['ledger_id'] : SKIP transfer_type = hash.key?('transfer_type') ? hash['transfer_type'] : SKIP transfer_amount = hash.key?('transfer_amount') ? hash['transfer_amount'] : SKIP intent_id = hash.key?('intent_id') ? hash['intent_id'] : SKIP wire_return_fee = hash.key?('wire_return_fee') ? hash['wire_return_fee'] : SKIP # Create a new hash for additional properties, removing known properties. new_hash = hash.reject { |k, _| names.value?(k) } additional_properties = APIHelper.get_additional_properties( new_hash, proc { |value| value } ) # Create object from extracted values. TransferEvent.new(event_id: event_id, timestamp: , event_type: event_type, funding_account_id: funding_account_id, transfer_id: transfer_id, origination_account_id: origination_account_id, failure_reason: failure_reason, sweep_id: sweep_id, sweep_amount: sweep_amount, refund_id: refund_id, originator_client_id: originator_client_id, account_id: account_id, ledger_id: ledger_id, transfer_type: transfer_type, transfer_amount: transfer_amount, intent_id: intent_id, wire_return_fee: wire_return_fee, additional_properties: additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 |
# File 'lib/the_plaid_api/models/transfer_event.rb', line 141 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['funding_account_id'] = 'funding_account_id' @_hash['ledger_id'] = 'ledger_id' @_hash['transfer_id'] = 'transfer_id' @_hash['origination_account_id'] = 'origination_account_id' @_hash['transfer_type'] = 'transfer_type' @_hash['transfer_amount'] = 'transfer_amount' @_hash['failure_reason'] = 'failure_reason' @_hash['sweep_id'] = 'sweep_id' @_hash['sweep_amount'] = 'sweep_amount' @_hash['refund_id'] = 'refund_id' @_hash['originator_client_id'] = 'originator_client_id' @_hash['intent_id'] = 'intent_id' @_hash['wire_return_fee'] = 'wire_return_fee' @_hash end |
.nullables ⇒ Object
An array for nullable fields
176 177 178 179 180 181 182 183 184 185 186 187 188 189 |
# File 'lib/the_plaid_api/models/transfer_event.rb', line 176 def self.nullables %w[ funding_account_id ledger_id origination_account_id failure_reason sweep_id sweep_amount refund_id originator_client_id intent_id wire_return_fee ] end |
.optionals ⇒ Object
An array for optional fields
164 165 166 167 168 169 170 171 172 173 |
# File 'lib/the_plaid_api/models/transfer_event.rb', line 164 def self.optionals %w[ account_id ledger_id transfer_type transfer_amount intent_id wire_return_fee ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
296 297 298 299 300 301 302 303 304 305 306 307 308 |
# File 'lib/the_plaid_api/models/transfer_event.rb', line 296 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},"\ " funding_account_id: #{@funding_account_id.inspect}, ledger_id: #{@ledger_id.inspect},"\ " transfer_id: #{@transfer_id.inspect}, origination_account_id:"\ " #{@origination_account_id.inspect}, transfer_type: #{@transfer_type.inspect},"\ " transfer_amount: #{@transfer_amount.inspect}, failure_reason: #{@failure_reason.inspect},"\ " sweep_id: #{@sweep_id.inspect}, sweep_amount: #{@sweep_amount.inspect}, refund_id:"\ " #{@refund_id.inspect}, originator_client_id: #{@originator_client_id.inspect}, intent_id:"\ " #{@intent_id.inspect}, wire_return_fee: #{@wire_return_fee.inspect},"\ " additional_properties: #{@additional_properties}>" end |
#to_custom_timestamp ⇒ Object
278 279 280 |
# File 'lib/the_plaid_api/models/transfer_event.rb', line 278 def DateTimeHelper.to_rfc3339() end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
283 284 285 286 287 288 289 290 291 292 293 |
# File 'lib/the_plaid_api/models/transfer_event.rb', line 283 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}, funding_account_id: #{@funding_account_id},"\ " ledger_id: #{@ledger_id}, transfer_id: #{@transfer_id}, origination_account_id:"\ " #{@origination_account_id}, transfer_type: #{@transfer_type}, transfer_amount:"\ " #{@transfer_amount}, failure_reason: #{@failure_reason}, sweep_id: #{@sweep_id},"\ " sweep_amount: #{@sweep_amount}, refund_id: #{@refund_id}, originator_client_id:"\ " #{@originator_client_id}, intent_id: #{@intent_id}, wire_return_fee: #{@wire_return_fee},"\ " additional_properties: #{@additional_properties}>" end |