Class: ThePlaidApi::PaymentStatusUpdateWebhook
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- ThePlaidApi::PaymentStatusUpdateWebhook
- Defined in:
- lib/the_plaid_api/models/payment_status_update_webhook.rb
Overview
Fired when the status of a payment has changed. For a full explanation of payment statuses and how to handle each, see the [Payment Status guide](plaid.com/docs/payment-initiation/payment-status/). Note: Plaid payment statuses do not constitute proof that funds have arrived in the recipient’s account. Do not use ‘new_payment_status` to confirm fund settlement.
Instance Attribute Summary collapse
-
#adjusted_reference ⇒ String
The value of the reference sent to the bank after adjustment to pass bank validation rules.
-
#adjusted_start_date ⇒ Date
The start date sent to the bank after adjusting for holidays or weekends.
-
#environment ⇒ WebhookEnvironmentValues
The Plaid environment the webhook was sent from.
-
#error ⇒ Error
Errors are identified by ‘error_code` and categorized by `error_type`.
-
#new_payment_status ⇒ PaymentInitiationPaymentStatus
The status of the payment.
-
#old_payment_status ⇒ PaymentInitiationPaymentStatus
The status of the payment.
-
#original_reference ⇒ String
The original value of the reference when creating the payment.
-
#original_start_date ⇒ Date
The original value of the ‘start_date` provided during the creation of a standing order.
-
#payment_id ⇒ String
The ‘payment_id` for the payment being updated.
-
#timestamp ⇒ DateTime
The timestamp of the update, in [ISO 8601](wikipedia.org/wiki/ISO_8601) format, e.g.
-
#transaction_id ⇒ String
The transaction ID that this payment is associated with, if any.
-
#webhook_code ⇒ String
‘PAYMENT_STATUS_UPDATE`.
-
#webhook_type ⇒ String
‘PAYMENT_INITIATION`.
Class Method Summary collapse
-
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
-
.names ⇒ Object
A mapping from model property names to API property names.
-
.nullables ⇒ Object
An array for nullable fields.
-
.optionals ⇒ Object
An array for optional fields.
Instance Method Summary collapse
-
#initialize(webhook_type:, webhook_code:, payment_id:, new_payment_status:, old_payment_status:, original_reference:, original_start_date:, adjusted_start_date:, timestamp:, environment:, transaction_id: SKIP, adjusted_reference: SKIP, error: SKIP, additional_properties: nil) ⇒ PaymentStatusUpdateWebhook
constructor
A new instance of PaymentStatusUpdateWebhook.
-
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
- #to_custom_timestamp ⇒ Object
-
#to_s ⇒ Object
Provides a human-readable string representation of the object.
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:, payment_id:, new_payment_status:, old_payment_status:, original_reference:, original_start_date:, adjusted_start_date:, timestamp:, environment:, transaction_id: SKIP, adjusted_reference: SKIP, error: SKIP, additional_properties: nil) ⇒ PaymentStatusUpdateWebhook
Returns a new instance of PaymentStatusUpdateWebhook.
225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 |
# File 'lib/the_plaid_api/models/payment_status_update_webhook.rb', line 225 def initialize(webhook_type:, webhook_code:, payment_id:, new_payment_status:, old_payment_status:, original_reference:, original_start_date:, adjusted_start_date:, timestamp:, environment:, transaction_id: SKIP, adjusted_reference: 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 @payment_id = payment_id @transaction_id = transaction_id unless transaction_id == SKIP @new_payment_status = new_payment_status @old_payment_status = old_payment_status @original_reference = original_reference @adjusted_reference = adjusted_reference unless adjusted_reference == SKIP @original_start_date = original_start_date @adjusted_start_date = adjusted_start_date @timestamp = @error = error unless error == SKIP @environment = environment @additional_properties = additional_properties end |
Instance Attribute Details
#adjusted_reference ⇒ String
The value of the reference sent to the bank after adjustment to pass bank validation rules.
148 149 150 |
# File 'lib/the_plaid_api/models/payment_status_update_webhook.rb', line 148 def adjusted_reference @adjusted_reference end |
#adjusted_start_date ⇒ Date
The start date sent to the bank after adjusting for holidays or weekends. Will be provided in [ISO 8601](wikipedia.org/wiki/ISO_8601) format (YYYY-MM-DD). If the start date did not require adjustment, or if the payment is not a standing order, this field will be ‘null`.
161 162 163 |
# File 'lib/the_plaid_api/models/payment_status_update_webhook.rb', line 161 def adjusted_start_date @adjusted_start_date end |
#environment ⇒ WebhookEnvironmentValues
The Plaid environment the webhook was sent from
183 184 185 |
# File 'lib/the_plaid_api/models/payment_status_update_webhook.rb', line 183 def environment @environment end |
#error ⇒ Error
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.
179 180 181 |
# File 'lib/the_plaid_api/models/payment_status_update_webhook.rb', line 179 def error @error end |
#new_payment_status ⇒ PaymentInitiationPaymentStatus
The status of the payment. Core lifecycle statuses: **‘PAYMENT_STATUS_INPUT_NEEDED`**: Transitional. The payment is awaiting user input to continue processing. It may re-enter this state if additional input is required. **`PAYMENT_STATUS_AUTHORISING`:** Transitional. The payment is being authorised by the financial institution. It will automatically move on once authorisation completes. **`PAYMENT_STATUS_INITIATED`:** The payment has been authorised and accepted by the financial institution. In many EU markets, `PAYMENT_STATUS_EXECUTED` is not supported, and a payment will remain in `PAYMENT_STATUS_INITIATED` until the funds settle, making this a terminal success state in those cases. A payment in `PAYMENT_STATUS_INITIATED` should be treated as a successfully submitted payment; do not gate downstream processing on reaching `PAYMENT_STATUS_EXECUTED`. For a full explanation of payment statuses and how to handle each, see the [Payment Status guide](plaid.com/docs/payment-initiation/payment-status/). **`PAYMENT_STATUS_EXECUTED`: Terminal.** The funds have left the payer’s account and the payment is en route to settlement. Note that this status does not confirm that funds have arrived in the recipient’s account; do not use it as proof of fund receipt. Support is more common in the UK than in the EU; where unsupported, a successful payment remains in `PAYMENT_STATUS_INITIATED` before settling. When using Plaid Virtual Accounts, `PAYMENT_STATUS_EXECUTED` is not terminal—the payment will continue to `PAYMENT_STATUS_SETTLED` once funds are available. **`PAYMENT_STATUS_SETTLED`: Terminal.** The funds are available in the recipient’s account. Only available to customers using [Plaid Virtual Accounts](plaid.com/docs/payment-initiation/virtual-accounts/). Failure statuses: **`PAYMENT_STATUS_INSUFFICIENT_FUNDS`: Terminal.** The payment failed due to insufficient funds. No further retries will succeed until the payer’s balance is replenished. **`PAYMENT_STATUS_FAILED`: Terminal (retryable).** The payment could not be initiated due to a system error or outage. Retry once the root cause is resolved. **`PAYMENT_STATUS_BLOCKED`: Terminal (retryable).** The payment was blocked by Plaid (e.g., flagged as risky). Resolve any compliance or risk issues and retry. **`PAYMENT_STATUS_REJECTED`: Terminal.** The payment was rejected by the financial institution. No automatic retry is possible. **`PAYMENT_STATUS_CANCELLED`: Terminal.** The end user cancelled the payment during authorisation. Standing-order statuses: **`PAYMENT_STATUS_ESTABLISHED`: Terminal.** A recurring/standing order has been successfully created. Deprecated (to be removed in a future release): `PAYMENT_STATUS_UNKNOWN`: The payment status is unknown. `PAYMENT_STATUS_PROCESSING`: The payment is currently being processed. `PAYMENT_STATUS_COMPLETED`: Indicates that the standing order has been successfully established.
86 87 88 |
# File 'lib/the_plaid_api/models/payment_status_update_webhook.rb', line 86 def new_payment_status @new_payment_status end |
#old_payment_status ⇒ PaymentInitiationPaymentStatus
The status of the payment. Core lifecycle statuses: **‘PAYMENT_STATUS_INPUT_NEEDED`**: Transitional. The payment is awaiting user input to continue processing. It may re-enter this state if additional input is required. **`PAYMENT_STATUS_AUTHORISING`:** Transitional. The payment is being authorised by the financial institution. It will automatically move on once authorisation completes. **`PAYMENT_STATUS_INITIATED`:** The payment has been authorised and accepted by the financial institution. In many EU markets, `PAYMENT_STATUS_EXECUTED` is not supported, and a payment will remain in `PAYMENT_STATUS_INITIATED` until the funds settle, making this a terminal success state in those cases. A payment in `PAYMENT_STATUS_INITIATED` should be treated as a successfully submitted payment; do not gate downstream processing on reaching `PAYMENT_STATUS_EXECUTED`. For a full explanation of payment statuses and how to handle each, see the [Payment Status guide](plaid.com/docs/payment-initiation/payment-status/). **`PAYMENT_STATUS_EXECUTED`: Terminal.** The funds have left the payer’s account and the payment is en route to settlement. Note that this status does not confirm that funds have arrived in the recipient’s account; do not use it as proof of fund receipt. Support is more common in the UK than in the EU; where unsupported, a successful payment remains in `PAYMENT_STATUS_INITIATED` before settling. When using Plaid Virtual Accounts, `PAYMENT_STATUS_EXECUTED` is not terminal—the payment will continue to `PAYMENT_STATUS_SETTLED` once funds are available. **`PAYMENT_STATUS_SETTLED`: Terminal.** The funds are available in the recipient’s account. Only available to customers using [Plaid Virtual Accounts](plaid.com/docs/payment-initiation/virtual-accounts/). Failure statuses: **`PAYMENT_STATUS_INSUFFICIENT_FUNDS`: Terminal.** The payment failed due to insufficient funds. No further retries will succeed until the payer’s balance is replenished. **`PAYMENT_STATUS_FAILED`: Terminal (retryable).** The payment could not be initiated due to a system error or outage. Retry once the root cause is resolved. **`PAYMENT_STATUS_BLOCKED`: Terminal (retryable).** The payment was blocked by Plaid (e.g., flagged as risky). Resolve any compliance or risk issues and retry. **`PAYMENT_STATUS_REJECTED`: Terminal.** The payment was rejected by the financial institution. No automatic retry is possible. **`PAYMENT_STATUS_CANCELLED`: Terminal.** The end user cancelled the payment during authorisation. Standing-order statuses: **`PAYMENT_STATUS_ESTABLISHED`: Terminal.** A recurring/standing order has been successfully created. Deprecated (to be removed in a future release): `PAYMENT_STATUS_UNKNOWN`: The payment status is unknown. `PAYMENT_STATUS_PROCESSING`: The payment is currently being processed. `PAYMENT_STATUS_COMPLETED`: Indicates that the standing order has been successfully established.
139 140 141 |
# File 'lib/the_plaid_api/models/payment_status_update_webhook.rb', line 139 def old_payment_status @old_payment_status end |
#original_reference ⇒ String
The original value of the reference when creating the payment.
143 144 145 |
# File 'lib/the_plaid_api/models/payment_status_update_webhook.rb', line 143 def original_reference @original_reference end |
#original_start_date ⇒ Date
The original value of the ‘start_date` provided during the creation of a standing order. If the payment is not a standing order, this field will be `null`.
154 155 156 |
# File 'lib/the_plaid_api/models/payment_status_update_webhook.rb', line 154 def original_start_date @original_start_date end |
#payment_id ⇒ String
The ‘payment_id` for the payment being updated
28 29 30 |
# File 'lib/the_plaid_api/models/payment_status_update_webhook.rb', line 28 def payment_id @payment_id end |
#timestamp ⇒ DateTime
The timestamp of the update, in [ISO 8601](wikipedia.org/wiki/ISO_8601) format, e.g. ‘“2017-09-14T14:42:19.350Z”`
167 168 169 |
# File 'lib/the_plaid_api/models/payment_status_update_webhook.rb', line 167 def @timestamp end |
#transaction_id ⇒ String
The transaction ID that this payment is associated with, if any. This is present only when a payment was initiated using virtual accounts.
33 34 35 |
# File 'lib/the_plaid_api/models/payment_status_update_webhook.rb', line 33 def transaction_id @transaction_id end |
#webhook_code ⇒ String
‘PAYMENT_STATUS_UPDATE`
24 25 26 |
# File 'lib/the_plaid_api/models/payment_status_update_webhook.rb', line 24 def webhook_code @webhook_code end |
#webhook_type ⇒ String
‘PAYMENT_INITIATION`
20 21 22 |
# File 'lib/the_plaid_api/models/payment_status_update_webhook.rb', line 20 def webhook_type @webhook_type end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
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 289 290 291 292 293 294 295 296 297 298 299 300 |
# File 'lib/the_plaid_api/models/payment_status_update_webhook.rb', line 251 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 payment_id = hash.key?('payment_id') ? hash['payment_id'] : nil new_payment_status = hash.key?('new_payment_status') ? hash['new_payment_status'] : nil old_payment_status = hash.key?('old_payment_status') ? hash['old_payment_status'] : nil original_reference = hash.key?('original_reference') ? hash['original_reference'] : nil original_start_date = hash.key?('original_start_date') ? hash['original_start_date'] : nil adjusted_start_date = hash.key?('adjusted_start_date') ? hash['adjusted_start_date'] : nil = if hash.key?('timestamp') (DateTimeHelper.from_rfc3339(hash['timestamp']) if hash['timestamp']) end environment = hash.key?('environment') ? hash['environment'] : nil transaction_id = hash.key?('transaction_id') ? hash['transaction_id'] : SKIP adjusted_reference = hash.key?('adjusted_reference') ? hash['adjusted_reference'] : 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. PaymentStatusUpdateWebhook.new(webhook_type: webhook_type, webhook_code: webhook_code, payment_id: payment_id, new_payment_status: new_payment_status, old_payment_status: old_payment_status, original_reference: original_reference, original_start_date: original_start_date, adjusted_start_date: adjusted_start_date, timestamp: , environment: environment, transaction_id: transaction_id, adjusted_reference: adjusted_reference, error: error, additional_properties: additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 |
# File 'lib/the_plaid_api/models/payment_status_update_webhook.rb', line 186 def self.names @_hash = {} if @_hash.nil? @_hash['webhook_type'] = 'webhook_type' @_hash['webhook_code'] = 'webhook_code' @_hash['payment_id'] = 'payment_id' @_hash['transaction_id'] = 'transaction_id' @_hash['new_payment_status'] = 'new_payment_status' @_hash['old_payment_status'] = 'old_payment_status' @_hash['original_reference'] = 'original_reference' @_hash['adjusted_reference'] = 'adjusted_reference' @_hash['original_start_date'] = 'original_start_date' @_hash['adjusted_start_date'] = 'adjusted_start_date' @_hash['timestamp'] = 'timestamp' @_hash['error'] = 'error' @_hash['environment'] = 'environment' @_hash end |
.nullables ⇒ Object
An array for nullable fields
214 215 216 217 218 219 220 221 222 223 |
# File 'lib/the_plaid_api/models/payment_status_update_webhook.rb', line 214 def self.nullables %w[ transaction_id original_reference adjusted_reference original_start_date adjusted_start_date error ] end |
.optionals ⇒ Object
An array for optional fields
205 206 207 208 209 210 211 |
# File 'lib/the_plaid_api/models/payment_status_update_webhook.rb', line 205 def self.optionals %w[ transaction_id adjusted_reference error ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
319 320 321 322 323 324 325 326 327 328 329 330 |
# File 'lib/the_plaid_api/models/payment_status_update_webhook.rb', line 319 def inspect class_name = self.class.name.split('::').last "<#{class_name} webhook_type: #{@webhook_type.inspect}, webhook_code:"\ " #{@webhook_code.inspect}, payment_id: #{@payment_id.inspect}, transaction_id:"\ " #{@transaction_id.inspect}, new_payment_status: #{@new_payment_status.inspect},"\ " old_payment_status: #{@old_payment_status.inspect}, original_reference:"\ " #{@original_reference.inspect}, adjusted_reference: #{@adjusted_reference.inspect},"\ " original_start_date: #{@original_start_date.inspect}, adjusted_start_date:"\ " #{@adjusted_start_date.inspect}, timestamp: #{@timestamp.inspect}, error:"\ " #{@error.inspect}, environment: #{@environment.inspect}, additional_properties:"\ " #{@additional_properties}>" end |
#to_custom_timestamp ⇒ Object
302 303 304 |
# File 'lib/the_plaid_api/models/payment_status_update_webhook.rb', line 302 def DateTimeHelper.to_rfc3339() end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
307 308 309 310 311 312 313 314 315 316 |
# File 'lib/the_plaid_api/models/payment_status_update_webhook.rb', line 307 def to_s class_name = self.class.name.split('::').last "<#{class_name} webhook_type: #{@webhook_type}, webhook_code: #{@webhook_code}, payment_id:"\ " #{@payment_id}, transaction_id: #{@transaction_id}, new_payment_status:"\ " #{@new_payment_status}, old_payment_status: #{@old_payment_status}, original_reference:"\ " #{@original_reference}, adjusted_reference: #{@adjusted_reference}, original_start_date:"\ " #{@original_start_date}, adjusted_start_date: #{@adjusted_start_date}, timestamp:"\ " #{@timestamp}, error: #{@error}, environment: #{@environment}, additional_properties:"\ " #{@additional_properties}>" end |