Class: ThePlaidApi::PaymentInitiationConsentPaymentExecuteRequest

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

Overview

PaymentInitiationConsentPaymentExecuteRequest defines the request schema for ‘/payment_initiation/consent/payment/execute`

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(consent_id:, amount:, idempotency_key:, client_id: SKIP, secret: SKIP, reference: SKIP, scope: SKIP, processing_mode: SKIP, additional_properties: nil) ⇒ PaymentInitiationConsentPaymentExecuteRequest

Returns a new instance of PaymentInitiationConsentPaymentExecuteRequest.



121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
# File 'lib/the_plaid_api/models/payment_initiation_consent_payment_execute_request.rb', line 121

def initialize(consent_id:, amount:, idempotency_key:, client_id: SKIP,
               secret: SKIP, reference: SKIP, scope: SKIP,
               processing_mode: SKIP, additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @client_id = client_id unless client_id == SKIP
  @secret = secret unless secret == SKIP
  @consent_id = consent_id
  @amount = amount
  @idempotency_key = idempotency_key
  @reference = reference unless reference == SKIP
  @scope = scope unless scope == SKIP
  @processing_mode = processing_mode unless processing_mode == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#amountPaymentAmount

The amount and currency of a payment

Returns:



30
31
32
# File 'lib/the_plaid_api/models/payment_initiation_consent_payment_execute_request.rb', line 30

def amount
  @amount
end

#client_idString

Your Plaid API ‘client_id`. The `client_id` is required and may be provided either in the `PLAID-CLIENT-ID` header or as part of a request body.

Returns:

  • (String)


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

def client_id
  @client_id
end

The consent ID.

Returns:

  • (String)


26
27
28
# File 'lib/the_plaid_api/models/payment_initiation_consent_payment_execute_request.rb', line 26

def consent_id
  @consent_id
end

#idempotency_keyString

A random key provided by the client, per unique consent payment. Maximum of 128 characters. The API supports idempotency for safely retrying requests without accidentally performing the same operation twice. If a request to execute a consent payment fails due to a network connection error, you can retry the request with the same idempotency key to guarantee that only a single payment is created. If the request was successfully processed, it will prevent any payment that uses the same idempotency key, and was received within 48 hours of the first request, from being processed.

Returns:

  • (String)


42
43
44
# File 'lib/the_plaid_api/models/payment_initiation_consent_payment_execute_request.rb', line 42

def idempotency_key
  @idempotency_key
end

#processing_modePaymentInitiationConsentProcessingMode

Decides the mode under which the payment processing should be performed, using ‘IMMEDIATE` as default. `IMMEDIATE`: Will immediately execute the payment, waiting for a response from the ASPSP before returning the result of the payment initiation. This is ideal for user-present flows.

`ASYNC`: Will accept a payment execution request and schedule it for

processing, immediately returning the new ‘payment_id`. Listen for webhooks to obtain real-time updates on the payment status. This is ideal for non user-present flows.



86
87
88
# File 'lib/the_plaid_api/models/payment_initiation_consent_payment_execute_request.rb', line 86

def processing_mode
  @processing_mode
end

#referenceString

A reference for the payment. This must be an alphanumeric string with at most 18 characters and must not contain any special characters (since not all institutions support them). If not provided, Plaid will automatically fall back to the reference from consent. In order to track settlement via Payment Confirmation, each payment must have a unique reference. If the reference provided through the API is not unique, Plaid will adjust it. Some institutions may limit the reference to less than 18 characters. If necessary, Plaid will adjust the reference by truncating it to fit the institution’s requirements. Both the originally provided and automatically adjusted references (if any) can be found in the ‘reference` and `adjusted_reference` fields, respectively.

Returns:

  • (String)


58
59
60
# File 'lib/the_plaid_api/models/payment_initiation_consent_payment_execute_request.rb', line 58

def reference
  @reference
end

#scopePaymentInitiationConsentScope

A reference for the payment. This must be an alphanumeric string with at most 18 characters and must not contain any special characters (since not all institutions support them). If not provided, Plaid will automatically fall back to the reference from consent. In order to track settlement via Payment Confirmation, each payment must have a unique reference. If the reference provided through the API is not unique, Plaid will adjust it. Some institutions may limit the reference to less than 18 characters. If necessary, Plaid will adjust the reference by truncating it to fit the institution’s requirements. Both the originally provided and automatically adjusted references (if any) can be found in the ‘reference` and `adjusted_reference` fields, respectively.



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

