Class: Plaid::PaymentInitiationPayment
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- Plaid::PaymentInitiationPayment
- Defined in:
- lib/plaid/models/payment_initiation_payment.rb
Overview
PaymentInitiationPayment defines a payment initiation payment
Instance Attribute Summary collapse
-
#adjusted_reference ⇒ String
The value of the reference sent to the bank after adjustment to pass bank validation rules.
-
#amount ⇒ PaymentAmount
The amount and currency of a payment.
-
#bacs ⇒ SenderBacsNullable
The schedule that the payment will be executed on.
-
#emi_account_id ⇒ String
The EMI (E-Money Institution) account that this payment is associated with, if any.
-
#iban ⇒ String
The International Bank Account Number (IBAN) for the sender, if specified in the ‘/payment_initiation/payment/create` call.
-
#initiated_refunds ⇒ Array[PaymentInitiationRefund]
Initiated refunds associated with the payment.
-
#last_status_update ⇒ DateTime
The date and time of the last time the ‘status` was updated, in IS0 8601 format.
-
#payment_id ⇒ String
The ID of the payment.
-
#recipient_id ⇒ String
The ID of the recipient.
-
#reference ⇒ String
A reference for the payment.
-
#refund_details ⇒ ExternalPaymentRefundDetails
The schedule that the payment will be executed on.
-
#schedule ⇒ ExternalPaymentScheduleGet
The schedule that the payment will be executed on.
-
#status ⇒ Status3
The status of the payment.
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(payment_id:, amount:, status:, recipient_id:, reference:, last_status_update:, bacs:, iban:, adjusted_reference: SKIP, schedule: SKIP, refund_details: SKIP, initiated_refunds: SKIP, emi_account_id: SKIP, additional_properties: nil) ⇒ PaymentInitiationPayment
constructor
A new instance of PaymentInitiationPayment.
-
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
- #to_custom_last_status_update ⇒ 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(payment_id:, amount:, status:, recipient_id:, reference:, last_status_update:, bacs:, iban:, adjusted_reference: SKIP, schedule: SKIP, refund_details: SKIP, initiated_refunds: SKIP, emi_account_id: SKIP, additional_properties: nil) ⇒ PaymentInitiationPayment
Returns a new instance of PaymentInitiationPayment.
134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 |
# File 'lib/plaid/models/payment_initiation_payment.rb', line 134 def initialize(payment_id:, amount:, status:, recipient_id:, reference:, last_status_update:, bacs:, iban:, adjusted_reference: SKIP, schedule: SKIP, refund_details: SKIP, initiated_refunds: SKIP, emi_account_id: 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 @initiated_refunds = initiated_refunds unless initiated_refunds == SKIP @emi_account_id = emi_account_id unless emi_account_id == 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.
54 55 56 |
# File 'lib/plaid/models/payment_initiation_payment.rb', line 54 def adjusted_reference @adjusted_reference end |
#amount ⇒ PaymentAmount
The amount and currency of a payment
20 21 22 |
# File 'lib/plaid/models/payment_initiation_payment.rb', line 20 def amount @amount end |
#bacs ⇒ SenderBacsNullable
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.
77 78 79 |
# File 'lib/plaid/models/payment_initiation_payment.rb', line 77 def bacs @bacs end |
#emi_account_id ⇒ String
The EMI (E-Money Institution) account that this payment is associated with, if any. This EMI account is used as an intermediary account to enable Plaid to reconcile the settlement of funds for Payment Initiation requests.
93 94 95 |
# File 'lib/plaid/models/payment_initiation_payment.rb', line 93 def emi_account_id @emi_account_id end |
#iban ⇒ String
The International Bank Account Number (IBAN) for the sender, if specified in the ‘/payment_initiation/payment/create` call.
82 83 84 |
# File 'lib/plaid/models/payment_initiation_payment.rb', line 82 def iban @iban end |
#initiated_refunds ⇒ Array[PaymentInitiationRefund]
Initiated refunds associated with the payment.
86 87 88 |
# File 'lib/plaid/models/payment_initiation_payment.rb', line 86 def initiated_refunds @initiated_refunds end |
#last_status_update ⇒ DateTime
The date and time of the last time the ‘status` was updated, in IS0 8601 format
59 60 61 |
# File 'lib/plaid/models/payment_initiation_payment.rb', line 59 def last_status_update @last_status_update end |
#payment_id ⇒ String
The ID of the payment. Like all Plaid identifiers, the ‘payment_id` is case sensitive.
16 17 18 |
# File 'lib/plaid/models/payment_initiation_payment.rb', line 16 def payment_id @payment_id end |
#recipient_id ⇒ String
The ID of the recipient
45 46 47 |
# File 'lib/plaid/models/payment_initiation_payment.rb', line 45 def recipient_id @recipient_id end |
#reference ⇒ String
A reference for the payment.
49 50 51 |
# File 'lib/plaid/models/payment_initiation_payment.rb', line 49 def reference @reference end |
#refund_details ⇒ ExternalPaymentRefundDetails
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.
71 72 73 |
# File 'lib/plaid/models/payment_initiation_payment.rb', line 71 def refund_details @refund_details end |
#schedule ⇒ ExternalPaymentScheduleGet
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.
65 66 67 |
# File 'lib/plaid/models/payment_initiation_payment.rb', line 65 def schedule @schedule end |
#status ⇒ Status3
The 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.
41 42 43 |
# File 'lib/plaid/models/payment_initiation_payment.rb', line 41 def status @status end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
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 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 |
# File 'lib/plaid/models/payment_initiation_payment.rb', line 159 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 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'] # Parameter is an array, so we need to iterate through it initiated_refunds = nil unless hash['initiated_refunds'].nil? initiated_refunds = [] hash['initiated_refunds'].each do |structure| initiated_refunds << (PaymentInitiationRefund.from_hash(structure) if structure) end end initiated_refunds = SKIP unless hash.key?('initiated_refunds') emi_account_id = hash.key?('emi_account_id') ? hash['emi_account_id'] : SKIP # 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. PaymentInitiationPayment.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, adjusted_reference: adjusted_reference, schedule: schedule, refund_details: refund_details, initiated_refunds: initiated_refunds, emi_account_id: emi_account_id, additional_properties: additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 |
# File 'lib/plaid/models/payment_initiation_payment.rb', line 96 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['initiated_refunds'] = 'initiated_refunds' @_hash['emi_account_id'] = 'emi_account_id' @_hash end |
.nullables ⇒ Object
An array for nullable fields
126 127 128 129 130 131 132 |
# File 'lib/plaid/models/payment_initiation_payment.rb', line 126 def self.nullables %w[ adjusted_reference iban emi_account_id ] end |
.optionals ⇒ Object
An array for optional fields
115 116 117 118 119 120 121 122 123 |
# File 'lib/plaid/models/payment_initiation_payment.rb', line 115 def self.optionals %w[ adjusted_reference schedule refund_details initiated_refunds emi_account_id ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
231 232 233 234 235 236 237 238 239 240 |
# File 'lib/plaid/models/payment_initiation_payment.rb', line 231 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}, initiated_refunds: #{@initiated_refunds.inspect}, emi_account_id:"\ " #{@emi_account_id.inspect}, additional_properties: #{@additional_properties}>" end |
#to_custom_last_status_update ⇒ Object
215 216 217 |
# File 'lib/plaid/models/payment_initiation_payment.rb', line 215 def to_custom_last_status_update DateTimeHelper.to_rfc3339(last_status_update) end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
220 221 222 223 224 225 226 227 228 |
# File 'lib/plaid/models/payment_initiation_payment.rb', line 220 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},"\ " initiated_refunds: #{@initiated_refunds}, emi_account_id: #{@emi_account_id},"\ " additional_properties: #{@additional_properties}>" end |