Skip to content

Commit 1d0a74f

Browse files
authored
Merge pull request #84 from maxmind/label-test-3ds
Add custom rule label and 3DS result input
2 parents cc53ae7 + 5286fb6 commit 1d0a74f

File tree

7 files changed

+26
-4
lines changed

7 files changed

+26
-4
lines changed

HISTORY.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ History
1414
* ``dlocal``
1515
* ``onpay``
1616
* ``safecharge``
17+
* Added ``rule_label`` to minFraud output ``/disposition``.
18+
* Added ``was_3d_secure_successful`` to ``/credit_card`` validation
1719

1820
2.3.1 (2021-02-12)
1921
++++++++++++++++++

README.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,7 @@ Score, Insights and Factors Example
195195
>>> 'cvv_result': 'N',
196196
>>> 'bank_name': 'Bank of No Hope',
197197
>>> 'issuer_id_number': '411111'
198+
>>> 'was_3d_secure_successful': True
198199
>>> },
199200
>>> 'payment': {
200201
>>> 'decline_code': 'invalid number',

minfraud/models.py

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -418,8 +418,9 @@ class Disposition:
418418
.. attribute:: action
419419
420420
The action to take on the transaction as defined by your custom rules.
421-
The current set of values are "accept", "manual_review", and "reject".
422-
If you do not have custom rules set up, ``None`` will be returned.
421+
The current set of values are "accept", "manual_review", "reject", and
422+
"test". If you do not have custom rules set up, ``None`` will be
423+
returned.
423424
424425
:type: str | None
425426
@@ -429,16 +430,26 @@ class Disposition:
429430
"custom_rule", "block_list", and "default". If you do not have custom
430431
rules set up, ``None`` will be returned.
431432
433+
:type: str | None
434+
435+
.. attribute:: rule_label
436+
437+
The label of the custom rule that was triggered. If you do not have
438+
custom rules set up, the triggered custom rule does not have a label, or
439+
no custom rule was triggered, ``None`` will be returned.
440+
432441
:type: str | None
433442
"""
434443

435444
action: Optional[str]
436445
reason: Optional[str]
446+
rule_label: Optional[str]
437447

438448
__slots__ = ()
439449
_fields = {
440450
"action": None,
441451
"reason": None,
452+
"rule_label": None,
442453
}
443454

444455

minfraud/validation.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -302,6 +302,7 @@ def _uri(s: str) -> str:
302302
"issuer_id_number": _iin,
303303
"last_4_digits": _credit_card_last_4,
304304
"token": _credit_card_token,
305+
"was_3d_secure_successful": bool,
305306
},
306307
"custom_inputs": {_custom_input_key: _custom_input_value},
307308
"device": {

tests/data/full-transaction-request.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,8 @@
5353
"bank_phone_number": "123-456-1234",
5454
"avs_result": "Y",
5555
"cvv_result": "N",
56-
"token": "123456abc1234"
56+
"token": "123456abc1234",
57+
"was_3d_secure_successful": true
5758
},
5859
"order": {
5960
"amount": 323.21,

tests/test_models.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,10 +99,13 @@ def test_device(self):
9999
self.assertEqual(local_time, device.local_time)
100100

101101
def test_disposition(self):
102-
disposition = Disposition({"action": "accept", "reason": "default"})
102+
disposition = Disposition(
103+
{"action": "accept", "reason": "default", "rule_label": "custom rule label"}
104+
)
103105

104106
self.assertEqual("accept", disposition.action)
105107
self.assertEqual("default", disposition.reason)
108+
self.assertEqual("custom rule label", disposition.rule_label)
106109

107110
def test_email(self):
108111
first_seen = "2016-01-01"

tests/test_validation.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,9 @@ def test_token(self):
185185
for invalid in ("\x20", "123456", "x" * 256):
186186
self.check_invalid_transaction({"credit_card": {"token": invalid}})
187187

188+
def test_was_3d_secure_successful(self):
189+
self.check_bool("credit_card", "was_3d_secure_successful")
190+
188191

189192
class TestCustomInputs(ValidationBase, unittest.TestCase):
190193
def test_valid_inputs(self):

0 commit comments

Comments
 (0)