Class: ThePlaidApi::WalletTransactionGetResponse

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

Overview

WalletTransactionGetResponse defines the response schema for ‘/wallet/transaction/get`

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(transaction_id:, wallet_id:, reference:, type:, amount:, counterparty:, status:, created_at:, last_status_update:, request_id:, scheme: SKIP, payee_verification_status: SKIP, payment_id: SKIP, failure_reason: SKIP, error: SKIP, related_transactions: SKIP, additional_properties: nil) ⇒ WalletTransactionGetResponse

Returns a new instance of WalletTransactionGetResponse.



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

def initialize(transaction_id:, wallet_id:, reference:, type:, amount:,
               counterparty:, status:, created_at:, last_status_update:,
               request_id:, scheme: SKIP, payee_verification_status: SKIP,
               payment_id: SKIP, failure_reason: SKIP, error: SKIP,
               related_transactions: SKIP, additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @transaction_id = transaction_id
  @wallet_id = wallet_id
  @reference = reference
  @type = type
  @scheme = scheme unless scheme == SKIP
  @amount = amount
  @counterparty = counterparty
  @status = status
  @created_at = created_at
  @last_status_update = last_status_update
  unless payee_verification_status == SKIP
    @payee_verification_status =
      payee_verification_status
  end
  @payment_id = payment_id unless payment_id == SKIP
  @failure_reason = failure_reason unless failure_reason == SKIP
  @error = error unless error == SKIP
  @related_transactions = related_transactions unless related_transactions == SKIP
  @request_id = request_id
  @additional_properties = additional_properties
end

Instance Attribute Details

#amountWalletTransactionAmount

The amount and currency of a transaction



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

def amount
  @amount
end

#counterpartyWalletTransactionCounterparty

An object representing the e-wallet transaction’s counterparty



67
68
69
# File 'lib/the_plaid_api/models/wallet_transaction_get_response.rb', line 67

def counterparty
  @counterparty
end

#created_atDateTime

Timestamp when the transaction was created, in [ISO 8601](wikipedia.org/wiki/ISO_8601) format.

Returns:

  • (DateTime)


90
91
92
# File 'lib/the_plaid_api/models/wallet_transaction_get_response.rb', line 90

def created_at
  @created_at
end

#errorError

Errors are identified by ‘error_code` and categorized by `error_type`. Use these in preference to HTTP status codes to identify and handle specific errors. HTTP status codes are set and provide the broadest categorization of errors: 4xx codes are for developer- or user-related errors, and 5xx codes are for Plaid-related errors, and the status will be 2xx in non-error cases. An Item with a non-`null` error object will only be part of an API response when calling `/item/get` to view Item status. Otherwise, error fields will be `null` if no error has occurred; if an error has occurred, an error code will be returned instead.

Returns:



136
137
138
# File 'lib/the_plaid_api/models/wallet_transaction_get_response.rb', line 136

def error
  @error
end

#failure_reasonWalletTransactionFailureReason

The error code of a failed transaction. Error codes include: ‘EXTERNAL_SYSTEM`: The transaction was declined by an external system. `EXPIRED`: The transaction request has expired. `CANCELLED`: The transaction request was rescinded. `INVALID`: The transaction did not meet certain criteria, such as an inactive account or no valid counterparty, etc. `UNKNOWN`: The transaction was unsuccessful, but the exact cause is unknown.



124
125
126
# File 'lib/the_plaid_api/models/wallet_transaction_get_response.rb', line 124

def failure_reason
  @failure_reason
end

#last_status_updateDateTime

The date and time of the last time the ‘status` was updated, in IS0 8601 format

Returns:

  • (DateTime)


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

def last_status_update
  @last_status_update
end

#payee_verification_statusWalletTransactionPayeeVerificationStatus

Result of payee verification check for EUR payouts. Payee verification checks whether the payee name provided matches the account holder name at the destination institution. ‘FULL_MATCH`: The payee name fully matches the account holder. `PARTIAL_MATCH`: The payee name partially matches the account holder. `NO_MATCH`: The payee name does not match the account holder. `ERROR`: An error occurred during payee verification. `CHECK_NOT_POSSIBLE`: Payee verification could not be performed. This field is only populated for applicable EUR payout transactions and will be `null` for other transaction types.



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

def payee_verification_status
  @payee_verification_status
end

#payment_idString

The payment id that this transaction is associated with, if any. This is present only for transaction types ‘PIS_PAY_IN` and `REFUND`.

Returns:

  • (String)


113
114
115
# File 'lib/the_plaid_api/models/wallet_transaction_get_response.rb', line 113

def payment_id
  @payment_id
end

#referenceString

A reference for the transaction

Returns:

  • (String)


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

def reference
  @reference
end

