Skip to content

Commit 071e8ea

Browse files
committed
Add a link to reason codes
1 parent 1620fb8 commit 071e8ea

File tree

4 files changed

+17
-13
lines changed

4 files changed

+17
-13
lines changed

HISTORY.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
History
44
-------
55

6-
2.12.0-beta.1
6+
2.12.0b1
77
+++++++++++++++++++
88

99
* ``setuptools`` was incorrectly listed as a runtime dependency. This has

minfraud/models.py

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1082,7 +1082,7 @@ class Reason:
10821082
This class provides both a machine-readable code and a human-readable
10831083
explanation of the reason for the risk score.
10841084
1085-
Although more codes may be added in the future, the current codes are:
1085+
Although more codes_ may be added in the future, the current codes are:
10861086
10871087
- ``BROWSER_LANGUAGE`` - Riskiness of the browser user-agent and
10881088
language associated with the request.
@@ -1140,6 +1140,9 @@ class Reason:
11401140
based on minFraud network activity.
11411141
- ``SHIP_ACTIVITY`` - Riskiness of ship address based on minFraud network activity.
11421142
1143+
.. _codes: https://dev.maxmind.com/minfraud/api-documentation/responses\
1144+
/#schema--response--risk-score-reason--multiplier-reason
1145+
11431146
.. attribute:: code
11441147
11451148
This value is a machine-readable code identifying the
@@ -1187,10 +1190,10 @@ class RiskScoreReason:
11871190
11881191
.. attribute:: reasons
11891192
1190-
This tuple contains :class:`.Reason` objects that describe
1191-
one of the reasons for the multiplier.
1193+
This tuple contains :class:`.Reason` objects that describe
1194+
one of the reasons for the multiplier.
11921195
1193-
:type: tuple[Reason]
1196+
:type: tuple[Reason]
11941197
11951198
"""
11961199

@@ -1328,14 +1331,13 @@ class Factors:
13281331
13291332
.. attribute:: risk_score_reasons
13301333
1331-
This tuple contains :class:`.RiskScoreReason` objects that describe
1332-
risk score reasons for a given transaction
1333-
that change the risk score significantly.
1334-
Risk score reasons are usually only returned for medium to
1335-
high risk transactions. If there were no significant changes to the risk
1336-
score due to these reasons, then this tuple will be empty.
1334+
This tuple contains :class:`.RiskScoreReason` objects that describe
1335+
risk score reasons for a given transaction that change the risk score
1336+
significantly. Risk score reasons are usually only returned for medium to
1337+
high risk transactions. If there were no significant changes to the risk
1338+
score due to these reasons, then this tuple will be empty.
13371339
1338-
:type: tuple[RiskScoreReason]
1340+
:type: tuple[RiskScoreReason]
13391341
13401342
"""
13411343

tests/data/factors-response.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@
207207
],
208208
"risk_score_reasons": [
209209
{
210-
"multiplier": 45,
210+
"multiplier": 45.0,
211211
"reasons": [
212212
{
213213
"code": "ANONYMOUS_IP",

tests/test_models.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -432,7 +432,9 @@ def check_insights_data(self, insights, uuid):
432432
)
433433

434434
def check_risk_score_reasons_data(self, reasons):
435+
self.assertEqual(1, len(reasons))
435436
self.assertEqual(45, reasons[0].multiplier)
437+
self.assertEqual(1, len(reasons[0].reasons))
436438
self.assertEqual("ANONYMOUS_IP", reasons[0].reasons[0].code)
437439
self.assertEqual(
438440
"Risk due to IP being an Anonymous IP", reasons[0].reasons[0].reason

0 commit comments

Comments
 (0)