Class: ThePlaidApi::PaymentInitiationConsentGetResponse

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

Overview

PaymentInitiationConsentGetResponse defines the response schema for ‘/payment_initation/consent/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(consent_id:, status:, created_at:, recipient_id:, reference:, constraints:, request_id:, scopes: SKIP, type: SKIP, payer_details: SKIP, additional_properties: nil) ⇒ PaymentInitiationConsentGetResponse

Returns a new instance of PaymentInitiationConsentGetResponse.



99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
# File 'lib/the_plaid_api/models/payment_initiation_consent_get_response.rb', line 99

def initialize(consent_id:, status:, created_at:, recipient_id:, reference:,
               constraints:, request_id:, scopes: SKIP, type: SKIP,
               payer_details: SKIP, additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @consent_id = consent_id
  @status = status
  @created_at = created_at
  @recipient_id = recipient_id
  @reference = reference
  @constraints = constraints
  @scopes = scopes unless scopes == SKIP
  @type = type unless type == SKIP
  @payer_details = payer_details unless payer_details == SKIP
  @request_id = request_id
  @additional_properties = additional_properties
end

Instance Attribute Details

The consent ID.

Returns:

  • (String)


16
17
18
# File 'lib/the_plaid_api/models/payment_initiation_consent_get_response.rb', line 16

def consent_id
  @consent_id
end

#constraintsPaymentInitiationConsentConstraints

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



43
44
45
# File 'lib/the_plaid_api/models/payment_initiation_consent_get_response.rb', line 43

def constraints
  @constraints
end

#created_atDateTime

Consent creation timestamp, in [ISO 8601](wikipedia.org/wiki/ISO_8601) format.

Returns:

  • (DateTime)


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

def created_at
  @created_at
end

#payer_detailsExternalPaymentRefundDetails

Details about external payment refund



59
60
61
# File 'lib/the_plaid_api/models/payment_initiation_consent_get_response.rb', line 59

def payer_details
  @payer_details
end

#recipient_idString

The ID of the recipient the payment consent is for.

Returns:

  • (String)


34
35
36
# File 'lib/the_plaid_api/models/payment_initiation_consent_get_response.rb', line 34

def recipient_id
  @recipient_id
end

#referenceString

A reference for the payment consent.

Returns:

  • (String)


38
39
40
# File 'lib/the_plaid_api/models/payment_initiation_consent_get_response.rb', line 38

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


65
66
67
# File 'lib/the_plaid_api/models/payment_initiation_consent_get_response.rb', line 65

def request_id
  @request_id
end

#scopesArray[PaymentInitiationConsentScope]

Deprecated, use the ‘type’ field instead.

Returns:



47
48
49
# File 'lib/the_plaid_api/models/payment_initiation_consent_get_response.rb', line 47

def scopes
  @scopes
end

#statusPaymentInitiationConsentStatus

The status of the payment consent. ‘UNAUTHORISED`: Consent created, but requires user authorisation. `REJECTED`: Consent authorisation was rejected by the bank. `AUTHORISED`: Consent is active and ready to be used. `REVOKED`: Consent has been revoked and can no longer be used. `EXPIRED`: Consent is no longer valid.



25
26
27
# File 'lib/the_plaid_api/models/payment_initiation_consent_get_response.rb', line 25

def status
  @status
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.



55
56
57
# File 'lib/the_plaid_api/models/payment_initiation_consent_get_response.rb', line 55

def type
  @type
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



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
152
153
154
155
156
157
# File 'lib/the_plaid_api/models/payment_initiation_consent_get_response.rb', line 119

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  consent_id = hash.key?('consent_id') ? hash['consent_id'] : nil
  status = hash.key?('status') ? hash['status'] : nil
  created_at = if hash.key?('created_at')
                 (DateTimeHelper.from_rfc3339(hash['created_at']) if hash['created_at'])
               end
  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']
  request_id = hash.key?('request_id') ? hash['request_id'] : nil
  scopes = hash.key?('scopes') ? hash['scopes'] : SKIP
  type = hash.key?('type') ? hash['type'] : SKIP
  payer_details = ExternalPaymentRefundDetails.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.
  PaymentInitiationConsentGetResponse.new(consent_id: consent_id,
                                          status: status,
                                          created_at: created_at,
                                          recipient_id: recipient_id,
                                          reference: reference,
                                          constraints: constraints,
                                          request_id: request_id,
                                          scopes: scopes,
                                          type: type,
                                          payer_details: payer_details,
                                          additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



68
69
70
71
72
73
74
75
76
77
78
79
80
81
# File 'lib/the_plaid_api/models/payment_initiation_consent_get_response.rb', line 68

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['consent_id'] = 'consent_id'
  @_hash['status'] = 'status'
  @_hash['created_at'] = 'created_at'
  @_hash['recipient_id'] = 'recipient_id'
  @_hash['reference'] = 'reference'
  @_hash['constraints'] = 'constraints'
  @_hash['scopes'] = 'scopes'
  @_hash['type'] = 'type'
  @_hash['payer_details'] = 'payer_details'
  @_hash['request_id'] = 'request_id'
  @_hash
end

.nullablesObject

An array for nullable fields



93
94
95
96
97
# File 'lib/the_plaid_api/models/payment_initiation_consent_get_response.rb', line 93

def self.nullables
  %w[
    payer_details
  ]
end

.optionalsObject

An array for optional fields



84
85
86
87
88
89
90
# File 'lib/the_plaid_api/models/payment_initiation_consent_get_response.rb', line 84

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

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



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

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

#to_custom_created_atObject



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

def to_custom_created_at
  DateTimeHelper.to_rfc3339(created_at)
end

#to_sObject

Provides a human-readable string representation of the object.



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

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