From a4f45a0d93b5be955aee9262f48ecfa9a1c66fe3 Mon Sep 17 00:00:00 2001 From: Kevin Centeno Date: Wed, 18 Aug 2021 16:17:25 -0400 Subject: [PATCH 1/7] Add "test" disposition to doc --- minfraud/models.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/minfraud/models.py b/minfraud/models.py index b4f9e6e..a5392b0 100644 --- a/minfraud/models.py +++ b/minfraud/models.py @@ -418,8 +418,9 @@ class Disposition: .. attribute:: action The action to take on the transaction as defined by your custom rules. - The current set of values are "accept", "manual_review", and "reject". - If you do not have custom rules set up, ``None`` will be returned. + The current set of values are "accept", "manual_review", "reject", and + "test". If you do not have custom rules set up, ``None`` will be + returned. :type: str | None From 6e0fbf5c39a2e8d495950d831fdad6bf62166ca4 Mon Sep 17 00:00:00 2001 From: Kevin Centeno Date: Wed, 18 Aug 2021 16:47:25 -0400 Subject: [PATCH 2/7] Add rule label to disposition --- minfraud/models.py | 10 ++++++++++ tests/test_models.py | 5 ++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/minfraud/models.py b/minfraud/models.py index a5392b0..a6e1765 100644 --- a/minfraud/models.py +++ b/minfraud/models.py @@ -430,16 +430,26 @@ class Disposition: "custom_rule", "block_list", and "default". If you do not have custom rules set up, ``None`` will be returned. + :type: str | None + + .. attribute:: rule_label + + The label of the custom rule that was triggered. If you do not have + custom rule set up, or the custom rule that was triggered does not have a + label, ``None`` will be returned. + :type: str | None """ action: Optional[str] reason: Optional[str] + rule_label: Optional[str] __slots__ = () _fields = { "action": None, "reason": None, + "rule_label": None, } diff --git a/tests/test_models.py b/tests/test_models.py index 00a661b..162aef8 100644 --- a/tests/test_models.py +++ b/tests/test_models.py @@ -99,10 +99,13 @@ def test_device(self): self.assertEqual(local_time, device.local_time) def test_disposition(self): - disposition = Disposition({"action": "accept", "reason": "default"}) + disposition = Disposition( + {"action": "accept", "reason": "default", "rule_label": "custom rule label"} + ) self.assertEqual("accept", disposition.action) self.assertEqual("default", disposition.reason) + self.assertEqual("custom rule label", disposition.rule_label) def test_email(self): first_seen = "2016-01-01" From 0601553052742c7ef7e01de9714d8244211c0070 Mon Sep 17 00:00:00 2001 From: Kevin Centeno Date: Wed, 18 Aug 2021 17:05:56 -0400 Subject: [PATCH 3/7] Add 3DS to credit_card validation --- HISTORY.rst | 2 ++ README.rst | 1 + minfraud/validation.py | 1 + tests/data/full-transaction-request.json | 3 ++- tests/test_validation.py | 3 +++ 5 files changed, 9 insertions(+), 1 deletion(-) diff --git a/HISTORY.rst b/HISTORY.rst index 99c66e1..4cc52b2 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -14,6 +14,8 @@ History * ``dlocal`` * ``onpay`` * ``safecharge`` +* Adds ``rule_label`` to minFraud output ``/disposition``. +* Adds ``was_3d_secure_successful`` to ``/credit_card`` validation 2.3.1 (2021-02-12) ++++++++++++++++++ diff --git a/README.rst b/README.rst index cad7878..b888678 100644 --- a/README.rst +++ b/README.rst @@ -195,6 +195,7 @@ Score, Insights and Factors Example >>> 'cvv_result': 'N', >>> 'bank_name': 'Bank of No Hope', >>> 'issuer_id_number': '411111' + >>> 'was_3ds_secure_successful': True >>> }, >>> 'payment': { >>> 'decline_code': 'invalid number', diff --git a/minfraud/validation.py b/minfraud/validation.py index dcee398..b3b28e4 100644 --- a/minfraud/validation.py +++ b/minfraud/validation.py @@ -302,6 +302,7 @@ def _uri(s: str) -> str: "issuer_id_number": _iin, "last_4_digits": _credit_card_last_4, "token": _credit_card_token, + "was_3d_secure_successful": bool, }, "custom_inputs": {_custom_input_key: _custom_input_value}, "device": { diff --git a/tests/data/full-transaction-request.json b/tests/data/full-transaction-request.json index f03dcc9..430554c 100644 --- a/tests/data/full-transaction-request.json +++ b/tests/data/full-transaction-request.json @@ -53,7 +53,8 @@ "bank_phone_number": "123-456-1234", "avs_result": "Y", "cvv_result": "N", - "token": "123456abc1234" + "token": "123456abc1234", + "was_3d_secure_successful": true }, "order": { "amount": 323.21, diff --git a/tests/test_validation.py b/tests/test_validation.py index f322df3..633fca8 100644 --- a/tests/test_validation.py +++ b/tests/test_validation.py @@ -185,6 +185,9 @@ def test_token(self): for invalid in ("\x20", "123456", "x" * 256): self.check_invalid_transaction({"credit_card": {"token": invalid}}) + def test_was_3d_secure_successful(self): + self.check_bool("credit_card", "was_3d_secure_successful") + class TestCustomInputs(ValidationBase, unittest.TestCase): def test_valid_inputs(self): From 95e74535ae6875df52665ef4b66b9c32e379a0b7 Mon Sep 17 00:00:00 2001 From: Kevin Centeno Date: Wed, 18 Aug 2021 17:46:31 -0400 Subject: [PATCH 4/7] Fix tense in HISTORY.rst --- HISTORY.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/HISTORY.rst b/HISTORY.rst index 4cc52b2..d5792b5 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -14,8 +14,8 @@ History * ``dlocal`` * ``onpay`` * ``safecharge`` -* Adds ``rule_label`` to minFraud output ``/disposition``. -* Adds ``was_3d_secure_successful`` to ``/credit_card`` validation +* Added ``rule_label`` to minFraud output ``/disposition``. +* Added ``was_3d_secure_successful`` to ``/credit_card`` validation 2.3.1 (2021-02-12) ++++++++++++++++++ From 17840984af6f9c9311065f04771e551650f8af0a Mon Sep 17 00:00:00 2001 From: Kevin Centeno Date: Thu, 19 Aug 2021 10:41:53 -0400 Subject: [PATCH 5/7] Update rule_label doc --- minfraud/models.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/minfraud/models.py b/minfraud/models.py index a6e1765..428bab8 100644 --- a/minfraud/models.py +++ b/minfraud/models.py @@ -435,8 +435,8 @@ class Disposition: .. attribute:: rule_label The label of the custom rule that was triggered. If you do not have - custom rule set up, or the custom rule that was triggered does not have a - label, ``None`` will be returned. + custom rules set up, the triggered custom rule does not have a label, or + no custom rule was triggered, ``None`` will be returned. :type: str | None """ From 51b366d44ca2c3d3a6b5c8259bd1b6f691be7302 Mon Sep 17 00:00:00 2001 From: Kevin Centeno Date: Fri, 20 Aug 2021 10:51:57 -0400 Subject: [PATCH 6/7] Use single space after period --- minfraud/models.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/minfraud/models.py b/minfraud/models.py index 428bab8..efd993f 100644 --- a/minfraud/models.py +++ b/minfraud/models.py @@ -419,7 +419,7 @@ class Disposition: The action to take on the transaction as defined by your custom rules. The current set of values are "accept", "manual_review", "reject", and - "test". If you do not have custom rules set up, ``None`` will be + "test". If you do not have custom rules set up, ``None`` will be returned. :type: str | None From 5286fb6c62e0d9b83e6295677ff47553f075f687 Mon Sep 17 00:00:00 2001 From: Kevin Centeno Date: Wed, 25 Aug 2021 10:38:54 -0400 Subject: [PATCH 7/7] s/was_3ds/was_3d/ --- README.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.rst b/README.rst index b888678..cfc206b 100644 --- a/README.rst +++ b/README.rst @@ -195,7 +195,7 @@ Score, Insights and Factors Example >>> 'cvv_result': 'N', >>> 'bank_name': 'Bank of No Hope', >>> 'issuer_id_number': '411111' - >>> 'was_3ds_secure_successful': True + >>> 'was_3d_secure_successful': True >>> }, >>> 'payment': { >>> 'decline_code': 'invalid number',