Skip to content

Commit 2ea3f26

Browse files
authored
Merge pull request #57 from maxmind/pcronin/subscores
device, email_local_part and shipping_address subscores are supported
2 parents 1dcbd43 + 260734d commit 2ea3f26

4 files changed

Lines changed: 39 additions & 1 deletion

File tree

HISTORY.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@ History
1313
* ``paytm``
1414
* ``razorpay``
1515
* ``systempay``
16+
* Added support for the following new subscores in Factors responses:
17+
* ``device``: the risk associated with the device
18+
* ``email_local_part``: the risk associated with the email address local part
19+
* ``shipping_address``: the risk associated with the shipping address
1620

1721
1.12.1 (2020-06-17)
1822
+++++++++++++++++++

minfraud/models.py

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -727,7 +727,7 @@ class Subscores(object):
727727
728728
The risk associated with the combination of IP country, card issuer
729729
country, billing country, and shipping country. If present, this is a
730-
value in the range 0.01 to 99.
730+
value in the range 0.01 to 99.
731731
732732
:type: float | None
733733
@@ -738,6 +738,13 @@ class Subscores(object):
738738
739739
:type: float | None
740740
741+
.. attribute:: device
742+
743+
The risk associated with the device. If present, this is a value in the
744+
range 0.01 to 99.
745+
746+
:type: float | None
747+
741748
.. attribute:: email_address
742749
743750
The risk associated with the particular email address. If present, this
@@ -752,6 +759,14 @@ class Subscores(object):
752759
753760
:type: float | None
754761
762+
.. attribute:: email_local_part
763+
764+
The risk associated with the email address local part (the part of the
765+
email address before the @ symbol). If present, this is a value in the
766+
range 0.01 to 99.
767+
768+
:type: float | None
769+
755770
.. attribute:: email_tenure
756771
757772
The risk associated with the issuer ID number on the email domain. If
@@ -804,6 +819,13 @@ class Subscores(object):
804819
805820
:type: float | None
806821
822+
.. attribute:: shipping_address
823+
824+
The risk associated with the shipping address. If present, this is a
825+
value in the range 0.01 to 99.
826+
827+
:type: float | None
828+
807829
.. attribute:: shipping_address_distance_to_ip_location
808830
809831
The risk associated with the distance between the shipping address and
@@ -831,13 +853,16 @@ class Subscores(object):
831853
"country": None,
832854
"country_mismatch": None,
833855
"cvv_result": None,
856+
"device": None,
834857
"email_address": None,
835858
"email_domain": None,
859+
"email_local_part": None,
836860
"email_tenure": None,
837861
"ip_tenure": None,
838862
"issuer_id_number": None,
839863
"order_amount": None,
840864
"phone_number": None,
865+
"shipping_address": None,
841866
"shipping_address_distance_to_ip_location": None,
842867
"time_of_day": None,
843868
}

tests/data/factors-response.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,13 +154,16 @@
154154
"country": 0.06,
155155
"country_mismatch": 0.07,
156156
"cvv_result": 0.08,
157+
"device": 0.18,
157158
"email_address": 0.09,
158159
"email_domain": 0.1,
160+
"email_local_part": 0.19,
159161
"email_tenure": 0.11,
160162
"ip_tenure": 0.12,
161163
"issuer_id_number": 0.13,
162164
"order_amount": 0.14,
163165
"phone_number": 0.15,
166+
"shipping_address": 0.2,
164167
"shipping_address_distance_to_ip_location": 0.16,
165168
"time_of_day": 0.17
166169
},

tests/test_models.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -265,13 +265,16 @@ def test_factors(self):
265265
self.assertEqual(0.06, factors.subscores.country)
266266
self.assertEqual(0.07, factors.subscores.country_mismatch)
267267
self.assertEqual(0.08, factors.subscores.cvv_result)
268+
self.assertEqual(0.18, factors.subscores.device)
268269
self.assertEqual(0.09, factors.subscores.email_address)
269270
self.assertEqual(0.10, factors.subscores.email_domain)
271+
self.assertEqual(0.19, factors.subscores.email_local_part)
270272
self.assertEqual(0.11, factors.subscores.email_tenure)
271273
self.assertEqual(0.12, factors.subscores.ip_tenure)
272274
self.assertEqual(0.13, factors.subscores.issuer_id_number)
273275
self.assertEqual(0.14, factors.subscores.order_amount)
274276
self.assertEqual(0.15, factors.subscores.phone_number)
277+
self.assertEqual(0.2, factors.subscores.shipping_address)
275278
self.assertEqual(
276279
0.16, factors.subscores.shipping_address_distance_to_ip_location
277280
)
@@ -304,13 +307,16 @@ def factors_response(self):
304307
"country": 0.06,
305308
"country_mismatch": 0.07,
306309
"cvv_result": 0.08,
310+
"device": 0.18,
307311
"email_address": 0.09,
308312
"email_domain": 0.10,
313+
"email_local_part": 0.19,
309314
"email_tenure": 0.11,
310315
"ip_tenure": 0.12,
311316
"issuer_id_number": 0.13,
312317
"order_amount": 0.14,
313318
"phone_number": 0.15,
319+
"shipping_address": 0.2,
314320
"shipping_address_distance_to_ip_location": 0.16,
315321
"time_of_day": 0.17,
316322
},

0 commit comments

Comments
 (0)