Class: ThePlaidApi::PaymentInitiationConsentCreateRequest

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

Overview

PaymentInitiationConsentCreateRequest defines the request schema for ‘/payment_initiation/consent/create`

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(recipient_id:, reference:, constraints:, client_id: SKIP, secret: SKIP, scopes: SKIP, type: SKIP, options: SKIP, payer_details: SKIP, additional_properties: nil) ⇒ PaymentInitiationConsentCreateRequest

Returns a new instance of PaymentInitiationConsentCreateRequest.



97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
# File 'lib/the_plaid_api/models/payment_initiation_consent_create_request.rb', line 97

def initialize(recipient_id:, reference:, constraints:, client_id: SKIP,
               secret: SKIP, scopes: SKIP, type: SKIP, options: SKIP,
               payer_details: 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
  @recipient_id = recipient_id
  @reference = reference
  @scopes = scopes unless scopes == SKIP
  @type = type unless type == SKIP
  @constraints = constraints
  @options = options unless options == SKIP
  @payer_details = payer_details unless payer_details == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#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_create_request.rb', line 17

def client_id
  @client_id
end

#constraintsPaymentInitiationConsentConstraints

Limitations that will be applied to payments initiated using the payment consent.



49
50
51
# File 'lib/the_plaid_api/models/payment_initiation_consent_create_request.rb', line 49

def constraints
  @constraints
end

#optionsExternalPaymentInitiationConsentOptions

(Deprecated) Additional payment consent options. Please use ‘payer_details` to specify the account.



54
55
56
# File 'lib/the_plaid_api/models/payment_initiation_consent_create_request.rb', line 54

def options
  @options
end

#payer_detailsPaymentInitiationConsentPayerDetails

An object representing the payment consent payer details. Payer ‘name` and account `numbers` are required to lock the account to which the consent can be created.



60
61
62
# File 'lib/the_plaid_api/models/payment_initiation_consent_create_request.rb', line 60

def payer_details
  @payer_details
end

#recipient_idString

The ID of the recipient the payment consent is for. The created consent can be used to transfer funds to this recipient only.

Returns:

  • (String)


27
28
29
# File 'lib/the_plaid_api/models/payment_initiation_consent_create_request.rb', line 27

def recipient_id
  @recipient_id
end

#referenceString

A reference for the payment consent. This must be an alphanumeric string with at most 18 characters and must not contain any special characters.

Returns:

  • (String)


32
33
34
# File 'lib/the_plaid_api/models/payment_initiation_consent_create_request.rb', line 32

def reference
  @reference
end

#scopesArray[PaymentInitiationConsentScope]

An array of payment consent scopes.

Returns:



36
37
38
# File 'lib/the_plaid_api/models/payment_initiation_consent_create_request.rb', line 36

def scopes
  @scopes
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_create_request.rb', line 22

def secret
  @secret
end

#typePaymentInitiationConsentType

Payment consent type. Defines possible use case for payments made with the given consent. ‘SWEEPING`: Allows moving money between accounts owned by the same user. `COMMERCIAL`: Allows initiating payments from the user’s account to third parties.



44
45
46
# File 'lib/the_plaid_api/models/payment_initiation_consent_create_request.rb', line 44

def type
  @type
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
# File 'lib/the_plaid_api/models/payment_initiation_consent_create_request.rb', line 116

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  recipient_id = hash.key?('recipient_id') ? hash['recipient_id'] : nil
  reference = hash.key?('reference') ? hash['reference'] : nil
  constraints = PaymentInitiationConsentConstraints.from_hash(hash['constraints']) if
    hash['constraints']
  client_id = hash.key?('client_id') ? hash['client_id'] : SKIP
  secret = hash.key?('secret') ? hash['secret'] : SKIP
  scopes = hash.key?('scopes') ? hash['scopes'] : SKIP
  type = hash.key?('type') ? hash['type'] : SKIP
  options = ExternalPaymentInitiationConsentOptions.from_hash(hash['options']) if
    hash['options']
  payer_details = PaymentInitiationConsentPayerDetails.from_hash(hash['payer_details']) if
    hash['payer_details']

  # 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.
  PaymentInitiationConsentCreateRequest.new(recipient_id: recipient_id,
                                            reference: reference,
                                            constraints: constraints,
                                            client_id: client_id,
                                            secret: secret,
                                            scopes: scopes,
                                            type: type,
                                            options: options,
                                            payer_details: payer_details,
                                            additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



63
64
65
66
67
68
69
70
71
72
73
74
75
# File 'lib/the_plaid_api/models/payment_initiation_consent_create_request.rb', line 63

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['client_id'] = 'client_id'
  @_hash['secret'] = 'secret'
  @_hash['recipient_id'] = 'recipient_id'
  @_hash['reference'] = 'reference'
  @_hash['scopes'] = 'scopes'
  @_hash['type'] = 'type'
  @_hash['constraints'] = 'constraints'
  @_hash['options'] = 'options'
  @_hash['payer_details'] = 'payer_details'
  @_hash
end

.nullablesObject

An array for nullable fields



90
91
92
93
94
95
# File 'lib/the_plaid_api/models/payment_initiation_consent_create_request.rb', line 90

def self.nullables
  %w[
    options
    payer_details
  ]
end

.optionalsObject

An array for optional fields



78
79
80
81
82
83
84
85
86
87
# File 'lib/the_plaid_api/models/payment_initiation_consent_create_request.rb', line 78

def self.optionals
  %w[
    client_id
    secret
    scopes
    type
    options
    payer_details
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



163
164
165
166
167
168
169
170
# File 'lib/the_plaid_api/models/payment_initiation_consent_create_request.rb', line 163

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} client_id: #{@client_id.inspect}, secret: #{@secret.inspect}, recipient_id:"\
  " #{@recipient_id.inspect}, reference: #{@reference.inspect}, scopes: #{@scopes.inspect},"\
  " type: #{@type.inspect}, constraints: #{@constraints.inspect}, options:"\
  " #{@options.inspect}, payer_details: #{@payer_details.inspect}, additional_properties:"\
  " #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



154
155
156
157
158
159
160
# File 'lib/the_plaid_api/models/payment_initiation_consent_create_request.rb', line 154

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} client_id: #{@client_id}, secret: #{@secret}, recipient_id:"\
  " #{@recipient_id}, reference: #{@reference}, scopes: #{@scopes}, type: #{@type},"\
  " constraints: #{@constraints}, options: #{@options}, payer_details: #{@payer_details},"\
  " additional_properties: #{@additional_properties}>"
end