A list of wallet transactions that this transaction is associated with, if any.

Returns:



141
142
143
# File 'lib/the_plaid_api/models/wallet_transaction_get_response.rb', line 141

def related_transactions
  @related_transactions
end

#request_idString

A unique identifier for the request, which can be used for troubleshooting. This identifier, like all Plaid identifiers, is case sensitive.

Returns:

  • (String)


147
148
149
# File 'lib/the_plaid_api/models/wallet_transaction_get_response.rb', line 147

def request_id
  @request_id
end

#schemeWalletPaymentScheme

The payment scheme used to execute this transaction. This is present only for transaction types ‘PAYOUT` and `REFUND`. `FASTER_PAYMENTS`: The standard payment scheme within the UK. `SEPA_CREDIT_TRANSFER`: The standard payment to a beneficiary within the SEPA area. `SEPA_CREDIT_TRANSFER_INSTANT`: Instant payment to a beneficiary within the SEPA area.

Returns:



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

def scheme
  @scheme
end

#statusWalletTransactionStatus

The status of the transaction. ‘AUTHORISING`: The transaction is being processed for validation and compliance. `INITIATED`: The transaction has been initiated and is currently being processed. `EXECUTED`: The transaction has been successfully executed and is considered complete. This is only applicable for debit transactions. `SETTLED`: The transaction has settled and funds are available for use. This is only applicable for credit transactions. A transaction will typically settle within seconds to several days, depending on which payment rail is used. `FAILED`: The transaction failed to process successfully. This is a terminal status. `BLOCKED`: The transaction has been blocked for violating compliance rules. This is a terminal status.



85
86
87
# File 'lib/the_plaid_api/models/wallet_transaction_get_response.rb', line 85

def status
  @status
end

#transaction_idString

A unique ID identifying the transaction

Returns:

  • (String)


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

def transaction_id
  @transaction_id
end

#typeType5

