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 071e8ea
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 13 deletions.
2 changes: 1 addition & 1 deletion HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
History
-------

2.12.0-beta.1
2.12.0b1
+++++++++++++++++++

* ``setuptools`` was incorrectly listed as a runtime dependency. This has
Expand Down
24 changes: 13 additions & 11 deletions minfraud/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -1082,7 +1082,7 @@ 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_ 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 @@ -1140,6 +1140,9 @@ class Reason:
based on minFraud network activity.
- ``SHIP_ACTIVITY`` - Riskiness of ship address based on minFraud network activity.
.. _codes: https://dev.maxmind.com/minfraud/api-documentation/responses\
/#schema--response--risk-score-reason--multiplier-reason
.. attribute:: code
This value is a machine-readable code identifying the
Expand Down Expand Up @@ -1187,10 +1190,10 @@ class RiskScoreReason:
.. attribute:: reasons
This tuple contains :class:`.Reason` objects that describe
one of the reasons for the multiplier.
This tuple contains :class:`.Reason` objects that describe
one of the reasons for the multiplier.
:type: tuple[Reason]
:type: tuple[Reason]
"""

Expand Down Expand Up @@ -1328,14 +1331,13 @@ 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
high risk transactions. If there were no significant changes to the risk
score due to these reasons, then this tuple will be empty.
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
high risk transactions. If there were no significant changes to the risk
score due to these reasons, then this tuple will be empty.
:type: tuple[RiskScoreReason]
:type: tuple[RiskScoreReason]
"""

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 071e8ea

Please sign in to comment.