Class: ThePlaidApi::RecurringTransfer

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

Overview

Represents a recurring transfer within the 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(recurring_transfer_id:, created:, next_origination_date:, type:, amount:, status:, network:, origination_account_id:, account_id:, funding_account_id:, iso_currency_code:, description:, transfer_ids:, user:, schedule:, test_clock_id: SKIP, ach_class: SKIP, additional_properties: nil) ⇒ RecurringTransfer

Returns a new instance of RecurringTransfer.



157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
# File 'lib/the_plaid_api/models/recurring_transfer.rb', line 157

def initialize(recurring_transfer_id:, created:, next_origination_date:,
               type:, amount:, status:, network:, origination_account_id:,
               account_id:, funding_account_id:, iso_currency_code:,
               description:, transfer_ids:, user:, schedule:,
               test_clock_id: SKIP, ach_class: SKIP,
               additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @recurring_transfer_id = recurring_transfer_id
  @created = created
  @next_origination_date = next_origination_date
  @test_clock_id = test_clock_id unless test_clock_id == SKIP
  @type = type
  @amount = amount
  @status = status
  @ach_class = ach_class unless ach_class == SKIP
  @network = network
  @origination_account_id = 
  @account_id = 
  @funding_account_id = 
  @iso_currency_code = iso_currency_code
  @description = description
  @transfer_ids = transfer_ids
  @user = user
  @schedule = schedule
  @additional_properties = additional_properties
end

Instance Attribute Details

#account_idString

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

Returns:

  • (String)


88
89
90
# File 'lib/the_plaid_api/models/recurring_transfer.rb', line 88

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:



74
75
76
# File 'lib/the_plaid_api/models/recurring_transfer.rb', line 74

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)


45
46
47
# File 'lib/the_plaid_api/models/recurring_transfer.rb', line 45

def amount
  @amount
end

#createdDateTime

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

Returns:

  • (DateTime)


20
21
22
# File 'lib/the_plaid_api/models/recurring_transfer.rb', line 20

def created
  @created
end

#descriptionString

The description of the recurring transfer.

Returns:

  • (String)


102
103
104
# File 'lib/the_plaid_api/models/recurring_transfer.rb', line 102

def description
  @description
end

#funding_account_idString

The id of the funding account to use, available in the Plaid Dashboard. This determines which of your business checking accounts will be credited or debited.

Returns:

  • (String)


94
95
96
# File 'lib/the_plaid_api/models/recurring_transfer.rb', line 94

def 
  @funding_account_id
end

#iso_currency_codeString

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

Returns:

  • (String)


98
99
100
# File 'lib/the_plaid_api/models/recurring_transfer.rb', line 98

def iso_currency_code
  @iso_currency_code
end

#networkTransferRecurrinngNetwork

Networks eligible for recurring transfers.



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

def network
  @network
end

#next_origination_dateDate

A date in [ISO 8601](wikipedia.org/wiki/ISO_8601) format (YYYY-MM-DD). The next transfer origination date after bank holiday adjustment.

Returns:

  • (Date)


26
27
28
# File 'lib/the_plaid_api/models/recurring_transfer.rb', line 26

def next_origination_date
  @next_origination_date
end

#origination_account_idString

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

Returns:

  • (String)


83
84
85
# File 'lib/the_plaid_api/models/recurring_transfer.rb', line 83

def 
  @origination_account_id
end

#recurring_transfer_idString

Plaid’s unique identifier for a recurring transfer.

Returns:

  • (String)


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

def recurring_transfer_id
  @recurring_transfer_id
end

#scheduleTransferRecurringSchedule

The schedule that the recurring transfer will be executed on.



116
117
118
# File 'lib/the_plaid_api/models/recurring_transfer.rb', line 116

def schedule
  @schedule
end

#statusTransferRecurringStatus

The status of the recurring transfer. ‘active`: The recurring transfer is currently active. `cancelled`: The recurring transfer was cancelled by the client or Plaid. `expired`: The recurring transfer has completed all originations according to its recurring schedule.



53
54
55
# File 'lib/the_plaid_api/models/recurring_transfer.rb', line 53

def status
  @status
end

#test_clock_idString

Plaid’s unique identifier for a test clock.

Returns:

  • (String)


30
31
32
# File 'lib/the_plaid_api/models/recurring_transfer.rb', line 30

def test_clock_id
  @test_clock_id
end

#transfer_idsArray[String]

The created transfer instances associated with this ‘recurring_transfer_id`. If the recurring transfer has been newly created, this array will be empty.

Returns:

  • (Array[String])


108
109
110
# File 'lib/the_plaid_api/models/recurring_transfer.rb', line 108

def transfer_ids
  @transfer_ids
end

#typeTransferType1

The type of 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:



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

def type
  @type
end

#userTransferUserInResponse

The legal name and other information for the account holder.



112
113
114
# File 'lib/the_plaid_api/models/recurring_transfer.rb', line 112

