Class: Plaid::BankTransfer

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/plaid/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.



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

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)


42
43
44
# File 'lib/plaid/models/bank_transfer.rb', line 42

def 
  @account_id
end

#ach_classAchClass

Specifies the use case of the transfer. Required for transfers on an ACH network. ‘“arc”` - Accounts Receivable Entry `“cbr`” - Cross Border Entry `“ccd”` - Corporate Credit or Debit - fund transfer between two corporate bank accounts `“cie”` - Customer Initiated Entry `“cor”` - Automated Notification of Change `“ctx”` - Corporate Trade Exchange `“iat”` - International `“mte”` - Machine Transfer Entry `“pbr”` - Cross Border Entry `“pop”` - Point-of-Purchase Entry `“pos”` - Point-of-Sale Entry `“ppd”` - Prearranged Payment or Deposit - the transfer is part of a pre-existing relationship with a consumer, eg. bill payment `“rck”` - Re-presented Check Entry `“tel”` - Telephone-Initiated Entry `“web”` - Internet-Initiated Entry - debits from a consumer’s account where their authorization is obtained over the Internet

Returns:



38
39
40
# File 'lib/plaid/models/bank_transfer.rb', line 38

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)


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

def amount
  @amount
end

#cancellableTrueClass | FalseClass

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

Returns:

  • (TrueClass | FalseClass)


83
84
85
# File 'lib/plaid/models/bank_transfer.rb', line 83

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)


70
71
72
# File 'lib/plaid/models/bank_transfer.rb', line 70

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)


93
94
95
# File 'lib/plaid/models/bank_transfer.rb', line 93

def custom_tag
  @custom_tag
end

#descriptionString

The description of the transfer.

Returns:

  • (String)


65
66
67
# File 'lib/plaid/models/bank_transfer.rb', line 65

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.



113
114
115
# File 'lib/plaid/models/bank_transfer.rb', line 113

def direction
  @direction
end

#failure_reasonBankTransferFailure

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

Returns:



88
89
90
# File 'lib/plaid/models/bank_transfer.rb', line 88

def failure_reason
  @failure_reason
end

#idString

Plaid’s unique identifier for a bank transfer.

Returns:

  • (String)


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

def id
  @id
end

#iso_currency_codeString

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

Returns:

  • (String)


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

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])


103
104
105
# File 'lib/plaid/models/bank_transfer.rb', line 103

def 
  @metadata
end

#networkBankTransferNetwork

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

Returns:



79
80
81
# File 'lib/plaid/models/bank_transfer.rb', line 79

def network
  @network
end

#origination_account_idString

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

Returns:

  • (String)


108
109
110
# File 'lib/plaid/models/bank_transfer.rb', line 108

def 
  @origination_account_id
end

#statusBankTransferStatus

The status of the transfer.

Returns:



74
75
76
# File 'lib/plaid/models/bank_transfer.rb', line 74

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:



48
49
50
# File 'lib/plaid/models/bank_transfer.rb', line 48

def type
  @type
end

#userBankTransferUser

The legal name and other information for the account holder.

Returns:



52
53
54
# File 'lib/plaid/models/bank_transfer.rb', line 52

def user
  @user
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



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

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.



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

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



144
145
146
147
148
# File 'lib/plaid/models/bank_transfer.rb', line 144

def self.nullables
  %w[
    custom_tag
  ]
end

.optionalsObject

An array for optional fields



139
140
141
# File 'lib/plaid/models/bank_transfer.rb', line 139

def self.optionals
  []
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



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

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



234
235
236
# File 'lib/plaid/models/bank_transfer.rb', line 234

def to_custom_created
  DateTimeHelper.to_rfc3339(created)
end

#to_sObject

Provides a human-readable string representation of the object.



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

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