Class: ThePlaidApi::PaymentInitiationConsent
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- ThePlaidApi::PaymentInitiationConsent
- Defined in:
- lib/the_plaid_api/models/payment_initiation_consent.rb
Overview
PaymentInitiationConsent defines a payment initiation consent.
Instance Attribute Summary collapse
-
#consent_id ⇒ String
The consent ID.
-
#constraints ⇒ PaymentInitiationConsentConstraints
Limitations that will be applied to payments initiated using the payment consent.
-
#created_at ⇒ DateTime
Consent creation timestamp, in [ISO 8601](wikipedia.org/wiki/ISO_8601) format.
-
#payer_details ⇒ ExternalPaymentRefundDetails
Details about external payment refund.
-
#recipient_id ⇒ String
The ID of the recipient the payment consent is for.
-
#reference ⇒ String
A reference for the payment consent.
-
#scopes ⇒ Array[PaymentInitiationConsentScope]
Deprecated, use the ‘type’ field instead.
-
#status ⇒ PaymentInitiationConsentStatus
The status of the payment consent.
-
#type ⇒ PaymentInitiationConsentType
Payment consent type.
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(consent_id:, status:, created_at:, recipient_id:, reference:, constraints:, scopes: SKIP, type: SKIP, payer_details: SKIP, additional_properties: nil) ⇒ PaymentInitiationConsent
constructor
A new instance of PaymentInitiationConsent.
-
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
- #to_custom_created_at ⇒ 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(consent_id:, status:, created_at:, recipient_id:, reference:, constraints:, scopes: SKIP, type: SKIP, payer_details: SKIP, additional_properties: nil) ⇒ PaymentInitiationConsent
Returns a new instance of PaymentInitiationConsent.
91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 |
# File 'lib/the_plaid_api/models/payment_initiation_consent.rb', line 91 def initialize(consent_id:, status:, created_at:, recipient_id:, reference:, constraints:, 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 = @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 @additional_properties = additional_properties end |
Instance Attribute Details
#consent_id ⇒ String
The consent ID.
15 16 17 |
# File 'lib/the_plaid_api/models/payment_initiation_consent.rb', line 15 def @consent_id end |
#constraints ⇒ PaymentInitiationConsentConstraints
Limitations that will be applied to payments initiated using the payment consent.
42 43 44 |
# File 'lib/the_plaid_api/models/payment_initiation_consent.rb', line 42 def constraints @constraints end |
#created_at ⇒ DateTime
Consent creation timestamp, in [ISO 8601](wikipedia.org/wiki/ISO_8601) format.
29 30 31 |
# File 'lib/the_plaid_api/models/payment_initiation_consent.rb', line 29 def created_at @created_at end |
#payer_details ⇒ ExternalPaymentRefundDetails
Details about external payment refund
58 59 60 |
# File 'lib/the_plaid_api/models/payment_initiation_consent.rb', line 58 def payer_details @payer_details end |
#recipient_id ⇒ String
The ID of the recipient the payment consent is for.
33 34 35 |
# File 'lib/the_plaid_api/models/payment_initiation_consent.rb', line 33 def recipient_id @recipient_id end |
#reference ⇒ String
A reference for the payment consent.
37 38 39 |
# File 'lib/the_plaid_api/models/payment_initiation_consent.rb', line 37 def reference @reference end |
#scopes ⇒ Array[PaymentInitiationConsentScope]
Deprecated, use the ‘type’ field instead.
46 47 48 |
# File 'lib/the_plaid_api/models/payment_initiation_consent.rb', line 46 def scopes @scopes end |
#status ⇒ PaymentInitiationConsentStatus
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.
24 25 26 |
# File 'lib/the_plaid_api/models/payment_initiation_consent.rb', line 24 def status @status end |
#type ⇒ PaymentInitiationConsentType
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.
54 55 56 |
# File 'lib/the_plaid_api/models/payment_initiation_consent.rb', line 54 def type @type end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
110 111 112 113 114 115 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 |
# File 'lib/the_plaid_api/models/payment_initiation_consent.rb', line 110 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. = 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'] 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. PaymentInitiationConsent.new(consent_id: , status: status, created_at: created_at, recipient_id: recipient_id, reference: reference, constraints: constraints, scopes: scopes, type: type, payer_details: payer_details, additional_properties: additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
61 62 63 64 65 66 67 68 69 70 71 72 73 |
# File 'lib/the_plaid_api/models/payment_initiation_consent.rb', line 61 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 end |
.nullables ⇒ Object
An array for nullable fields
85 86 87 88 89 |
# File 'lib/the_plaid_api/models/payment_initiation_consent.rb', line 85 def self.nullables %w[ payer_details ] end |
.optionals ⇒ Object
An array for optional fields
76 77 78 79 80 81 82 |
# File 'lib/the_plaid_api/models/payment_initiation_consent.rb', line 76 def self.optionals %w[ scopes type payer_details ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
162 163 164 165 166 167 168 169 |
# File 'lib/the_plaid_api/models/payment_initiation_consent.rb', line 162 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}, additional_properties:"\ " #{@additional_properties}>" end |
#to_custom_created_at ⇒ Object
148 149 150 |
# File 'lib/the_plaid_api/models/payment_initiation_consent.rb', line 148 def to_custom_created_at DateTimeHelper.to_rfc3339(created_at) end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
153 154 155 156 157 158 159 |
# File 'lib/the_plaid_api/models/payment_initiation_consent.rb', line 153 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},"\ " additional_properties: #{@additional_properties}>" end |