Class: ThePlaidApi::TransferAuthorization

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

Overview

Contains the authorization decision for a proposed transfer.

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(id:, created:, decision:, decision_rationale:, guarantee_decision:, guarantee_decision_rationale:, payment_risk:, proposed_transfer:, additional_properties: nil) ⇒ TransferAuthorization

Returns a new instance of TransferAuthorization.



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

def initialize(id:, created:, decision:, decision_rationale:,
               guarantee_decision:, guarantee_decision_rationale:,
               payment_risk:, proposed_transfer:,
               additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @id = id
  @created = created
  @decision = decision
  @decision_rationale = decision_rationale
  @guarantee_decision = guarantee_decision
  @guarantee_decision_rationale = guarantee_decision_rationale
  @payment_risk = payment_risk
  @proposed_transfer = proposed_transfer
  @additional_properties = additional_properties
end

Instance Attribute Details

#createdDateTime

The datetime representing when the authorization was created, in the format ‘2006-01-02T15:04:05Z`.

Returns:

  • (DateTime)


20
21
22
# File 'lib/the_plaid_api/models/transfer_authorization.rb', line 20

def created
  @created
end

#decisionTransferAuthorizationDecision

A decision regarding the proposed transfer. ‘approved` – The proposed transfer has received the end user’s consent and has been approved for processing by Plaid. The ‘decision_rationale` field is set if Plaid was unable to fetch the account information. You may proceed with the transfer, but further review is recommended. Refer to the `code` field in the `decision_rationale` object for details. `declined` – Plaid reviewed the proposed transfer and declined processing. Refer to the `code` field in the `decision_rationale` object for details. `user_action_required` – An action is required before Plaid can assess the transfer risk and make a decision. The most common scenario is to update authentication for an Item. To complete the required action, initialize Link by setting `transfer.authorization_id` in the request of `/link/token/create`. After Link flow is completed, you may re-attempt the authorization request. For `guarantee` requests, `approved` indicates the transfer is eligible for Plaid’s guarantee, and ‘declined` indicates Plaid will not provide guarantee coverage for the transfer. `user_action_required` indicates you should follow the above guidance before re-attempting.



41
42
43
# File 'lib/the_plaid_api/models/transfer_authorization.rb', line 41

def decision
  @decision
end

#decision_rationaleTransferAuthorizationDecisionRationale

The rationale for Plaid’s decision regarding a proposed transfer. It is always set for ‘declined` decisions, and may or may not be null for `approved` decisions.



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

def decision_rationale
  @decision_rationale
end

#guarantee_decisionTransferAuthorizationGuaranteeDecision

Indicates whether the transfer is guaranteed by Plaid (Guarantee customers only). This field will contain either ‘GUARANTEED` or `NOT_GUARANTEED` indicating whether Plaid will guarantee the transfer.



53
54
55
# File 'lib/the_plaid_api/models/transfer_authorization.rb', line 53

def guarantee_decision
  @guarantee_decision
end

#guarantee_decision_rationaleTransferAuthorizationGuaranteeDecisionRationale

The rationale for Plaid’s decision to not guarantee a transfer. Will be ‘null` unless `guarantee_decision` is `NOT_GUARANTEED`.



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

def guarantee_decision_rationale
  @guarantee_decision_rationale
end

#idString

Plaid’s unique identifier for a transfer authorization.

Returns:

  • (String)


15
16
17
# File 'lib/the_plaid_api/models/transfer_authorization.rb', line 15

def id
  @id
end

#payment_riskTransferAuthorizationPaymentRisk

This object includes the scores and risk level. This response is offered as an add-on to /transfer/authorization/create. To request access to these fields please contact your Plaid account manager.



64
65
66
# File 'lib/the_plaid_api/models/transfer_authorization.rb', line 64

def payment_risk
  @payment_risk
end

#proposed_transferTransferAuthorizationProposedTransfer

Details regarding the proposed transfer.



68
69
70
# File 'lib/the_plaid_api/models/transfer_authorization.rb', line 68

def proposed_transfer
  @proposed_transfer
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



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

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  id = hash.key?('id') ? hash['id'] : nil
  created = if hash.key?('created')
              (DateTimeHelper.from_rfc3339(hash['created']) if hash['created'])
            end
  decision = hash.key?('decision') ? hash['decision'] : nil
  if hash['decision_rationale']
    decision_rationale = TransferAuthorizationDecisionRationale.from_hash(hash['decision_rationale'])
  end
  guarantee_decision =
    hash.key?('guarantee_decision') ? hash['guarantee_decision'] : nil
  if hash['guarantee_decision_rationale']
    guarantee_decision_rationale = TransferAuthorizationGuaranteeDecisionRationale.from_hash(hash['guarantee_decision_rationale'])
  end
  payment_risk = TransferAuthorizationPaymentRisk.from_hash(hash['payment_risk']) if
    hash['payment_risk']
  if hash['proposed_transfer']
    proposed_transfer = TransferAuthorizationProposedTransfer.from_hash(hash['proposed_transfer'])
  end

  # 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.
  TransferAuthorization.new(id: id,
                            created: created,
                            decision: decision,
                            decision_rationale: decision_rationale,
                            guarantee_decision: guarantee_decision,
                            guarantee_decision_rationale: guarantee_decision_rationale,
                            payment_risk: payment_risk,
                            proposed_transfer: proposed_transfer,
                            additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



71
72
73
74
75
76
77
78
79
80
81
82
# File 'lib/the_plaid_api/models/transfer_authorization.rb', line 71

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['id'] = 'id'
  @_hash['created'] = 'created'
  @_hash['decision'] = 'decision'
  @_hash['decision_rationale'] = 'decision_rationale'
  @_hash['guarantee_decision'] = 'guarantee_decision'
  @_hash['guarantee_decision_rationale'] = 'guarantee_decision_rationale'
  @_hash['payment_risk'] = 'payment_risk'
  @_hash['proposed_transfer'] = 'proposed_transfer'
  @_hash
end

.nullablesObject

An array for nullable fields



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

def self.nullables
  %w[
    decision_rationale
    guarantee_decision
    guarantee_decision_rationale
    payment_risk
  ]
end

.optionalsObject

An array for optional fields



85
86
87
# File 'lib/the_plaid_api/models/transfer_authorization.rb', line 85

def self.optionals
  []
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



175
176
177
178
179
180
181
182
183
# File 'lib/the_plaid_api/models/transfer_authorization.rb', line 175

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} id: #{@id.inspect}, created: #{@created.inspect}, decision:"\
  " #{@decision.inspect}, decision_rationale: #{@decision_rationale.inspect},"\
  " guarantee_decision: #{@guarantee_decision.inspect}, guarantee_decision_rationale:"\
  " #{@guarantee_decision_rationale.inspect}, payment_risk: #{@payment_risk.inspect},"\
  " proposed_transfer: #{@proposed_transfer.inspect}, additional_properties:"\
  " #{@additional_properties}>"
end

#to_custom_createdObject



160
161
162
# File 'lib/the_plaid_api/models/transfer_authorization.rb', line 160

def to_custom_created
  DateTimeHelper.to_rfc3339(created)
end

#to_sObject

Provides a human-readable string representation of the object.



165
166
167
168
169
170
171
172
# File 'lib/the_plaid_api/models/transfer_authorization.rb', line 165

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} id: #{@id}, created: #{@created}, decision: #{@decision},"\
  " decision_rationale: #{@decision_rationale}, guarantee_decision: #{@guarantee_decision},"\
  " guarantee_decision_rationale: #{@guarantee_decision_rationale}, payment_risk:"\
  " #{@payment_risk}, proposed_transfer: #{@proposed_transfer}, additional_properties:"\
  " #{@additional_properties}>"
end