Class: ThePlaidApi::BankInitiatedReturnRisk

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

Overview

The object contains a risk score and a risk tier that evaluate the transaction return risk because an account is overdrawn or because an ineligible account is used. Common return codes in this category include: “R01”, “R02”, “R03”, “R04”, “R06”, “R08”, “R09”, “R13”, “R16”, “R17”, “R20”, “R23”. These returns have a turnaround time of 2 banking days.

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(score:, risk_tier:, additional_properties: nil) ⇒ BankInitiatedReturnRisk

Returns a new instance of BankInitiatedReturnRisk.



54
55
56
57
58
59
60
61
# File 'lib/the_plaid_api/models/bank_initiated_return_risk.rb', line 54

def initialize(score:, risk_tier:, additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @score = score
  @risk_tier = risk_tier
  @additional_properties = additional_properties
end

Instance Attribute Details

#risk_tierInteger

DEPRECATED. Use Signal Rules instead to transform the ‘score` into a useful action. In the `bank_initiated_return_risk` object, there are eight risk tiers corresponding to the scores:

1: Predicted bank-initiated return incidence rate between 0.0% - 0.5%
2: Predicted bank-initiated return incidence rate between 0.5% - 1.5%
3: Predicted bank-initiated return incidence rate between 1.5% - 3%
4: Predicted bank-initiated return incidence rate between 3% - 5%
5: Predicted bank-initiated return incidence rate between 5% - 10%
6: Predicted bank-initiated return incidence rate between 10% - 15%
7: Predicted bank-initiated return incidence rate between 15% and 50%
8: Predicted bank-initiated return incidence rate greater than 50%

Returns:

  • (Integer)


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

def risk_tier
  @risk_tier
end

#scoreInteger

A score from 1-99 that indicates the transaction return risk: a higher risk score suggests a higher return likelihood.

Returns:

  • (Integer)


19
20
21
# File 'lib/the_plaid_api/models/bank_initiated_return_risk.rb', line 19

def score
  @score
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
# File 'lib/the_plaid_api/models/bank_initiated_return_risk.rb', line 64

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  score = hash.key?('score') ? hash['score'] : nil
  risk_tier = hash.key?('risk_tier') ? hash['risk_tier'] : nil

  # 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.
  BankInitiatedReturnRisk.new(score: score,
                              risk_tier: risk_tier,
                              additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



37
38
39
40
41
42
# File 'lib/the_plaid_api/models/bank_initiated_return_risk.rb', line 37

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['score'] = 'score'
  @_hash['risk_tier'] = 'risk_tier'
  @_hash
end

.nullablesObject

An array for nullable fields



50
51
52
# File 'lib/the_plaid_api/models/bank_initiated_return_risk.rb', line 50

def self.nullables
  []
end

.optionalsObject

An array for optional fields



45
46
47
# File 'lib/the_plaid_api/models/bank_initiated_return_risk.rb', line 45

def self.optionals
  []
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



92
93
94
95
96
# File 'lib/the_plaid_api/models/bank_initiated_return_risk.rb', line 92

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

#to_sObject

Provides a human-readable string representation of the object.



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

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