Class: ThePlaidApi::BankTransfer

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/the_plaid_api/models/bank_transfer.rb

Overview

Represents a bank transfer within 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(id:, ach_class:, account_id:, type:, user:, amount:, iso_currency_code:, description:, created:, status:, network:, cancellable:, failure_reason:, custom_tag:, metadata:, origination_account_id:, direction:, additional_properties: nil) ⇒ BankTransfer

Returns a new instance of BankTransfer.



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
# File 'lib/the_plaid_api/models/bank_transfer.rb', line 151

def initialize(id:, ach_class:, account_id:, type:, user:, amount:,
               iso_currency_code:, description:, created:, status:,
               network:, cancellable:, failure_reason:, custom_tag:,
               metadata:, origination_account_id:, direction:,
               additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @id = id
  @ach_class = ach_class
  @account_id = 
  @type = type
  @user = user
  @amount = amount
  @iso_currency_code = iso_currency_code
  @description = description
  @created = created
  @status = status
  @network = network
  @cancellable = cancellable
  @failure_reason = failure_reason
  @custom_tag = custom_tag
  @metadata = 
  @origination_account_id = 
  @direction = direction
  @additional_properties = additional_properties
end

Instance Attribute Details

#account_idString

The account ID that should be credited/debited for this bank transfer.

Returns:

  • (String)


40
41
42
# File 'lib/the_plaid_api/models/bank_transfer.rb', line 40

def 
  @account_id
end

#ach_classAchClass

Specifies the use case of the transfer. Required for transfers on an ACH network. For more details, see [ACH SEC codes](plaid.com/docs/transfer/creating-transfers/#ach-sec-codes). Codes supported for credits: ‘ccd`, `ppd` Codes supported for debits: `ccd`, `tel`, `web` `“ccd”` - Corporate Credit or Debit - fund transfer between two corporate bank accounts `“ppd”` - Prearranged Payment or Deposit - The transfer is part of a pre-existing relationship with a consumer. Authorization was obtained in writing either in person or via an electronic document signing, e.g. Docusign, by the consumer. Can be used for credits or debits. `“web”` - Internet-Initiated Entry. The transfer debits a consumer’s bank account. Authorization from the consumer is obtained over the Internet (e.g. a web or mobile application). Can be used for single debits or recurring debits. `“tel”` - Telephone-Initiated Entry. The transfer debits a consumer. Debit authorization has been received orally over the telephone via a recorded call.

Returns:



36
37
38
# File 'lib/the_plaid_api/models/bank_transfer.rb', line 36

def ach_class
  @ach_class
end

#amountString

The amount of the bank transfer (decimal string with two digits of precision e.g. “10.00”).

Returns:

  • (String)


55
56
57
# File 'lib/the_plaid_api/models/bank_transfer.rb', line 55

def amount
  @amount
end

#cancellableTrueClass | FalseClass

When ‘true`, you can still cancel this bank transfer.

Returns:

  • (TrueClass | FalseClass)


81
82
83
# File 'lib/the_plaid_api/models/bank_transfer.rb', line 81

def cancellable
  @cancellable
end

#createdDateTime

The datetime when this bank transfer was created. This will be of the form ‘2006-01-02T15:04:05Z`

Returns:

  • (DateTime)


68
69
70
# File 'lib/the_plaid_api/models/bank_transfer.rb', line 68

def created
  @created
end

#custom_tagString

A string containing the custom tag provided by the client in the create request. Will be null if not provided.

Returns:

  • (String)


91
92
93
# File 'lib/the_plaid_api/models/bank_transfer.rb', line 91

def custom_tag
  @custom_tag
end

#descriptionString

The description of the transfer.

Returns:

  • (String)


63
64
65
# File 'lib/the_plaid_api/models/bank_transfer.rb', line 63

def description
  @description
end

#directionBankTransferDirection

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



111
112
113
# File 'lib/the_plaid_api/models/bank_transfer.rb', line 111

def direction
  @direction
end

#failure_reasonBankTransferFailure

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

Returns:



86
87
88
# File 'lib/the_plaid_api/models/bank_transfer.rb', line 86

def failure_reason
  @failure_reason
end

#idString

Plaid’s unique identifier for a bank transfer.

Returns:

  • (String)


15
16
17
# File 'lib/the_plaid_api/models/bank_transfer.rb', line 15

def id
  @id
end

#iso_currency_codeString

The currency of the transfer amount, e.g. “USD”

Returns:

  • (String)


59
60
61
# File 'lib/the_plaid_api/models/bank_transfer.rb', line 59

def iso_currency_code
  @iso_currency_code
end

#metadataHash[String, String]

The Metadata object is a mapping of client-provided string fields to any string value. The following limitations apply: The JSON values must be Strings (no nested JSON objects allowed) Only ASCII characters may be used Maximum of 50 key/value pairs Maximum key length of 40 characters Maximum value length of 500 characters

Returns:

  • (Hash[String, String])


101
102
103
# File 'lib/the_plaid_api/models/bank_transfer.rb', line 101

def 
  @metadata
end

#networkBankTransferNetwork

The network or rails used for the transfer. Valid options are ‘ach`, `same-day-ach`, or `wire`.

Returns:



77
78
79
# File 'lib/the_plaid_api/models/bank_transfer.rb', line 77

def network
  @network
end

#origination_account_idString

Plaid’s unique identifier for the origination account that was used for this transfer.

Returns:

  • (String)


106
107
108
# File 'lib/the_plaid_api/models/bank_transfer.rb', line 106

def 
  @origination_account_id
end

#statusBankTransferStatus

The status of the transfer.

Returns:



72
73
74
# File 'lib/the_plaid_api/models/bank_transfer.rb', line 72

def status
  @status
end

#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:



46
47
48
# File 'lib/the_plaid_api/models/bank_transfer.rb', line 46

def type
  @type
end

#userBankTransferUser

The legal name and other information for the account holder.

Returns:



50
51
52
# File 'lib/the_plaid_api/models/bank_transfer.rb', line 50

def user
  @user
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



180
181
182
183
184
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
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
# File 'lib/the_plaid_api/models/bank_transfer.rb', line 180

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  id = hash.key?('id') ? hash['id'] : nil
  ach_class = hash.key?('ach_class') ? hash['ach_class'] : nil
   = hash.key?('account_id') ? hash['account_id'] : nil
  type = hash.key?('type') ? hash['type'] : nil
  user = BankTransferUser.from_hash(hash['user']) if hash['user']
  amount = hash.key?('amount') ? hash['amount'] : nil
  iso_currency_code =
    hash.key?('iso_currency_code') ? hash['iso_currency_code'] : nil
  description = hash.key?('description') ? hash['description'] : nil
  created = if hash.key?('created')
              (DateTimeHelper.from_rfc3339(hash['created']) if hash['created'])
            end
  status = hash.key?('status') ? hash['status'] : nil
  network = hash.key?('network') ? hash['network'] : nil
  cancellable = hash.key?('cancellable') ? hash['cancellable'] : nil
  failure_reason = BankTransferFailure.from_hash(hash['failure_reason']) if
    hash['failure_reason']
  custom_tag = hash.key?('custom_tag') ? hash['custom_tag'] : nil
   = hash.key?('metadata') ? hash['metadata'] : nil
   =
    hash.key?('origination_account_id') ? hash['origination_account_id'] : nil
  direction = hash.key?('direction') ? hash['direction'] : nil

  # 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.
  BankTransfer.new(id: id,
                   ach_class: ach_class,
                   account_id: ,
                   type: type,
                   user: user,
                   amount: amount,
                   iso_currency_code: iso_currency_code,
                   description: description,
                   created: created,
                   status: status,
                   network: network,
                   cancellable: cancellable,
                   failure_reason: failure_reason,
                   custom_tag: custom_tag,
                   metadata: ,
                   origination_account_id: ,
                   direction: direction,
                   additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
# File 'lib/the_plaid_api/models/bank_transfer.rb', line 114

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['id'] = 'id'
  @_hash['ach_class'] = 'ach_class'
  @_hash['account_id'] = 'account_id'
  @_hash['type'] = 'type'
  @_hash['user'] = 'user'
  @_hash['amount'] = 'amount'
  @_hash['iso_currency_code'] = 'iso_currency_code'
  @_hash['description'] = 'description'
  @_hash['created'] = 'created'
  @_hash['status'] = 'status'
  @_hash['network'] = 'network'
  @_hash['cancellable'] = 'cancellable'
  @_hash['failure_reason'] = 'failure_reason'
  @_hash['custom_tag'] = 'custom_tag'
  @_hash['metadata'] = 'metadata'
  @_hash['origination_account_id'] = 'origination_account_id'
  @_hash['direction'] = 'direction'
  @_hash
end

.nullablesObject

An array for nullable fields



142
143
144
145
146
147
148
149
# File 'lib/the_plaid_api/models/bank_transfer.rb', line 142

def self.nullables
  %w[
    failure_reason
    custom_tag
    metadata
    direction
  ]
end

.optionalsObject

An array for optional fields



137
138
139
# File 'lib/the_plaid_api/models/bank_transfer.rb', line 137

def self.optionals
  []
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



252
253
254
255
256
257
258
259
260
261
262
# File 'lib/the_plaid_api/models/bank_transfer.rb', line 252

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} id: #{@id.inspect}, ach_class: #{@ach_class.inspect}, account_id:"\
  " #{@account_id.inspect}, type: #{@type.inspect}, user: #{@user.inspect}, amount:"\
  " #{@amount.inspect}, iso_currency_code: #{@iso_currency_code.inspect}, description:"\
  " #{@description.inspect}, created: #{@created.inspect}, status: #{@status.inspect},"\
  " network: #{@network.inspect}, cancellable: #{@cancellable.inspect}, failure_reason:"\
  " #{@failure_reason.inspect}, custom_tag: #{@custom_tag.inspect}, metadata:"\
  " #{@metadata.inspect}, origination_account_id: #{@origination_account_id.inspect},"\
  " direction: #{@direction.inspect}, additional_properties: #{@additional_properties}>"
end

#to_custom_createdObject



235
236
237
# File 'lib/the_plaid_api/models/bank_transfer.rb', line 235

def to_custom_created
  DateTimeHelper.to_rfc3339(created)
end

#to_sObject

Provides a human-readable string representation of the object.



240
241
242
243
244
245
246
247
248
249
# File 'lib/the_plaid_api/models/bank_transfer.rb', line 240

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} id: #{@id}, ach_class: #{@ach_class}, account_id: #{@account_id}, type:"\
  " #{@type}, user: #{@user}, amount: #{@amount}, iso_currency_code: #{@iso_currency_code},"\
  " description: #{@description}, created: #{@created}, status: #{@status}, network:"\
  " #{@network}, cancellable: #{@cancellable}, failure_reason: #{@failure_reason}, custom_tag:"\
  " #{@custom_tag}, metadata: #{@metadata}, origination_account_id:"\
  " #{@origination_account_id}, direction: #{@direction}, additional_properties:"\
  " #{@additional_properties}>"
end