Class: Stytch::Fraud::VerdictReasons

Inherits:
Object
  • Object
show all
Includes:
RequestHelper
Defined in:
lib/stytch/fraud.rb

Instance Method Summary collapse

Methods included from RequestHelper

#delete_request, #get_request, #post_request, #put_request, #request_with_query_params

Constructor Details

#initialize(connection) ⇒ VerdictReasons

Returns a new instance of VerdictReasons.



266
267
268
# File 'lib/stytch/fraud.rb', line 266

def initialize(connection)
  @connection = connection
end

Instance Method Details

#list(overrides_only: nil) ⇒ Object

Get the list of verdict reasons returned by the Stytch Device Fingerprinting product along with their default actions and any overrides you may have defined. This is not an exhaustive list of verdict reasons, but it contains all verdict reasons that you may set an override on.

For a full list of possible verdict reasons, see [Warning Flags (Verdict Reasons)](stytch.com/docs/docs/fraud/guides/device-fingerprinting/reference/warning-flags-verdict-reasons).

Parameters:

overrides_only

Whether to return only verdict reasons that have overrides set. Defaults to false. The type of this field is nilable Boolean.

Returns:

An object with the following fields:

request_id

Globally unique UUID that is returned with every API call. This value is important to log for debugging purposes; we may ask for this value to help identify a specific API call when helping you debug an issue. The type of this field is String.

verdict_reason_actions

Information about verdict reasons and any overrides that were set on them. The type of this field is list of VerdictReasonAction (object).

status_code

The HTTP status code of the response. Stytch follows standard HTTP response status code patterns, e.g. 2XX values equate to success, 3XX values are redirects, 4XX are client errors, and 5XX are server errors. The type of this field is Integer.



329
330
331
332
333
334
335
336
337
# File 'lib/stytch/fraud.rb', line 329

def list(
  overrides_only: nil
)
  headers = {}
  request = {}
  request[:overrides_only] = overrides_only unless overrides_only.nil?

  post_request('/v1/verdict_reasons/list', request, headers)
end

#override(verdict_reason:, override_action:, override_description: nil) ⇒ Object

Use this endpoint to override the action returned for a specific verdict reason during a fingerprint lookup. For example, Stytch Device Fingerprinting returns a ‘CHALLENGE` verdict action by default for the verdict reason `VIRTUAL_MACHINE`. You can use this endpoint to override that reason to return an `ALLOW` verdict instead if you expect many legitimate users to be using a browser that runs in a virtual machine.

Parameters:

verdict_reason

The verdict reason that you wish to override. For a list of possible reasons to override, see [Warning Flags (Verdict Reasons)](stytch.com/docs/docs/fraud/guides/device-fingerprinting/reference/warning-flags-verdict-reasons). You may not override the ‘RULE_MATCH` reason. The type of this field is String.

override_action

The action that you want to be returned for the specified verdict reason. The override action must be one of ‘ALLOW`, `BLOCK`, or `CHALLENGE`. The type of this field is OverrideRequestAction (string enum).

override_description

An optional description for the verdict reason override. The type of this field is nilable String.

Returns:

An object with the following fields:

request_id

Globally unique UUID that is returned with every API call. This value is important to log for debugging purposes; we may ask for this value to help identify a specific API call when helping you debug an issue. The type of this field is String.

verdict_reason_action

Information about the verdict reason override that was just set. The type of this field is VerdictReasonAction (object).

status_code

The HTTP status code of the response. Stytch follows standard HTTP response status code patterns, e.g. 2XX values equate to success, 3XX values are redirects, 4XX are client errors, and 5XX are server errors. The type of this field is Integer.



294
295
296
297
298
299
300
301
302
303
304
305
306
307
# File 'lib/stytch/fraud.rb', line 294

def override(
  verdict_reason:,
  override_action:,
  override_description: nil
)
  headers = {}
  request = {
    verdict_reason: verdict_reason,
    override_action: override_action
  }
  request[:override_description] = override_description unless override_description.nil?

  post_request('/v1/verdict_reasons/override', request, headers)
end