Class: Plaid::PaymentStatusUpdateWebhook
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- Plaid::PaymentStatusUpdateWebhook
- Defined in:
- lib/plaid/models/payment_status_update_webhook.rb
Overview
Fired when the status of a payment has changed.
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.
-
#error ⇒ Error
We use standard HTTP response codes for success and failure notifications, and our errors are further classified by ‘error_type`.
-
#new_payment_status ⇒ NewPaymentStatus
The new status of the payment.
-
#old_payment_status ⇒ OldPaymentStatus
The previous 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.
-
#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:, 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:, adjusted_reference: SKIP, error: SKIP, additional_properties: nil) ⇒ PaymentStatusUpdateWebhook
Returns a new instance of PaymentStatusUpdateWebhook.
138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 |
# File 'lib/plaid/models/payment_status_update_webhook.rb', line 138 def initialize(webhook_type:, webhook_code:, payment_id:, new_payment_status:, old_payment_status:, original_reference:, original_start_date:, adjusted_start_date:, timestamp:, 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 @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 @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.
74 75 76 |
# File 'lib/plaid/models/payment_status_update_webhook.rb', line 74 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`.
87 88 89 |
# File 'lib/plaid/models/payment_status_update_webhook.rb', line 87 def adjusted_start_date @adjusted_start_date end |
#error ⇒ Error
We use standard HTTP response codes for success and failure notifications, and our errors are further classified by ‘error_type`. In general, 200 HTTP codes correspond to success, 40X codes are for developer- or user-related failures, and 50X codes are for Plaid-related issues. Error fields will be `null` if no error has occurred.
101 102 103 |
# File 'lib/plaid/models/payment_status_update_webhook.rb', line 101 def error @error end |
#new_payment_status ⇒ NewPaymentStatus
The new status of the payment. ‘PAYMENT_STATUS_INPUT_NEEDED`: This is the initial state of all payments. It indicates that the payment is waiting on user input to continue processing. A payment may re-enter this state later on if further input is needed. `PAYMENT_STATUS_PROCESSING`: The payment is currently being processed. The payment will automatically exit this state when processing is complete. `PAYMENT_STATUS_INITIATED`: The payment has been successfully initiated and is considered complete. `PAYMENT_STATUS_COMPLETED`: Indicates that the standing order has been successfully established. This state is only used for standing orders. `PAYMENT_STATUS_INSUFFICIENT_FUNDS`: The payment has failed due to insufficient funds. `PAYMENT_STATUS_FAILED`: The payment has failed to be initiated. This error is retryable once the root cause is resolved. `PAYMENT_STATUS_BLOCKED`: The payment has been blocked. This is a retryable error. `PAYMENT_STATUS_UNKNOWN`: The payment status is unknown.
44 45 46 |
# File 'lib/plaid/models/payment_status_update_webhook.rb', line 44 def new_payment_status @new_payment_status end |
#old_payment_status ⇒ OldPaymentStatus
The previous status of the payment. ‘PAYMENT_STATUS_INPUT_NEEDED`: This is the initial state of all payments. It indicates that the payment is waiting on user input to continue processing. A payment may re-enter this state later on if further input is needed. `PAYMENT_STATUS_PROCESSING`: The payment is currently being processed. The payment will automatically exit this state when processing is complete. `PAYMENT_STATUS_INITIATED`: The payment has been successfully initiated and is considered complete. `PAYMENT_STATUS_COMPLETED`: Indicates that the standing order has been successfully established. This state is only used for standing orders. `PAYMENT_STATUS_INSUFFICIENT_FUNDS`: The payment has failed due to insufficient funds. `PAYMENT_STATUS_FAILED`: The payment has failed to be initiated. This error is retryable once the root cause is resolved. `PAYMENT_STATUS_BLOCKED`: The payment has been blocked. This is a retryable error. `PAYMENT_STATUS_UNKNOWN`: The payment status is unknown.
65 66 67 |
# File 'lib/plaid/models/payment_status_update_webhook.rb', line 65 def old_payment_status @old_payment_status end |
#original_reference ⇒ String
The original value of the reference when creating the payment.
69 70 71 |
# File 'lib/plaid/models/payment_status_update_webhook.rb', line 69 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`.
80 81 82 |
# File 'lib/plaid/models/payment_status_update_webhook.rb', line 80 def original_start_date @original_start_date end |
#payment_id ⇒ String
The ‘payment_id` for the payment being updated
23 24 25 |
# File 'lib/plaid/models/payment_status_update_webhook.rb', line 23 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”`
93 94 95 |
# File 'lib/plaid/models/payment_status_update_webhook.rb', line 93 def @timestamp end |
#webhook_code ⇒ String
‘PAYMENT_STATUS_UPDATE`
19 20 21 |
# File 'lib/plaid/models/payment_status_update_webhook.rb', line 19 def webhook_code @webhook_code end |
#webhook_type ⇒ String
‘PAYMENT_INITIATION`
15 16 17 |
# File 'lib/plaid/models/payment_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.
161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 |
# File 'lib/plaid/models/payment_status_update_webhook.rb', line 161 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 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: , adjusted_reference: adjusted_reference, error: error, additional_properties: additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 |
# File 'lib/plaid/models/payment_status_update_webhook.rb', line 104 def self.names @_hash = {} if @_hash.nil? @_hash['webhook_type'] = 'webhook_type' @_hash['webhook_code'] = 'webhook_code' @_hash['payment_id'] = 'payment_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 end |
.nullables ⇒ Object
An array for nullable fields
129 130 131 132 133 134 135 136 |
# File 'lib/plaid/models/payment_status_update_webhook.rb', line 129 def self.nullables %w[ original_reference adjusted_reference original_start_date adjusted_start_date ] end |
.optionals ⇒ Object
An array for optional fields
121 122 123 124 125 126 |
# File 'lib/plaid/models/payment_status_update_webhook.rb', line 121 def self.optionals %w[ adjusted_reference error ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
223 224 225 226 227 228 229 230 231 232 |
# File 'lib/plaid/models/payment_status_update_webhook.rb', line 223 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}, 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}, additional_properties: #{@additional_properties}>" end |
#to_custom_timestamp ⇒ Object
207 208 209 |
# File 'lib/plaid/models/payment_status_update_webhook.rb', line 207 def DateTimeHelper.to_rfc3339() end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
212 213 214 215 216 217 218 219 220 |
# File 'lib/plaid/models/payment_status_update_webhook.rb', line 212 def to_s class_name = self.class.name.split('::').last "<#{class_name} 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}, adjusted_reference:"\ " #{@adjusted_reference}, original_start_date: #{@original_start_date}, adjusted_start_date:"\ " #{@adjusted_start_date}, timestamp: #{@timestamp}, error: #{@error},"\ " additional_properties: #{@additional_properties}>" end |