Skip to content

Commit

Permalink
Add a link to reason codes
Browse files Browse the repository at this point in the history
  • Loading branch information
marselester committed Aug 30, 2024
1 parent 1620fb8 commit 25ca9e9
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
8 changes: 4 additions & 4 deletions minfraud/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -1082,7 +1082,8 @@ class Reason:
This class provides both a machine-readable code and a human-readable
explanation of the reason for the risk score.
Although more codes may be added in the future, the current codes are:
Although more `codes <https://dev.maxmind.com/minfraud/api-documentation/responses/#schema--response--risk-score-reason--multiplier-reason>`_ # pylint: disable=line-too-long # noqa: E501
may be added in the future, the current codes are:
- ``BROWSER_LANGUAGE`` - Riskiness of the browser user-agent and
language associated with the request.
Expand Down Expand Up @@ -1329,9 +1330,8 @@ class Factors:
.. attribute:: risk_score_reasons
This tuple contains :class:`.RiskScoreReason` objects that describe
risk score reasons for a given transaction
that change the risk score significantly.
Risk score reasons are usually only returned for medium to
risk score reasons for a given transaction that change the risk score
significantly. Risk score reasons are usually only returned for medium to
high risk transactions. If there were no significant changes to the risk
score due to these reasons, then this tuple will be empty.
Expand Down
2 changes: 1 addition & 1 deletion tests/data/factors-response.json
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@
],
"risk_score_reasons": [
{
"multiplier": 45,
"multiplier": 45.0,
"reasons": [
{
"code": "ANONYMOUS_IP",
Expand Down
2 changes: 2 additions & 0 deletions tests/test_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -432,7 +432,9 @@ def check_insights_data(self, insights, uuid):
)

def check_risk_score_reasons_data(self, reasons):
self.assertEqual(1, len(reasons))
self.assertEqual(45, reasons[0].multiplier)
self.assertEqual(1, len(reasons[0].reasons))
self.assertEqual("ANONYMOUS_IP", reasons[0].reasons[0].code)
self.assertEqual(
"Risk due to IP being an Anonymous IP", reasons[0].reasons[0].reason
Expand Down

0 comments on commit 25ca9e9

Please sign in to comment.