def user
  @user
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



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
234
235
236
237
238
239
240
241
242
# File 'lib/the_plaid_api/models/recurring_transfer.rb', line 187

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  recurring_transfer_id =
    hash.key?('recurring_transfer_id') ? hash['recurring_transfer_id'] : nil
  created = if hash.key?('created')
              (DateTimeHelper.from_rfc3339(hash['created']) if hash['created'])
            end
  next_origination_date =
    hash.key?('next_origination_date') ? hash['next_origination_date'] : nil
  type = hash.key?('type') ? hash['type'] : nil
  amount = hash.key?('amount') ? hash['amount'] : nil
  status = hash.key?('status') ? hash['status'] : nil
  network = hash.key?('network') ? hash['network'] : nil
   =
    hash.key?('origination_account_id') ? hash['origination_account_id'] : nil
   = hash.key?('account_id') ? hash['account_id'] : nil
   =
    hash.key?('funding_account_id') ? hash['funding_account_id'] : nil
  iso_currency_code =
    hash.key?('iso_currency_code') ? hash['iso_currency_code'] : nil
  description = hash.key?('description') ? hash['description'] : nil
  transfer_ids = hash.key?('transfer_ids') ? hash['transfer_ids'] : nil
  user = TransferUserInResponse.from_hash(hash['user']) if hash['user']
  schedule = TransferRecurringSchedule.from_hash(hash['schedule']) if hash['schedule']
  test_clock_id = hash.key?('test_clock_id') ? hash['test_clock_id'] : SKIP
  ach_class = hash.key?('ach_class') ? hash['ach_class'] : 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.
  RecurringTransfer.new(recurring_transfer_id: recurring_transfer_id,
                        created: created,
                        next_origination_date: next_origination_date,
                        type: type,
                        amount: amount,
                        status: status,
                        network: network,
                        origination_account_id: ,
                        account_id: ,
                        funding_account_id: ,
                        iso_currency_code: iso_currency_code,
                        description: description,
                        transfer_ids: transfer_ids,
                        user: user,
                        schedule: schedule,
                        test_clock_id: test_clock_id,
                        ach_class: ach_class,
                        additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
# File 'lib/the_plaid_api/models/recurring_transfer.rb', line 119

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['recurring_transfer_id'] = 'recurring_transfer_id'
  @_hash['created'] = 'created'
  @_hash['next_origination_date'] = 'next_origination_date'
  @_hash['test_clock_id'] = 'test_clock_id'
  @_hash['type'] = 'type'
  @_hash['amount'] = 'amount'
  @_hash['status'] = 'status'
  @_hash['ach_class'] = 'ach_class'
  @_hash['network'] = 'network'
  @_hash['origination_account_id'] = 'origination_account_id'
  @_hash['account_id'] = 'account_id'
  @_hash['funding_account_id'] = 'funding_account_id'
  @_hash['iso_currency_code'] = 'iso_currency_code'
  @_hash['description'] = 'description'
  @_hash['transfer_ids'] = 'transfer_ids'
  @_hash['user'] = 'user'
  @_hash['schedule'] = 'schedule'
  @_hash
end

.nullablesObject

An array for nullable fields



150
151
152
153
154
155
# File 'lib/the_plaid_api/models/recurring_transfer.rb', line 150

def self.nullables
  %w[
    next_origination_date
    test_clock_id
  ]
end

.optionalsObject

An array for optional fields



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

def self.optionals
  %w[
    test_clock_id
    ach_class
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



261
262
263
264
265
266
267
268
269
270
271
272
# File 'lib/the_plaid_api/models/recurring_transfer.rb', line 261

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} recurring_transfer_id: #{@recurring_transfer_id.inspect}, created:"\
  " #{@created.inspect}, next_origination_date: #{@next_origination_date.inspect},"\
  " test_clock_id: #{@test_clock_id.inspect}, type: #{@type.inspect}, amount:"\
  " #{@amount.inspect}, status: #{@status.inspect}, ach_class: #{@ach_class.inspect}, network:"\
  " #{@network.inspect}, origination_account_id: #{@origination_account_id.inspect},"\
  " account_id: #{@account_id.inspect}, funding_account_id: #{@funding_account_id.inspect},"\
  " iso_currency_code: #{@iso_currency_code.inspect}, description: #{@description.inspect},"\
  " transfer_ids: #{@transfer_ids.inspect}, user: #{@user.inspect}, schedule:"\
  " #{@schedule.inspect}, additional_properties: #{@additional_properties}>"
end

#to_custom_createdObject



244
245
246
# File 'lib/the_plaid_api/models/recurring_transfer.rb', line 244

def to_custom_created
  DateTimeHelper.to_rfc3339(created)
end

#to_sObject

Provides a human-readable string representation of the object.



249
250
251
252
253
254
255
256
257
258
# File 'lib/the_plaid_api/models/recurring_transfer.rb', line 249

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} recurring_transfer_id: #{@recurring_transfer_id}, created: #{@created},"\
  " next_origination_date: #{@next_origination_date}, test_clock_id: #{@test_clock_id}, type:"\
  " #{@type}, amount: #{@amount}, status: #{@status}, ach_class: #{@ach_class}, network:"\
  " #{@network}, origination_account_id: #{@origination_account_id}, account_id:"\
  " #{@account_id}, funding_account_id: #{@funding_account_id}, iso_currency_code:"\
  " #{@iso_currency_code}, description: #{@description}, transfer_ids: #{@transfer_ids}, user:"\
  " #{@user}, schedule: #{@schedule}, additional_properties: #{@additional_properties}>"
end