Class: ThePlaidApi::TransferCreateRequest

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

Overview

Defines the request schema for ‘/transfer/create`

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(access_token:, account_id:, authorization_id:, description:, client_id: SKIP, secret: SKIP, idempotency_key: SKIP, type: SKIP, network: SKIP, amount: SKIP, ach_class: SKIP, user: SKIP, metadata: SKIP, origination_account_id: SKIP, iso_currency_code: SKIP, test_clock_id: SKIP, facilitator_fee: SKIP, additional_properties: nil) ⇒ TransferCreateRequest

Returns a new instance of TransferCreateRequest.



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

def initialize(access_token:, account_id:, authorization_id:, description:,
               client_id: SKIP, secret: SKIP, idempotency_key: SKIP,
               type: SKIP, network: SKIP, amount: SKIP, ach_class: SKIP,
               user: SKIP, metadata: SKIP, origination_account_id: SKIP,
               iso_currency_code: SKIP, test_clock_id: SKIP,
               facilitator_fee: SKIP, additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @client_id = client_id unless client_id == SKIP
  @secret = secret unless secret == SKIP
  @idempotency_key = idempotency_key unless idempotency_key == SKIP
  @access_token = access_token
  @account_id = 
  @authorization_id = authorization_id
  @type = type unless type == SKIP
  @network = network unless network == SKIP
  @amount = amount unless amount == SKIP
  @description = description
  @ach_class = ach_class unless ach_class == SKIP
  @user = user unless user == SKIP
  @metadata =  unless  == SKIP
  @origination_account_id =  unless  == SKIP
  @iso_currency_code = iso_currency_code unless iso_currency_code == SKIP
  @test_clock_id = test_clock_id unless test_clock_id == SKIP
  @facilitator_fee = facilitator_fee unless facilitator_fee == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#access_tokenString

The Plaid ‘access_token` for the account that will be debited or credited.

Returns:

  • (String)


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

def access_token
  @access_token
end

#account_idString

