Class: ThePlaidApi::WalletTransactionStatusUpdateWebhook

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

Overview

Fired when the status of a wallet transaction has changed.

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(webhook_type:, webhook_code:, transaction_id:, new_status:, old_status:, timestamp:, environment:, payment_id: SKIP, wallet_id: SKIP, error: SKIP, additional_properties: nil) ⇒ WalletTransactionStatusUpdateWebhook

Returns a new instance of WalletTransactionStatusUpdateWebhook.



127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
# File 'lib/the_plaid_api/models/wallet_transaction_status_update_webhook.rb', line 127

def initialize(webhook_type:, webhook_code:, transaction_id:, new_status:,
               old_status:, timestamp:, environment:, payment_id: SKIP,
               wallet_id: SKIP, error: SKIP, additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @webhook_type = webhook_type
  @webhook_code = webhook_code
  @transaction_id = transaction_id
  @payment_id = payment_id unless payment_id == SKIP
  @wallet_id = wallet_id unless wallet_id == SKIP
  @new_status = new_status
  @old_status = old_status
  @timestamp = timestamp
  @error = error unless error == SKIP
  @environment = environment
  @additional_properties = additional_properties
end

Instance Attribute Details

#environmentWebhookEnvironmentValues

The Plaid environment the webhook was sent from



92
93
94
# File 'lib/the_plaid_api/models/wallet_transaction_status_update_webhook.rb', line 92

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



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

def error
  @error
end

#new_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.



52
53
54
# File 'lib/the_plaid_api/models/wallet_transaction_status_update_webhook.rb', line 52

def new_status
  @new_status
end

#old_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.



70
71
72
# File 'lib/the_plaid_api/models/wallet_transaction_status_update_webhook.rb', line 70

def old_status
  @old_status
end

#payment_idString

The ‘payment_id` associated with the transaction. This will be present in case of `REFUND` and `PIS_PAY_IN`.

Returns:

  • (String)


28
29
30
# File 'lib/the_plaid_api/models/wallet_transaction_status_update_webhook.rb', line 28

def payment_id
  @payment_id
end

#timestampDateTime

The timestamp of the update, in [ISO 8601](wikipedia.org/wiki/ISO_8601) format, e.g. ‘“2017-09-14T14:42:19.350Z”`

Returns:

  • (DateTime)


76
77
78
# File 'lib/the_plaid_api/models/wallet_transaction_status_update_webhook.rb', line 76

def timestamp
  @timestamp
end

#transaction_idString

The ‘transaction_id` for the wallet transaction being updated

Returns:

  • (String)


23
24
25
# File 'lib/the_plaid_api/models/wallet_transaction_status_update_webhook.rb', line 23

def transaction_id
  @transaction_id
end

#wallet_idString

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

Returns:

  • (String)


34
35
36
# File 'lib/the_plaid_api/models/wallet_transaction_status_update_webhook.rb', line 34

def wallet_id
  @wallet_id
end

#webhook_codeString

‘WALLET_TRANSACTION_STATUS_UPDATE`

Returns:

  • (String)


19
20
21
# File 'lib/the_plaid_api/models/wallet_transaction_status_update_webhook.rb', line 19

def webhook_code
  @webhook_code
end

#webhook_typeString

‘WALLET`

Returns:

  • (String)


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

def webhook_type
  @webhook_type
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



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
175
176
177
178
179
180
181
182
183
184
# File 'lib/the_plaid_api/models/wallet_transaction_status_update_webhook.rb', line 147

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  webhook_type = hash.key?('webhook_type') ? hash['webhook_type'] : nil
  webhook_code = hash.key?('webhook_code') ? hash['webhook_code'] : nil
  transaction_id =
    hash.key?('transaction_id') ? hash['transaction_id'] : nil
  new_status = hash.key?('new_status') ? hash['new_status'] : nil
  old_status = hash.key?('old_status') ? hash['old_status'] : nil
  timestamp = if hash.key?('timestamp')
                (DateTimeHelper.from_rfc3339(hash['timestamp']) if hash['timestamp'])
              end
  environment = hash.key?('environment') ? hash['environment'] : nil
  payment_id = hash.key?('payment_id') ? hash['payment_id'] : SKIP
  wallet_id = hash.key?('wallet_id') ? hash['wallet_id'] : SKIP
  error = Error.from_hash(hash['error']) if hash['error']

  # 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.
  WalletTransactionStatusUpdateWebhook.new(webhook_type: webhook_type,
                                           webhook_code: webhook_code,
                                           transaction_id: transaction_id,
                                           new_status: new_status,
                                           old_status: old_status,
                                           timestamp: timestamp,
                                           environment: environment,
                                           payment_id: payment_id,
                                           wallet_id: wallet_id,
                                           error: error,
                                           additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



95
96
97
98
99
100
101
102
103
104
105
106
107
108
# File 'lib/the_plaid_api/models/wallet_transaction_status_update_webhook.rb', line 95

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['webhook_type'] = 'webhook_type'
  @_hash['webhook_code'] = 'webhook_code'
  @_hash['transaction_id'] = 'transaction_id'
  @_hash['payment_id'] = 'payment_id'
  @_hash['wallet_id'] = 'wallet_id'
  @_hash['new_status'] = 'new_status'
  @_hash['old_status'] = 'old_status'
  @_hash['timestamp'] = 'timestamp'
  @_hash['error'] = 'error'
  @_hash['environment'] = 'environment'
  @_hash
end

.nullablesObject

An array for nullable fields



120
121
122
123
124
125
# File 'lib/the_plaid_api/models/wallet_transaction_status_update_webhook.rb', line 120

def self.nullables
  %w[
    payment_id
    error
  ]
end

.optionalsObject

An array for optional fields



111
112
113
114
115
116
117
# File 'lib/the_plaid_api/models/wallet_transaction_status_update_webhook.rb', line 111

def self.optionals
  %w[
    payment_id
    wallet_id
    error
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



201
202
203
204
205
206
207
208
209
# File 'lib/the_plaid_api/models/wallet_transaction_status_update_webhook.rb', line 201

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} webhook_type: #{@webhook_type.inspect}, webhook_code:"\
  " #{@webhook_code.inspect}, transaction_id: #{@transaction_id.inspect}, payment_id:"\
  " #{@payment_id.inspect}, wallet_id: #{@wallet_id.inspect}, new_status:"\
  " #{@new_status.inspect}, old_status: #{@old_status.inspect}, timestamp:"\
  " #{@timestamp.inspect}, error: #{@error.inspect}, environment: #{@environment.inspect},"\
  " additional_properties: #{@additional_properties}>"
end

#to_custom_timestampObject



186
187
188
# File 'lib/the_plaid_api/models/wallet_transaction_status_update_webhook.rb', line 186

def to_custom_timestamp
  DateTimeHelper.to_rfc3339(timestamp)
end

#to_sObject

Provides a human-readable string representation of the object.



191
192
193
194
195
196
197
198
# File 'lib/the_plaid_api/models/wallet_transaction_status_update_webhook.rb', line 191

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} webhook_type: #{@webhook_type}, webhook_code: #{@webhook_code},"\
  " transaction_id: #{@transaction_id}, payment_id: #{@payment_id}, wallet_id: #{@wallet_id},"\
  " new_status: #{@new_status}, old_status: #{@old_status}, timestamp: #{@timestamp}, error:"\
  " #{@error}, environment: #{@environment}, additional_properties:"\
  " #{@additional_properties}>"
end