Class: ThePlaidApi::TransferAuthorizationPaymentRisk

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

Overview

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.

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(bank_initiated_return_score:, customer_initiated_return_score:, risk_level:, warnings:, additional_properties: nil) ⇒ TransferAuthorizationPaymentRisk

Returns a new instance of TransferAuthorizationPaymentRisk.



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

def initialize(bank_initiated_return_score:,
               customer_initiated_return_score:, risk_level:, warnings:,
               additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @bank_initiated_return_score = bank_initiated_return_score
  @customer_initiated_return_score = customer_initiated_return_score
  @risk_level = risk_level
  @warnings = warnings
  @additional_properties = additional_properties
end

Instance Attribute Details

#bank_initiated_return_scoreInteger

A score from 1-99 that indicates the transaction return risk: a higher risk score suggests a higher return likelihood. The score evaluates the transaction return risk because an account is overdrawn or because an ineligible account is used and covers return codes: “R01”, “R02”, “R03”, “R04”, “R06”, “R08”, “R09”, “R13”, “R16”, “R17”, “R20”, “R23”. These returns have a turnaround time of 2 banking days.

Returns:

  • (Integer)


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

def bank_initiated_return_score
  @bank_initiated_return_score
end

#customer_initiated_return_scoreInteger

A score from 1-99 that indicates the transaction return risk: a higher risk score suggests a higher return likelihood. The score evaluates the transaction return risk of an unauthorized debit and covers return codes: “R05”, “R07”, “R10”, “R11”, “R29”. These returns typically have a return time frame of up to 60 calendar days. During this period, the customer of financial institutions can dispute a transaction as unauthorized.

Returns:

  • (Integer)


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

def customer_initiated_return_score
  @customer_initiated_return_score
end

#risk_levelTransferAuthorizationRiskLevel

Comprises five risk categories (high risk, medium-high risk, medium risk, medium-low risk, low risk) based on the probability of return



37
38
39
# File 'lib/the_plaid_api/models/transfer_authorization_payment_risk.rb', line 37

def risk_level
  @risk_level
end

#warningsArray[SignalWarning]

If bank information was not available to be used, this array contains warnings describing why bank data is missing. If you want to receive an API error instead of scores in the case of missing bank data, file a support ticket or contact your Plaid account manager.

Returns:



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

def warnings
  @warnings
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
# File 'lib/the_plaid_api/models/transfer_authorization_payment_risk.rb', line 85

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  bank_initiated_return_score =
    hash.key?('bank_initiated_return_score') ? hash['bank_initiated_return_score'] : nil
  customer_initiated_return_score =
    hash.key?('customer_initiated_return_score') ? hash['customer_initiated_return_score'] : nil
  risk_level = hash.key?('risk_level') ? hash['risk_level'] : nil
  # Parameter is an array, so we need to iterate through it
  warnings = nil
  unless hash['warnings'].nil?
    warnings = []
    hash['warnings'].each do |structure|
      warnings << (SignalWarning.from_hash(structure) if structure)
    end
  end

  warnings = nil unless hash.key?('warnings')

  # 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.
  TransferAuthorizationPaymentRisk.new(bank_initiated_return_score: bank_initiated_return_score,
                                       customer_initiated_return_score: customer_initiated_return_score,
                                       risk_level: risk_level,
                                       warnings: warnings,
                                       additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



47
48
49
50
51
52
53
54
55
# File 'lib/the_plaid_api/models/transfer_authorization_payment_risk.rb', line 47

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['bank_initiated_return_score'] = 'bank_initiated_return_score'
  @_hash['customer_initiated_return_score'] =
    'customer_initiated_return_score'
  @_hash['risk_level'] = 'risk_level'
  @_hash['warnings'] = 'warnings'
  @_hash
end

.nullablesObject

An array for nullable fields



63
64
65
66
67
68
69
# File 'lib/the_plaid_api/models/transfer_authorization_payment_risk.rb', line 63

def self.nullables
  %w[
    bank_initiated_return_score
    customer_initiated_return_score
    risk_level
  ]
end

.optionalsObject

An array for optional fields



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

def self.optionals
  []
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



129
130
131
132
133
134
135
# File 'lib/the_plaid_api/models/transfer_authorization_payment_risk.rb', line 129

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} bank_initiated_return_score: #{@bank_initiated_return_score.inspect},"\
  " customer_initiated_return_score: #{@customer_initiated_return_score.inspect}, risk_level:"\
  " #{@risk_level.inspect}, warnings: #{@warnings.inspect}, additional_properties:"\
  " #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



121
122
123
124
125
126
# File 'lib/the_plaid_api/models/transfer_authorization_payment_risk.rb', line 121

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} bank_initiated_return_score: #{@bank_initiated_return_score},"\
  " customer_initiated_return_score: #{@customer_initiated_return_score}, risk_level:"\
  " #{@risk_level}, warnings: #{@warnings}, additional_properties: #{@additional_properties}>"
end