Class: ThePlaidApi::CustomerInitiatedReturnRisk

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

Overview

The object contains a risk score and a risk tier that evaluate the transaction return risk of an unauthorized debit. Common return codes in this category include: “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.

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) ⇒ CustomerInitiatedReturnRisk

Returns a new instance of CustomerInitiatedReturnRisk.



58
59
60
61
62
63
64
65
# File 'lib/the_plaid_api/models/customer_initiated_return_risk.rb', line 58

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. A tier corresponding to the projected likelihood that the transaction, if initiated, will be subject to a return. In the `customer_initiated_return_risk` object, there are five risk tiers corresponding to the scores:

1: Predicted customer-initiated return incidence rate between 0.00% -

0.02%

2: Predicted customer-initiated return incidence rate between 0.02% -

0.05%

3: Predicted customer-initiated return incidence rate between 0.05% -

0.1%

4: Predicted customer-initiated return incidence rate between 0.1% -

0.5%

5: Predicted customer-initiated return incidence rate greater than 0.5%

Returns:

  • (Integer)


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

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)


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

def score
  @score
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
# File 'lib/the_plaid_api/models/customer_initiated_return_risk.rb', line 68

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

.namesObject

A mapping from model property names to API property names.



41
42
43
44
45
46
# File 'lib/the_plaid_api/models/customer_initiated_return_risk.rb', line 41

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

.nullablesObject

An array for nullable fields



54
55
56
# File 'lib/the_plaid_api/models/customer_initiated_return_risk.rb', line 54

def self.nullables
  []
end

.optionalsObject

An array for optional fields



49
50
51
# File 'lib/the_plaid_api/models/customer_initiated_return_risk.rb', line 49

def self.optionals
  []
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



96
97
98
99
100
# File 'lib/the_plaid_api/models/customer_initiated_return_risk.rb', line 96

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.



89
90
91
92
93
# File 'lib/the_plaid_api/models/customer_initiated_return_risk.rb', line 89

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