Class: Plaid::TransferAuthorizationCreateRequest

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/plaid/models/transfer_authorization_create_request.rb

Overview

Defines the request schema for ‘/transfer/authorization/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:, type:, network:, amount:, ach_class:, user:, client_id: SKIP, secret: SKIP, device: SKIP, origination_account_id: SKIP, additional_properties: nil) ⇒ TransferAuthorizationCreateRequest

Returns a new instance of TransferAuthorizationCreateRequest.



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

def initialize(access_token:, account_id:, type:, network:, amount:,
               ach_class:, user:, client_id: SKIP, secret: SKIP,
               device: SKIP, origination_account_id: 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
  @access_token = access_token
  @account_id = 
  @type = type
  @network = network
  @amount = amount
  @ach_class = ach_class
  @user = user
  @device = device unless device == SKIP
  @origination_account_id =  unless  == 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)


25
26
27
# File 'lib/plaid/models/transfer_authorization_create_request.rb', line 25

def access_token
  @access_token
end

#account_idString

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

Returns:

  • (String)


29
30
31
# File 'lib/plaid/models/transfer_authorization_create_request.rb', line 29

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:



68
69
70
# File 'lib/plaid/models/transfer_authorization_create_request.rb', line 68

def ach_class
  @ach_class
end

#amountString

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

Returns:

  • (String)


45
46
47
# File 'lib/plaid/models/transfer_authorization_create_request.rb', line 45

def amount
  @amount
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/plaid/models/transfer_authorization_create_request.rb', line 16

def client_id
  @client_id
end

#deviceTransferAuthorizationDevice

Information about the device being used to initiate the authorization.



76
77
78
# File 'lib/plaid/models/transfer_authorization_create_request.rb', line 76

def device
  @device
end

#networkTransferNetwork

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

Returns:



40
41
42
# File 'lib/plaid/models/transfer_authorization_create_request.rb', line 40

def network
  @network
end

#origination_account_idString

Plaid’s unique identifier for the origination account for this authorization. If not specified, the default account will be used.

Returns:

  • (String)


81
82
83
# File 'lib/plaid/models/transfer_authorization_create_request.rb', line 81

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/plaid/models/transfer_authorization_create_request.rb', line 21

def secret
  @secret
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:



35
36
37
# File 'lib/plaid/models/transfer_authorization_create_request.rb', line 35

def type
  @type
end

#userTransferUserInRequest

The legal name and other information for the account holder.



72
73
74
# File 'lib/plaid/models/transfer_authorization_create_request.rb', line 72

def user
  @user
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



137
138
139
140
141
142
143
144
145
146
147
148
149
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
# File 'lib/plaid/models/transfer_authorization_create_request.rb', line 137

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
  type = hash.key?('type') ? hash['type'] : nil
  network = hash.key?('network') ? hash['network'] : nil
  amount = hash.key?('amount') ? hash['amount'] : nil
  ach_class = hash.key?('ach_class') ? hash['ach_class'] : nil
  user = TransferUserInRequest.from_hash(hash['user']) if hash['user']
  client_id = hash.key?('client_id') ? hash['client_id'] : SKIP
  secret = hash.key?('secret') ? hash['secret'] : SKIP
  device = TransferAuthorizationDevice.from_hash(hash['device']) if hash['device']
   =
    hash.key?('origination_account_id') ? hash['origination_account_id'] : 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.
  TransferAuthorizationCreateRequest.new(access_token: access_token,
                                         account_id: ,
                                         type: type,
                                         network: network,
                                         amount: amount,
                                         ach_class: ach_class,
                                         user: user,
                                         client_id: client_id,
                                         secret: secret,
                                         device: device,
                                         origination_account_id: ,
                                         additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
# File 'lib/plaid/models/transfer_authorization_create_request.rb', line 84

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['client_id'] = 'client_id'
  @_hash['secret'] = 'secret'
  @_hash['access_token'] = 'access_token'
  @_hash['account_id'] = 'account_id'
  @_hash['type'] = 'type'
  @_hash['network'] = 'network'
  @_hash['amount'] = 'amount'
  @_hash['ach_class'] = 'ach_class'
  @_hash['user'] = 'user'
  @_hash['device'] = 'device'
  @_hash['origination_account_id'] = 'origination_account_id'
  @_hash
end

.nullablesObject

An array for nullable fields



111
112
113
# File 'lib/plaid/models/transfer_authorization_create_request.rb', line 111

def self.nullables
  []
end

.optionalsObject

An array for optional fields



101
102
103
104
105
106
107
108
# File 'lib/plaid/models/transfer_authorization_create_request.rb', line 101

def self.optionals
  %w[
    client_id
    secret
    device
    origination_account_id
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



187
188
189
190
191
192
193
194
195
# File 'lib/plaid/models/transfer_authorization_create_request.rb', line 187

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

#to_sObject

Provides a human-readable string representation of the object.



177
178
179
180
181
182
183
184
# File 'lib/plaid/models/transfer_authorization_create_request.rb', line 177

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