Class: ThePlaidApi::PaymentInitiationPaymentGetResponse

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

Overview

PaymentInitiationPaymentGetResponse defines the response schema for ‘/payment_initation/payment/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(payment_id:, amount:, status:, recipient_id:, reference:, last_status_update:, bacs:, iban:, request_id:, adjusted_reference: SKIP, schedule: SKIP, refund_details: SKIP, refund_ids: SKIP, amount_refunded: SKIP, wallet_id: SKIP, scheme: SKIP, adjusted_scheme: SKIP, consent_id: SKIP, transaction_id: SKIP, end_to_end_id: SKIP, error: SKIP, additional_properties: nil) ⇒ PaymentInitiationPaymentGetResponse

Returns a new instance of PaymentInitiationPaymentGetResponse.



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

def initialize(payment_id:, amount:, status:, recipient_id:, reference:,
               last_status_update:, bacs:, iban:, request_id:,
               adjusted_reference: SKIP, schedule: SKIP,
               refund_details: SKIP, refund_ids: SKIP,
               amount_refunded: SKIP, wallet_id: SKIP, scheme: SKIP,
               adjusted_scheme: SKIP, consent_id: SKIP,
               transaction_id: SKIP, end_to_end_id: SKIP, error: SKIP,
               additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @payment_id = payment_id
  @amount = amount
  @status = status
  @recipient_id = recipient_id
  @reference = reference
  @adjusted_reference = adjusted_reference unless adjusted_reference == SKIP
  @last_status_update = last_status_update
  @schedule = schedule unless schedule == SKIP
  @refund_details = refund_details unless refund_details == SKIP
  @bacs = bacs
  @iban = iban
  @refund_ids = refund_ids unless refund_ids == SKIP
  @amount_refunded = amount_refunded unless amount_refunded == SKIP
  @wallet_id = wallet_id unless wallet_id == SKIP
  @scheme = scheme unless scheme == SKIP
  @adjusted_scheme = adjusted_scheme unless adjusted_scheme == SKIP
  @consent_id = consent_id unless consent_id == SKIP
  @transaction_id = transaction_id unless transaction_id == SKIP
  @end_to_end_id = end_to_end_id unless end_to_end_id == SKIP
  @error = error unless error == SKIP
  @request_id = request_id
  @additional_properties = additional_properties
end

Instance Attribute Details

#adjusted_referenceString

The value of the reference sent to the bank after adjustment to pass bank validation rules.

Returns:

  • (String)


87
88
89
# File 'lib/the_plaid_api/models/payment_initiation_payment_get_response.rb', line 87

def adjusted_reference
  @adjusted_reference
end

#adjusted_schemePaymentScheme

Payment scheme. If not specified - the default in the region will be used (e.g. ‘SEPA_CREDIT_TRANSFER` for EU). In responses, if the scheme is not explicitly specified in the request, this value will be `null`. Using unsupported values will result in a failed payment. `LOCAL_DEFAULT`: The default payment scheme for the selected market and currency will be used. `LOCAL_INSTANT`: The instant payment scheme for the selected market and currency will be used (if applicable). Fees may be applied by the institution. `SEPA_CREDIT_TRANSFER`: The standard payment to a beneficiary within the SEPA area. `SEPA_CREDIT_TRANSFER_INSTANT`: Instant payment within the SEPA area. May involve additional fees and may not be available at some banks.

Returns:



159
160
161
# File 'lib/the_plaid_api/models/payment_initiation_payment_get_response.rb', line 159

def adjusted_scheme
  @adjusted_scheme
end

#amountPaymentAmount

The amount and currency of a payment

Returns:



21
22
23
# File 'lib/the_plaid_api/models/payment_initiation_payment_get_response.rb', line 21

def amount
  @amount
end

#amount_refundedPaymentAmountRefunded

The amount and currency of a payment



121
122
123
# File 'lib/the_plaid_api/models/payment_initiation_payment_get_response.rb', line 121

def amount_refunded
  @amount_refunded
end

#bacsSenderBacsNullable

An object containing a BACS account number and sort code. If an IBAN is not provided or if this recipient needs to accept domestic GBP-denominated payments, BACS data is required.

Returns:



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

def bacs
  @bacs
end

The payment consent ID that this payment was initiated with. Is present only when payment was initiated using the payment consent.

Returns:

  • (String)


164
165
166
# File 'lib/the_plaid_api/models/payment_initiation_payment_get_response.rb', line 164

def consent_id
  @consent_id
end

#end_to_end_idString

A unique identifier assigned by Plaid to each payment for tracking and reconciliation purposes. Note: Not all banks handle ‘end_to_end_id` consistently. To ensure accurate matching, clients should convert both the incoming `end_to_end_id` and the one provided by Plaid to the same case (either lower or upper) before comparison. For virtual account payments, Plaid manages this field automatically.

Returns:

  • (String)


179
180
181
# File 'lib/the_plaid_api/models/payment_initiation_payment_get_response.rb', line 179

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



191
192
193
# File 'lib/the_plaid_api/models/payment_initiation_payment_get_response.rb', line 191

def error
  @error
end

#ibanString

The International Bank Account Number (IBAN) for the sender, if specified in the ‘/payment_initiation/payment/create` call.

Returns:

  • (String)


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

def iban
  @iban
end

#last_status_updateDateTime

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

Returns:

  • (DateTime)


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

def last_status_update
  @last_status_update
end

#payment_idString

The ID of the payment. Like all Plaid identifiers, the ‘payment_id` is case sensitive.

Returns:

  • (String)


17
18
19
# File 'lib/the_plaid_api/models/payment_initiation_payment_get_response.rb', line 17

def payment_id
  @payment_id
end

#recipient_idString

The ID of the recipient

Returns:

  • (String)


78
79
80
# File 'lib/the_plaid_api/models/payment_initiation_payment_get_response.rb', line 78

def recipient_id
  @recipient_id
end

#referenceString

A reference for the payment.

Returns:

  • (String)


82
83
84
# File 'lib/the_plaid_api/models/payment_initiation_payment_get_response.rb', line 82

def reference
  @reference
end

#refund_detailsExternalPaymentRefundDetails

Details about external payment refund



102
103
104
# File 'lib/the_plaid_api/models/payment_initiation_payment_get_response.rb', line 102

def refund_details
  @refund_details
end

#refund_idsArray[String]

Refund IDs associated with the payment.

Returns:

  • (Array[String])


117
118
119
# File 'lib/the_plaid_api/models/payment_initiation_payment_get_response.rb', line 117

def refund_ids
  @refund_ids
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)


197
198
199
# File 'lib/the_plaid_api/models/payment_initiation_payment_get_response.rb', line 197

def request_id
  @request_id
end

#scheduleExternalPaymentScheduleGet

The schedule that the payment will be executed on. If a schedule is provided, the payment is automatically set up as a standing order. If no schedule is specified, the payment will be executed only once.



98
99
100
# File 'lib/the_plaid_api/models/payment_initiation_payment_get_response.rb', line 98

def schedule
  @schedule
end

#schemePaymentScheme

Payment scheme. If not specified - the default in the region will be used (e.g. ‘SEPA_CREDIT_TRANSFER` for EU). In responses, if the scheme is not explicitly specified in the request, this value will be `null`. Using unsupported values will result in a failed payment. `LOCAL_DEFAULT`: The default payment scheme for the selected market and currency will be used. `LOCAL_INSTANT`: The instant payment scheme for the selected market and currency will be used (if applicable). Fees may be applied by the institution. `SEPA_CREDIT_TRANSFER`: The standard payment to a beneficiary within the SEPA area. `SEPA_CREDIT_TRANSFER_INSTANT`: Instant payment within the SEPA area. May involve additional fees and may not be available at some banks.

Returns:



143
144
145
# File 'lib/the_plaid_api/models/payment_initiation_payment_get_response.rb', line 143

def scheme
  @scheme
end

#statusPaymentInitiationPaymentStatus

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.



74
75
76
# File 'lib/the_plaid_api/models/payment_initiation_payment_get_response.rb', line 74

def status
  @status
end

#transaction_idString

The transaction ID that this payment is associated with, if any. This is present only when a payment was initiated using virtual accounts.

Returns:

  • (String)


169
170
171
# File 'lib/the_plaid_api/models/payment_initiation_payment_get_response.rb', line 169

def transaction_id
  @transaction_id
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)


127
128
129
# File 'lib/the_plaid_api/models/payment_initiation_payment_get_response.rb', line 127

def wallet_id
  @wallet_id
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
# File 'lib/the_plaid_api/models/payment_initiation_payment_get_response.rb', line 300

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  payment_id = hash.key?('payment_id') ? hash['payment_id'] : nil
  amount = PaymentAmount.from_hash(hash['amount']) if hash['amount']
  status = hash.key?('status') ? hash['status'] : nil
  recipient_id = hash.key?('recipient_id') ? hash['recipient_id'] : nil
  reference = hash.key?('reference') ? hash['reference'] : nil
  last_status_update = if hash.key?('last_status_update')
                         (DateTimeHelper.from_rfc3339(hash['last_status_update']) if hash['last_status_update'])
                       end
  bacs = SenderBacsNullable.from_hash(hash['bacs']) if hash['bacs']
  iban = hash.key?('iban') ? hash['iban'] : nil
  request_id = hash.key?('request_id') ? hash['request_id'] : nil
  adjusted_reference =
    hash.key?('adjusted_reference') ? hash['adjusted_reference'] : SKIP
  schedule = ExternalPaymentScheduleGet.from_hash(hash['schedule']) if hash['schedule']
  refund_details = ExternalPaymentRefundDetails.from_hash(hash['refund_details']) if
    hash['refund_details']
  refund_ids = hash.key?('refund_ids') ? hash['refund_ids'] : SKIP
  amount_refunded = PaymentAmountRefunded.from_hash(hash['amount_refunded']) if
    hash['amount_refunded']
  wallet_id = hash.key?('wallet_id') ? hash['wallet_id'] : SKIP
  scheme = hash.key?('scheme') ? hash['scheme'] : SKIP
  adjusted_scheme =
    hash.key?('adjusted_scheme') ? hash['adjusted_scheme'] : SKIP
  consent_id = hash.key?('consent_id') ? hash['consent_id'] : SKIP
  transaction_id =
    hash.key?('transaction_id') ? hash['transaction_id'] : SKIP
  end_to_end_id = hash.key?('end_to_end_id') ? hash['end_to_end_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.
  PaymentInitiationPaymentGetResponse.new(payment_id: payment_id,
                                          amount: amount,
                                          status: status,
                                          recipient_id: recipient_id,
                                          reference: reference,
                                          last_status_update: last_status_update,
                                          bacs: bacs,
                                          iban: iban,
                                          request_id: request_id,
                                          adjusted_reference: adjusted_reference,
                                          schedule: schedule,
                                          refund_details: refund_details,
                                          refund_ids: refund_ids,
                                          amount_refunded: amount_refunded,
                                          wallet_id: wallet_id,
                                          scheme: scheme,
                                          adjusted_scheme: adjusted_scheme,
                                          consent_id: consent_id,
                                          transaction_id: transaction_id,
                                          end_to_end_id: end_to_end_id,
                                          error: error,
                                          additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
# File 'lib/the_plaid_api/models/payment_initiation_payment_get_response.rb', line 200

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['payment_id'] = 'payment_id'
  @_hash['amount'] = 'amount'
  @_hash['status'] = 'status'
  @_hash['recipient_id'] = 'recipient_id'
  @_hash['reference'] = 'reference'
  @_hash['adjusted_reference'] = 'adjusted_reference'
  @_hash['last_status_update'] = 'last_status_update'
  @_hash['schedule'] = 'schedule'
  @_hash['refund_details'] = 'refund_details'
  @_hash['bacs'] = 'bacs'
  @_hash['iban'] = 'iban'
  @_hash['refund_ids'] = 'refund_ids'
  @_hash['amount_refunded'] = 'amount_refunded'
  @_hash['wallet_id'] = 'wallet_id'
  @_hash['scheme'] = 'scheme'
  @_hash['adjusted_scheme'] = 'adjusted_scheme'
  @_hash['consent_id'] = 'consent_id'
  @_hash['transaction_id'] = 'transaction_id'
  @_hash['end_to_end_id'] = 'end_to_end_id'
  @_hash['error'] = 'error'
  @_hash['request_id'] = 'request_id'
  @_hash
end

.nullablesObject

An array for nullable fields



245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
# File 'lib/the_plaid_api/models/payment_initiation_payment_get_response.rb', line 245

def self.nullables
  %w[
    adjusted_reference
    schedule
    refund_details
    bacs
    iban
    refund_ids
    amount_refunded
    wallet_id
    scheme
    adjusted_scheme
    consent_id
    transaction_id
    end_to_end_id
    error
  ]
end

.optionalsObject

An array for optional fields



227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
# File 'lib/the_plaid_api/models/payment_initiation_payment_get_response.rb', line 227

def self.optionals
  %w[
    adjusted_reference
    schedule
    refund_details
    refund_ids
    amount_refunded
    wallet_id
    scheme
    adjusted_scheme
    consent_id
    transaction_id
    end_to_end_id
    error
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



384
385
386
387
388
389
390
391
392
393
394
395
396
397
# File 'lib/the_plaid_api/models/payment_initiation_payment_get_response.rb', line 384

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} payment_id: #{@payment_id.inspect}, amount: #{@amount.inspect}, status:"\
  " #{@status.inspect}, recipient_id: #{@recipient_id.inspect}, reference:"\
  " #{@reference.inspect}, adjusted_reference: #{@adjusted_reference.inspect},"\
  " last_status_update: #{@last_status_update.inspect}, schedule: #{@schedule.inspect},"\
  " refund_details: #{@refund_details.inspect}, bacs: #{@bacs.inspect}, iban:"\
  " #{@iban.inspect}, refund_ids: #{@refund_ids.inspect}, amount_refunded:"\
  " #{@amount_refunded.inspect}, wallet_id: #{@wallet_id.inspect}, scheme: #{@scheme.inspect},"\
  " adjusted_scheme: #{@adjusted_scheme.inspect}, consent_id: #{@consent_id.inspect},"\
  " transaction_id: #{@transaction_id.inspect}, end_to_end_id: #{@end_to_end_id.inspect},"\
  " error: #{@error.inspect}, request_id: #{@request_id.inspect}, additional_properties:"\
  " #{@additional_properties}>"
end

#to_custom_last_status_updateObject



365
366
367
# File 'lib/the_plaid_api/models/payment_initiation_payment_get_response.rb', line 365

def to_custom_last_status_update
  DateTimeHelper.to_rfc3339(last_status_update)
end

#to_sObject

Provides a human-readable string representation of the object.



370
371
372
373
374
375
376
377
378
379
380
381
# File 'lib/the_plaid_api/models/payment_initiation_payment_get_response.rb', line 370

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} payment_id: #{@payment_id}, amount: #{@amount}, status: #{@status},"\
  " recipient_id: #{@recipient_id}, reference: #{@reference}, adjusted_reference:"\
  " #{@adjusted_reference}, last_status_update: #{@last_status_update}, schedule:"\
  " #{@schedule}, refund_details: #{@refund_details}, bacs: #{@bacs}, iban: #{@iban},"\
  " refund_ids: #{@refund_ids}, amount_refunded: #{@amount_refunded}, wallet_id:"\
  " #{@wallet_id}, scheme: #{@scheme}, adjusted_scheme: #{@adjusted_scheme}, consent_id:"\
  " #{@consent_id}, transaction_id: #{@transaction_id}, end_to_end_id: #{@end_to_end_id},"\
  " error: #{@error}, request_id: #{@request_id}, additional_properties:"\
  " #{@additional_properties}>"
end