The type of the transaction. The supported transaction types that are returned are: ‘BANK_TRANSFER:` a transaction which credits an e-wallet through an external bank transfer. `PAYOUT:` a transaction which debits an e-wallet by disbursing funds to a counterparty. `PIS_PAY_IN:` a payment which credits an e-wallet through Plaid’s Payment Initiation Services (PIS) APIs. For more information see the [Payment Initiation endpoints](plaid.com/docs/api/products/payment-initiation/). ‘REFUND:` a transaction which debits an e-wallet by refunding a previously initiated payment made through Plaid’s [PIS APIs](plaid.com/docs/api/products/payment-initiation/). ‘FUNDS_SWEEP`: an automated transaction which debits funds from an e-wallet to a designated client-owned account. `RETURN`: an automated transaction where a debit transaction was reversed and money moved back to originating account. `RECALL`: a transaction where the sending bank has requested the return of funds due to a fraud claim, technical error, or other issue associated with the payment.

Returns:



49
50
51
# File 'lib/the_plaid_api/models/wallet_transaction_get_response.rb', line 49

def type
  @type
end

#wallet_idString

The EMI (E-Money Institution) wallet that this payment is associated with, if any. This wallet is used as an intermediary account to enable Plaid to reconcile the settlement of funds for Payment Initiation requests.

Returns:

  • (String)


22
23
24
# File 'lib/the_plaid_api/models/wallet_transaction_get_response.rb', line 22

def wallet_id
  @wallet_id
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



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
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
# File 'lib/the_plaid_api/models/wallet_transaction_get_response.rb', line 225

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  transaction_id =
    hash.key?('transaction_id') ? hash['transaction_id'] : nil
  wallet_id = hash.key?('wallet_id') ? hash['wallet_id'] : nil
  reference = hash.key?('reference') ? hash['reference'] : nil
  type = hash.key?('type') ? hash['type'] : nil
  amount = WalletTransactionAmount.from_hash(hash['amount']) if hash['amount']
  counterparty = WalletTransactionCounterparty.from_hash(hash['counterparty']) if
    hash['counterparty']
  status = hash.key?('status') ? hash['status'] : nil
  created_at = if hash.key?('created_at')
                 (DateTimeHelper.from_rfc3339(hash['created_at']) if hash['created_at'])
               end
  last_status_update = if hash.key?('last_status_update')
                         (DateTimeHelper.from_rfc3339(hash['last_status_update']) if hash['last_status_update'])
                       end
  request_id = hash.key?('request_id') ? hash['request_id'] : nil
  scheme = hash.key?('scheme') ? hash['scheme'] : SKIP
  payee_verification_status =
    hash.key?('payee_verification_status') ? hash['payee_verification_status'] : SKIP
  payment_id = hash.key?('payment_id') ? hash['payment_id'] : SKIP
  failure_reason =
    hash.key?('failure_reason') ? hash['failure_reason'] : SKIP
  error = Error.from_hash(hash['error']) if hash['error']
  # Parameter is an array, so we need to iterate through it
  related_transactions = nil
  unless hash['related_transactions'].nil?
    related_transactions = []
    hash['related_transactions'].each do |structure|
      related_transactions << (WalletTransactionRelation.from_hash(structure) if structure)
    end
  end

  related_transactions = SKIP unless hash.key?('related_transactions')

  # 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.
  WalletTransactionGetResponse.new(transaction_id: transaction_id,
                                   wallet_id: wallet_id,
                                   reference: reference,
                                   type: type,
                                   amount: amount,
                                   counterparty: counterparty,
                                   status: status,
                                   created_at: created_at,
                                   last_status_update: last_status_update,
                                   request_id: request_id,
                                   scheme: scheme,
                                   payee_verification_status: payee_verification_status,
                                   payment_id: payment_id,
                                   failure_reason: failure_reason,
                                   error: error,
                                   related_transactions: related_transactions,
                                   additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
# File 'lib/the_plaid_api/models/wallet_transaction_get_response.rb', line 150

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['transaction_id'] = 'transaction_id'
  @_hash['wallet_id'] = 'wallet_id'
  @_hash['reference'] = 'reference'
  @_hash['type'] = 'type'
  @_hash['scheme'] = 'scheme'
  @_hash['amount'] = 'amount'
  @_hash['counterparty'] = 'counterparty'
  @_hash['status'] = 'status'
  @_hash['created_at'] = 'created_at'
  @_hash['last_status_update'] = 'last_status_update'
  @_hash['payee_verification_status'] = 'payee_verification_status'
  @_hash['payment_id'] = 'payment_id'
  @_hash['failure_reason'] = 'failure_reason'
  @_hash['error'] = 'error'
  @_hash['related_transactions'] = 'related_transactions'
  @_hash['request_id'] = 'request_id'
  @_hash
end

.nullablesObject

An array for nullable fields



184
185
186
187
188
189
190
191
192
# File 'lib/the_plaid_api/models/wallet_transaction_get_response.rb', line 184

def self.nullables
  %w[
    scheme
    payee_verification_status
    payment_id
    failure_reason
    error
  ]
end

.optionalsObject

An array for optional fields



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

def self.optionals
  %w[
    scheme
    payee_verification_status
    payment_id
    failure_reason
    error
    related_transactions
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



311
312
313
314
315
316
317
318
319
320
321
322
# File 'lib/the_plaid_api/models/wallet_transaction_get_response.rb', line 311

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} transaction_id: #{@transaction_id.inspect}, wallet_id:"\
  " #{@wallet_id.inspect}, reference: #{@reference.inspect}, type: #{@type.inspect}, scheme:"\
  " #{@scheme.inspect}, amount: #{@amount.inspect}, counterparty: #{@counterparty.inspect},"\
  " status: #{@status.inspect}, created_at: #{@created_at.inspect}, last_status_update:"\
  " #{@last_status_update.inspect}, payee_verification_status:"\
  " #{@payee_verification_status.inspect}, payment_id: #{@payment_id.inspect}, failure_reason:"\
  " #{@failure_reason.inspect}, error: #{@error.inspect}, related_transactions:"\
  " #{@related_transactions.inspect}, request_id: #{@request_id.inspect},"\
  " additional_properties: #{@additional_properties}>"
end

#to_custom_created_atObject



290
291
292
# File 'lib/the_plaid_api/models/wallet_transaction_get_response.rb', line 290

def to_custom_created_at
  DateTimeHelper.to_rfc3339(created_at)
end

#to_custom_last_status_updateObject



294
295
296
# File 'lib/the_plaid_api/models/wallet_transaction_get_response.rb', line 294

def to_custom_last_status_update
  DateTimeHelper.to_rfc3339(last_status_update)
end

#to_sObject

Provides a human-readable string representation of the object.



299
300
301
302
303
304
305
306
307
308
# File 'lib/the_plaid_api/models/wallet_transaction_get_response.rb', line 299

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} transaction_id: #{@transaction_id}, wallet_id: #{@wallet_id}, reference:"\
  " #{@reference}, type: #{@type}, scheme: #{@scheme}, amount: #{@amount}, counterparty:"\
  " #{@counterparty}, status: #{@status}, created_at: #{@created_at}, last_status_update:"\
  " #{@last_status_update}, payee_verification_status: #{@payee_verification_status},"\
  " payment_id: #{@payment_id}, failure_reason: #{@failure_reason}, error: #{@error},"\
  " related_transactions: #{@related_transactions}, request_id: #{@request_id},"\
  " additional_properties: #{@additional_properties}>"
end