The Plaid ‘account_id` corresponding to the end-user account that will be debited or credited.

Returns:

  • (String)


41
42
43
# File 'lib/the_plaid_api/models/transfer_create_request.rb', line 41

def 
  @account_id
end

#ach_classAchClass

The transfer description, maximum of 15 characters (RTP transactions) or 10 characters (ACH transactions). Should represent why the money is moving, not your company name. For recommendations on setting the ‘description` field to avoid ACH returns, see [Description field recommendations](www.plaid.com/docs/transfer/creating-transfers/#d escription-field-recommendations). If reprocessing a returned transfer, the `description` field must be `“Retry 1”` or `“Retry 2”`. You may retry a transfer up to 2 times, within 180 days of creating the original transfer. Only transfers that were returned with code `R01` or `R09` may be retried.

Returns:



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

def ach_class
  @ach_class
end

#amountString

The amount of the transfer (decimal string with two digits of precision e.g. “10.00”). When calling ‘/transfer/authorization/create`, specify the maximum amount to authorize. When calling `/transfer/create`, specify the exact amount of the transfer, up to a maximum of the amount authorized. If this field is left blank when calling `/transfer/create`, the maximum amount authorized in the `authorization_id` will be sent.

Returns:

  • (String)


65
66
67
# File 'lib/the_plaid_api/models/transfer_create_request.rb', line 65

def amount
  @amount
end

#authorization_idString

Plaid’s unique identifier for a transfer authorization. This parameter also serves the purpose of acting as an idempotency identifier.

Returns:

  • (String)


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

def authorization_id
  @authorization_id
end

#client_idString

Your Plaid API ‘client_id`. The `client_id` is required and may be provided either in the `PLAID-CLIENT-ID` header or as part of a request body.

Returns:

  • (String)


16
17
18
# File 'lib/the_plaid_api/models/transfer_create_request.rb', line 16

def client_id
  @client_id
end

#descriptionString

The transfer description, maximum of 15 characters (RTP transactions) or 10 characters (ACH transactions). Should represent why the money is moving, not your company name. For recommendations on setting the ‘description` field to avoid ACH returns, see [Description field recommendations](www.plaid.com/docs/transfer/creating-transfers/#d escription-field-recommendations). If reprocessing a returned transfer, the `description` field must be `“Retry 1”` or `“Retry 2”`. You may retry a transfer up to 2 times, within 180 days of creating the original transfer. Only transfers that were returned with code `R01` or `R09` may be retried.

Returns:

  • (String)


78
79
80
# File 'lib/the_plaid_api/models/transfer_create_request.rb', line 78

def description
  @description
end

#facilitator_feeString

The amount to deduct from ‘transfer.amount` and distribute to the platform’s Ledger balance as a facilitator fee (decimal string with two digits of precision e.g. “10.00”). The remainder will go to the end-customer’s Ledger balance. This must be value greater than 0 and less than or equal to the `transfer.amount`.

Returns:

  • (String)


129
130
131
# File 'lib/the_plaid_api/models/transfer_create_request.rb', line 129

def facilitator_fee
  @facilitator_fee
end

#idempotency_keyString

Deprecated. ‘authorization_id` is now used as idempotency instead. A random key provided by the client, per unique transfer. Maximum of 50 characters. The API supports idempotency for safely retrying requests without accidentally performing the same operation twice. For example, if a request to create a transfer fails due to a network connection error, you can retry the request with the same idempotency key to guarantee that only a single transfer is created.

Returns:

  • (String)


32
33
34
# File 'lib/the_plaid_api/models/transfer_create_request.rb', line 32

def idempotency_key
  @idempotency_key
end

#iso_currency_codeString

The currency of the transfer amount. The default value is “USD”.

Returns:

  • (String)


115
116
117
# File 'lib/the_plaid_api/models/transfer_create_request.rb', line 115

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


105
106
107
# File 'lib/the_plaid_api/models/transfer_create_request.rb', line 105

def 
  @metadata
end

#networkTransferNetwork

Plaid’s unique identifier for a transfer authorization. This parameter also serves the purpose of acting as an idempotency identifier.

Returns:



56
57
58
# File 'lib/the_plaid_api/models/transfer_create_request.rb', line 56

def network
  @network
end

#origination_account_idString

Plaid’s unique identifier for the origination account for this transfer. If you have more than one origination account, this value must be specified. Otherwise, this field should be left blank.

Returns:

  • (String)


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

def 
  @origination_account_id
end

#secretString

Your Plaid API ‘secret`. The `secret` is required and may be provided either in the `PLAID-SECRET` header or as part of a request body.

Returns:

  • (String)


21
22
23
# File 'lib/the_plaid_api/models/transfer_create_request.rb', line 21

def secret
  @secret
end

#test_clock_idString

Plaid’s unique identifier for a test clock. This field may only be used when using ‘sandbox` environment. If provided, the `transfer` is created at the `virtual_time` on the provided `test_clock`.

Returns:

  • (String)


121
122
123
# File 'lib/the_plaid_api/models/transfer_create_request.rb', line 121

def test_clock_id
  @test_clock_id
end

#typeTransferType1

Plaid’s unique identifier for a transfer authorization. This parameter also serves the purpose of acting as an idempotency identifier.

Returns:



51
52
53
# File 'lib/the_plaid_api/models/transfer_create_request.rb', line 51

def type
  @type
end

#userTransferUserInRequestDeprecated

The legal name and other information for the account holder.



95
96
97
# File 'lib/the_plaid_api/models/transfer_create_request.rb', line 95

def user
  @user
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



213
214
215
216
217
218
219
220
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
# File 'lib/the_plaid_api/models/transfer_create_request.rb', line 213

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  access_token = hash.key?('access_token') ? hash['access_token'] : nil
   = hash.key?('account_id') ? hash['account_id'] : nil
  authorization_id =
    hash.key?('authorization_id') ? hash['authorization_id'] : nil
  description = hash.key?('description') ? hash['description'] : nil
  client_id = hash.key?('client_id') ? hash['client_id'] : SKIP
  secret = hash.key?('secret') ? hash['secret'] : SKIP
  idempotency_key =
    hash.key?('idempotency_key') ? hash['idempotency_key'] : SKIP
  type = hash.key?('type') ? hash['type'] : SKIP
  network = hash.key?('network') ? hash['network'] : SKIP
  amount = hash.key?('amount') ? hash['amount'] : SKIP
  ach_class = hash.key?('ach_class') ? hash['ach_class'] : SKIP
  user = TransferUserInRequestDeprecated.from_hash(hash['user']) if hash['user']
   = hash.key?('metadata') ? hash['metadata'] : SKIP
   =
    hash.key?('origination_account_id') ? hash['origination_account_id'] : SKIP
  iso_currency_code =
    hash.key?('iso_currency_code') ? hash['iso_currency_code'] : SKIP
  test_clock_id = hash.key?('test_clock_id') ? hash['test_clock_id'] : SKIP
  facilitator_fee =
    hash.key?('facilitator_fee') ? hash['facilitator_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.
  TransferCreateRequest.new(access_token: access_token,
                            account_id: ,
                            authorization_id: authorization_id,
                            description: description,
                            client_id: client_id,
                            secret: secret,
                            idempotency_key: idempotency_key,
                            type: type,
                            network: network,
                            amount: amount,
                            ach_class: ach_class,
                            user: user,
                            metadata: ,
                            origination_account_id: ,
                            iso_currency_code: iso_currency_code,
                            test_clock_id: test_clock_id,
                            facilitator_fee: facilitator_fee,
                            additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
# File 'lib/the_plaid_api/models/transfer_create_request.rb', line 132

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['client_id'] = 'client_id'
  @_hash['secret'] = 'secret'
  @_hash['idempotency_key'] = 'idempotency_key'
  @_hash['access_token'] = 'access_token'
  @_hash['account_id'] = 'account_id'
  @_hash['authorization_id'] = 'authorization_id'
  @_hash['type'] = 'type'
  @_hash['network'] = 'network'
  @_hash['amount'] = 'amount'
  @_hash['description'] = 'description'
  @_hash['ach_class'] = 'ach_class'
  @_hash['user'] = 'user'
  @_hash['metadata'] = 'metadata'
  @_hash['origination_account_id'] = 'origination_account_id'
  @_hash['iso_currency_code'] = 'iso_currency_code'
  @_hash['test_clock_id'] = 'test_clock_id'
  @_hash['facilitator_fee'] = 'facilitator_fee'
  @_hash
end

.nullablesObject

An array for nullable fields



174
175
176
177
178
179
180
181
# File 'lib/the_plaid_api/models/transfer_create_request.rb', line 174

def self.nullables
  %w[
    user
    metadata
    origination_account_id
    test_clock_id
  ]
end

.optionalsObject

An array for optional fields



155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
# File 'lib/the_plaid_api/models/transfer_create_request.rb', line 155

def self.optionals
  %w[
    client_id
    secret
    idempotency_key
    type
    network
    amount
    ach_class
    user
    metadata
    origination_account_id
    iso_currency_code
    test_clock_id
    facilitator_fee
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



281
282
283
284
285
286
287
288
289
290
291
292
# File 'lib/the_plaid_api/models/transfer_create_request.rb', line 281

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} client_id: #{@client_id.inspect}, secret: #{@secret.inspect},"\
  " idempotency_key: #{@idempotency_key.inspect}, access_token: #{@access_token.inspect},"\
  " account_id: #{@account_id.inspect}, authorization_id: #{@authorization_id.inspect}, type:"\
  " #{@type.inspect}, network: #{@network.inspect}, amount: #{@amount.inspect}, description:"\
  " #{@description.inspect}, ach_class: #{@ach_class.inspect}, user: #{@user.inspect},"\
  " metadata: #{@metadata.inspect}, origination_account_id:"\
  " #{@origination_account_id.inspect}, iso_currency_code: #{@iso_currency_code.inspect},"\
  " test_clock_id: #{@test_clock_id.inspect}, facilitator_fee: #{@facilitator_fee.inspect},"\
  " additional_properties: #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



269
270
271
272
273
274
275
276
277
278
# File 'lib/the_plaid_api/models/transfer_create_request.rb', line 269

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} client_id: #{@client_id}, secret: #{@secret}, idempotency_key:"\
  " #{@idempotency_key}, access_token: #{@access_token}, account_id: #{@account_id},"\
  " authorization_id: #{@authorization_id}, type: #{@type}, network: #{@network}, amount:"\
  " #{@amount}, description: #{@description}, ach_class: #{@ach_class}, user: #{@user},"\
  " metadata: #{@metadata}, origination_account_id: #{@origination_account_id},"\
  " iso_currency_code: #{@iso_currency_code}, test_clock_id: #{@test_clock_id},"\
  " facilitator_fee: #{@facilitator_fee}, additional_properties: #{@additional_properties}>"
end