def scope
  @scope
end

#secretString

Your Plaid API ‘secret`. The `secret` is required and may be provided either in the `PLAID-SECRET` header or as part of a request body.

Returns:

  • (String)


22
23
24
# File 'lib/the_plaid_api/models/payment_initiation_consent_payment_execute_request.rb', line 22

def secret
  @secret
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



139
140
141
142
143
144
145
146
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
# File 'lib/the_plaid_api/models/payment_initiation_consent_payment_execute_request.rb', line 139

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  consent_id = hash.key?('consent_id') ? hash['consent_id'] : nil
  amount = PaymentAmount.from_hash(hash['amount']) if hash['amount']
  idempotency_key =
    hash.key?('idempotency_key') ? hash['idempotency_key'] : nil
  client_id = hash.key?('client_id') ? hash['client_id'] : SKIP
  secret = hash.key?('secret') ? hash['secret'] : SKIP
  reference = hash.key?('reference') ? hash['reference'] : SKIP
  scope = hash.key?('scope') ? hash['scope'] : SKIP
  processing_mode =
    hash.key?('processing_mode') ? hash['processing_mode'] : 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.
  PaymentInitiationConsentPaymentExecuteRequest.new(consent_id: consent_id,
                                                    amount: amount,
                                                    idempotency_key: idempotency_key,
                                                    client_id: client_id,
                                                    secret: secret,
                                                    reference: reference,
                                                    scope: scope,
                                                    processing_mode: processing_mode,
                                                    additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



89
90
91
92
93
94
95
96
97
98
99
100
# File 'lib/the_plaid_api/models/payment_initiation_consent_payment_execute_request.rb', line 89

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['client_id'] = 'client_id'
  @_hash['secret'] = 'secret'
  @_hash['consent_id'] = 'consent_id'
  @_hash['amount'] = 'amount'
  @_hash['idempotency_key'] = 'idempotency_key'
  @_hash['reference'] = 'reference'
  @_hash['scope'] = 'scope'
  @_hash['processing_mode'] = 'processing_mode'
  @_hash
end

.nullablesObject

An array for nullable fields



114
115
116
117
118
119
# File 'lib/the_plaid_api/models/payment_initiation_consent_payment_execute_request.rb', line 114

def self.nullables
  %w[
    reference
    scope
  ]
end

.optionalsObject

An array for optional fields



103
104
105
106
107
108
109
110
111
# File 'lib/the_plaid_api/models/payment_initiation_consent_payment_execute_request.rb', line 103

def self.optionals
  %w[
    client_id
    secret
    reference
    scope
    processing_mode
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



183
184
185
186
187
188
189
190
# File 'lib/the_plaid_api/models/payment_initiation_consent_payment_execute_request.rb', line 183

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} client_id: #{@client_id.inspect}, secret: #{@secret.inspect}, consent_id:"\
  " #{@consent_id.inspect}, amount: #{@amount.inspect}, idempotency_key:"\
  " #{@idempotency_key.inspect}, reference: #{@reference.inspect}, scope: #{@scope.inspect},"\
  " processing_mode: #{@processing_mode.inspect}, additional_properties:"\
  " #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



174
175
176
177
178
179
180
# File 'lib/the_plaid_api/models/payment_initiation_consent_payment_execute_request.rb', line 174

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} client_id: #{@client_id}, secret: #{@secret}, consent_id: #{@consent_id},"\
  " amount: #{@amount}, idempotency_key: #{@idempotency_key}, reference: #{@reference}, scope:"\
  " #{@scope}, processing_mode: #{@processing_mode}, additional_properties:"\
  " #{@additional_properties}>"
end