minfraud 3.2.0__tar.gz → 3.3.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {minfraud-3.2.0 → minfraud-3.3.0}/HISTORY.rst +24 -0
- {minfraud-3.2.0 → minfraud-3.3.0}/PKG-INFO +18 -19
- {minfraud-3.2.0 → minfraud-3.3.0}/README.rst +12 -13
- {minfraud-3.2.0 → minfraud-3.3.0}/pyproject.toml +8 -9
- {minfraud-3.2.0 → minfraud-3.3.0}/src/minfraud/__init__.py +0 -2
- {minfraud-3.2.0 → minfraud-3.3.0}/src/minfraud/models.py +24 -24
- {minfraud-3.2.0 → minfraud-3.3.0}/src/minfraud/validation.py +6 -1
- minfraud-3.3.0/src/minfraud/version.py +5 -0
- {minfraud-3.2.0 → minfraud-3.3.0}/src/minfraud/webservice.py +20 -14
- {minfraud-3.2.0 → minfraud-3.3.0}/tests/test_models.py +64 -0
- {minfraud-3.2.0 → minfraud-3.3.0}/tests/test_validation.py +10 -1
- {minfraud-3.2.0 → minfraud-3.3.0}/tests/test_webservice.py +19 -0
- minfraud-3.2.0/src/minfraud/version.py +0 -3
- {minfraud-3.2.0 → minfraud-3.3.0}/LICENSE +0 -0
- {minfraud-3.2.0 → minfraud-3.3.0}/src/minfraud/errors.py +0 -0
- {minfraud-3.2.0 → minfraud-3.3.0}/src/minfraud/py.typed +0 -0
- {minfraud-3.2.0 → minfraud-3.3.0}/src/minfraud/request.py +0 -0
- {minfraud-3.2.0 → minfraud-3.3.0}/tests/__init__.py +0 -0
- {minfraud-3.2.0 → minfraud-3.3.0}/tests/test_request.py +0 -0
|
@@ -3,6 +3,30 @@
|
|
|
3
3
|
History
|
|
4
4
|
-------
|
|
5
5
|
|
|
6
|
+
3.3.0 (2026-07-21)
|
|
7
|
+
++++++++++++++++++
|
|
8
|
+
|
|
9
|
+
* Added ``tracking_token`` to the ``/device`` request object. This is the
|
|
10
|
+
token generated by the `Device Tracking Add-on
|
|
11
|
+
<https://dev.maxmind.com/minfraud/track-devices>`_ for explicit device
|
|
12
|
+
linking.
|
|
13
|
+
* Added ``banquest``, ``fat_zebra``, ``summit_payments``, and ``yaadpay`` to
|
|
14
|
+
the ``/payment/processor`` validation.
|
|
15
|
+
* Added ``clear`` to the valid values for the ``tag`` parameter on the
|
|
16
|
+
Report Transaction API.
|
|
17
|
+
* The version is now retrieved from package metadata at runtime using
|
|
18
|
+
``importlib.metadata``. This reduces the chance of version inconsistencies
|
|
19
|
+
during releases.
|
|
20
|
+
* The async client now builds its ``Authorization`` header with
|
|
21
|
+
``aiohttp.encode_basic_auth()`` instead of the ``aiohttp.BasicAuth`` /
|
|
22
|
+
``auth=`` parameter, which are deprecated as of aiohttp 3.14.0. As a result,
|
|
23
|
+
the minimum required ``aiohttp`` version is now 3.14.0.
|
|
24
|
+
* The ``ip_address.anonymizer`` object may now contain a ``residential``
|
|
25
|
+
attribute. This is a ``geoip2.records.AnonymizerFeed`` object containing
|
|
26
|
+
residential proxy data for the network. It has the following fields:
|
|
27
|
+
``confidence``, ``network_last_seen``, and ``provider_name``. It may be
|
|
28
|
+
populated even when no other ``anonymizer`` attributes are set.
|
|
29
|
+
|
|
6
30
|
3.2.0 (2025-11-20)
|
|
7
31
|
++++++++++++++++++
|
|
8
32
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: minfraud
|
|
3
|
-
Version: 3.
|
|
3
|
+
Version: 3.3.0
|
|
4
4
|
Summary: MaxMind minFraud API
|
|
5
5
|
Author: Gregory Oschwald
|
|
6
6
|
Author-email: Gregory Oschwald <goschwald@maxmind.com>
|
|
@@ -19,17 +19,17 @@ Classifier: Programming Language :: Python :: 3.14
|
|
|
19
19
|
Classifier: Topic :: Internet
|
|
20
20
|
Classifier: Topic :: Internet :: Proxy Servers
|
|
21
21
|
Classifier: Topic :: Internet :: WWW/HTTP
|
|
22
|
-
Requires-Dist: aiohttp>=3.
|
|
22
|
+
Requires-Dist: aiohttp>=3.14.0,<4.0.0
|
|
23
23
|
Requires-Dist: email-validator>=2.0.0,<3.0.0
|
|
24
|
-
Requires-Dist: geoip2>=5.
|
|
24
|
+
Requires-Dist: geoip2>=5.3.0,<6.0.0
|
|
25
25
|
Requires-Dist: requests>=2.24.0,<3.0.0
|
|
26
26
|
Requires-Dist: typing-extensions>=4.13.2
|
|
27
27
|
Requires-Dist: voluptuous
|
|
28
28
|
Requires-Python: >=3.10
|
|
29
|
-
Project-URL:
|
|
30
|
-
Project-URL:
|
|
31
|
-
Project-URL: Issue Tracker, https://github.com/maxmind/minfraud-api-python/issues
|
|
29
|
+
Project-URL: Homepage, https://www.maxmind.com/en/home
|
|
30
|
+
Project-URL: Documentation, https://minfraud.readthedocs.io/en/latest/
|
|
32
31
|
Project-URL: Source Code, https://github.com/maxmind/minfraud-api-python
|
|
32
|
+
Project-URL: Issue Tracker, https://github.com/maxmind/minfraud-api-python/issues
|
|
33
33
|
Description-Content-Type: text/x-rst
|
|
34
34
|
|
|
35
35
|
===================
|
|
@@ -42,7 +42,7 @@ Description
|
|
|
42
42
|
This package provides an API for the `MaxMind minFraud Score, Insights, and
|
|
43
43
|
Factors web services <https://dev.maxmind.com/minfraud/>`_ as well as the
|
|
44
44
|
`Report Transaction web service
|
|
45
|
-
<https://dev.maxmind.com/minfraud/report-a-transaction
|
|
45
|
+
<https://dev.maxmind.com/minfraud/report-a-transaction/?lang=en>`_.
|
|
46
46
|
|
|
47
47
|
Installation
|
|
48
48
|
------------
|
|
@@ -64,7 +64,7 @@ Documentation
|
|
|
64
64
|
-------------
|
|
65
65
|
|
|
66
66
|
Complete API documentation is available on `Read the Docs
|
|
67
|
-
<https://minfraud.readthedocs.io/>`_.
|
|
67
|
+
<https://minfraud.readthedocs.io/en/latest/>`_.
|
|
68
68
|
|
|
69
69
|
Usage
|
|
70
70
|
-----
|
|
@@ -113,7 +113,7 @@ The Score web service is called with the ``score()`` method:
|
|
|
113
113
|
Each of these methods takes a dictionary representing the transaction to be sent
|
|
114
114
|
to the web service. The structure of this dictionary should be in `the format
|
|
115
115
|
specified in the REST API documentation
|
|
116
|
-
<https://dev.maxmind.com/minfraud/api-documentation/requests
|
|
116
|
+
<https://dev.maxmind.com/minfraud/api-documentation/requests/?lang=en>`__.
|
|
117
117
|
All fields are optional.
|
|
118
118
|
|
|
119
119
|
Report Transactions Usage
|
|
@@ -131,7 +131,7 @@ Report Transaction web service is called with the ``report()`` method:
|
|
|
131
131
|
The method takes a dictionary representing the report to be sent to the web
|
|
132
132
|
service. The structure of this dictionary should be in `the format specified
|
|
133
133
|
in the REST API documentation
|
|
134
|
-
<https://dev.maxmind.com/minfraud/report-a-transaction
|
|
134
|
+
<https://dev.maxmind.com/minfraud/report-a-transaction/?lang=en>`__. The
|
|
135
135
|
required fields are ``tag`` and one or more of the following: ``ip_address``,
|
|
136
136
|
``maxmind_id``, ``minfraud_id``, ``transaction_id``.
|
|
137
137
|
|
|
@@ -168,7 +168,7 @@ The possible errors are:
|
|
|
168
168
|
Additionally, ``score``, ``insights`` and ``factors`` may also raise:
|
|
169
169
|
|
|
170
170
|
* ``minfraud.InsufficientFundsError`` - This will be raised when `your
|
|
171
|
-
account <https://www.maxmind.com/en/
|
|
171
|
+
account <https://www.maxmind.com/en/accounts/current/people/current>`_ is out of funds.
|
|
172
172
|
|
|
173
173
|
Examples
|
|
174
174
|
--------
|
|
@@ -187,6 +187,7 @@ Score, Insights and Factors Example
|
|
|
187
187
|
>>> 'accept_language': 'en-US,en;q=0.8',
|
|
188
188
|
>>> 'session_age': 3600,
|
|
189
189
|
>>> 'session_id': 'a333a4e127f880d8820e56a66f40717c',
|
|
190
|
+
>>> 'tracking_token': '...',
|
|
190
191
|
>>> 'user_agent': 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2272.89 Safari/537.36'
|
|
191
192
|
>>> },
|
|
192
193
|
>>> 'event': {
|
|
@@ -239,6 +240,7 @@ Score, Insights and Factors Example
|
|
|
239
240
|
>>> 'cvv_result': 'N',
|
|
240
241
|
>>> 'bank_name': 'Bank of No Hope',
|
|
241
242
|
>>> 'issuer_id_number': '411111',
|
|
243
|
+
>>> 'token': '123456abc1234',
|
|
242
244
|
>>> 'was_3d_secure_successful': True
|
|
243
245
|
>>> },
|
|
244
246
|
>>> 'payment': {
|
|
@@ -264,7 +266,9 @@ Score, Insights and Factors Example
|
|
|
264
266
|
>>> 'subaffiliate_id': 'saf42',
|
|
265
267
|
>>> 'discount_code': 'FIRST',
|
|
266
268
|
>>> 'currency': 'USD',
|
|
267
|
-
>>> 'amount': 323.21
|
|
269
|
+
>>> 'amount': 323.21,
|
|
270
|
+
>>> 'is_gift': True,
|
|
271
|
+
>>> 'has_gift_message': True
|
|
268
272
|
>>> },
|
|
269
273
|
>>> 'custom_inputs': {
|
|
270
274
|
>>> 'section': 'news',
|
|
@@ -340,11 +344,6 @@ For asynchronous reporting:
|
|
|
340
344
|
>>>
|
|
341
345
|
>>> asyncio.run(report())
|
|
342
346
|
|
|
343
|
-
Requirements
|
|
344
|
-
------------
|
|
345
|
-
|
|
346
|
-
Python 3.9 or greater is required. Older versions are not supported.
|
|
347
|
-
|
|
348
347
|
Versioning
|
|
349
348
|
----------
|
|
350
349
|
|
|
@@ -357,12 +356,12 @@ Please report all issues with this code using the `GitHub issue tracker
|
|
|
357
356
|
<https://github.com/maxmind/minfraud-api-python/issues>`_.
|
|
358
357
|
|
|
359
358
|
If you are having an issue with a MaxMind service that is not specific to the
|
|
360
|
-
client API, please contact `MaxMind support <https://
|
|
359
|
+
client API, please contact `MaxMind support <https://support.maxmind.com/knowledge-base>`_
|
|
361
360
|
for assistance.
|
|
362
361
|
|
|
363
362
|
Copyright and License
|
|
364
363
|
---------------------
|
|
365
364
|
|
|
366
|
-
This software is Copyright © 2015-
|
|
365
|
+
This software is Copyright © 2015-2026 by MaxMind, Inc.
|
|
367
366
|
|
|
368
367
|
This is free software, licensed under the Apache License, Version 2.0.
|
|
@@ -8,7 +8,7 @@ Description
|
|
|
8
8
|
This package provides an API for the `MaxMind minFraud Score, Insights, and
|
|
9
9
|
Factors web services <https://dev.maxmind.com/minfraud/>`_ as well as the
|
|
10
10
|
`Report Transaction web service
|
|
11
|
-
<https://dev.maxmind.com/minfraud/report-a-transaction
|
|
11
|
+
<https://dev.maxmind.com/minfraud/report-a-transaction/?lang=en>`_.
|
|
12
12
|
|
|
13
13
|
Installation
|
|
14
14
|
------------
|
|
@@ -30,7 +30,7 @@ Documentation
|
|
|
30
30
|
-------------
|
|
31
31
|
|
|
32
32
|
Complete API documentation is available on `Read the Docs
|
|
33
|
-
<https://minfraud.readthedocs.io/>`_.
|
|
33
|
+
<https://minfraud.readthedocs.io/en/latest/>`_.
|
|
34
34
|
|
|
35
35
|
Usage
|
|
36
36
|
-----
|
|
@@ -79,7 +79,7 @@ The Score web service is called with the ``score()`` method:
|
|
|
79
79
|
Each of these methods takes a dictionary representing the transaction to be sent
|
|
80
80
|
to the web service. The structure of this dictionary should be in `the format
|
|
81
81
|
specified in the REST API documentation
|
|
82
|
-
<https://dev.maxmind.com/minfraud/api-documentation/requests
|
|
82
|
+
<https://dev.maxmind.com/minfraud/api-documentation/requests/?lang=en>`__.
|
|
83
83
|
All fields are optional.
|
|
84
84
|
|
|
85
85
|
Report Transactions Usage
|
|
@@ -97,7 +97,7 @@ Report Transaction web service is called with the ``report()`` method:
|
|
|
97
97
|
The method takes a dictionary representing the report to be sent to the web
|
|
98
98
|
service. The structure of this dictionary should be in `the format specified
|
|
99
99
|
in the REST API documentation
|
|
100
|
-
<https://dev.maxmind.com/minfraud/report-a-transaction
|
|
100
|
+
<https://dev.maxmind.com/minfraud/report-a-transaction/?lang=en>`__. The
|
|
101
101
|
required fields are ``tag`` and one or more of the following: ``ip_address``,
|
|
102
102
|
``maxmind_id``, ``minfraud_id``, ``transaction_id``.
|
|
103
103
|
|
|
@@ -134,7 +134,7 @@ The possible errors are:
|
|
|
134
134
|
Additionally, ``score``, ``insights`` and ``factors`` may also raise:
|
|
135
135
|
|
|
136
136
|
* ``minfraud.InsufficientFundsError`` - This will be raised when `your
|
|
137
|
-
account <https://www.maxmind.com/en/
|
|
137
|
+
account <https://www.maxmind.com/en/accounts/current/people/current>`_ is out of funds.
|
|
138
138
|
|
|
139
139
|
Examples
|
|
140
140
|
--------
|
|
@@ -153,6 +153,7 @@ Score, Insights and Factors Example
|
|
|
153
153
|
>>> 'accept_language': 'en-US,en;q=0.8',
|
|
154
154
|
>>> 'session_age': 3600,
|
|
155
155
|
>>> 'session_id': 'a333a4e127f880d8820e56a66f40717c',
|
|
156
|
+
>>> 'tracking_token': '...',
|
|
156
157
|
>>> 'user_agent': 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2272.89 Safari/537.36'
|
|
157
158
|
>>> },
|
|
158
159
|
>>> 'event': {
|
|
@@ -205,6 +206,7 @@ Score, Insights and Factors Example
|
|
|
205
206
|
>>> 'cvv_result': 'N',
|
|
206
207
|
>>> 'bank_name': 'Bank of No Hope',
|
|
207
208
|
>>> 'issuer_id_number': '411111',
|
|
209
|
+
>>> 'token': '123456abc1234',
|
|
208
210
|
>>> 'was_3d_secure_successful': True
|
|
209
211
|
>>> },
|
|
210
212
|
>>> 'payment': {
|
|
@@ -230,7 +232,9 @@ Score, Insights and Factors Example
|
|
|
230
232
|
>>> 'subaffiliate_id': 'saf42',
|
|
231
233
|
>>> 'discount_code': 'FIRST',
|
|
232
234
|
>>> 'currency': 'USD',
|
|
233
|
-
>>> 'amount': 323.21
|
|
235
|
+
>>> 'amount': 323.21,
|
|
236
|
+
>>> 'is_gift': True,
|
|
237
|
+
>>> 'has_gift_message': True
|
|
234
238
|
>>> },
|
|
235
239
|
>>> 'custom_inputs': {
|
|
236
240
|
>>> 'section': 'news',
|
|
@@ -306,11 +310,6 @@ For asynchronous reporting:
|
|
|
306
310
|
>>>
|
|
307
311
|
>>> asyncio.run(report())
|
|
308
312
|
|
|
309
|
-
Requirements
|
|
310
|
-
------------
|
|
311
|
-
|
|
312
|
-
Python 3.9 or greater is required. Older versions are not supported.
|
|
313
|
-
|
|
314
313
|
Versioning
|
|
315
314
|
----------
|
|
316
315
|
|
|
@@ -323,12 +322,12 @@ Please report all issues with this code using the `GitHub issue tracker
|
|
|
323
322
|
<https://github.com/maxmind/minfraud-api-python/issues>`_.
|
|
324
323
|
|
|
325
324
|
If you are having an issue with a MaxMind service that is not specific to the
|
|
326
|
-
client API, please contact `MaxMind support <https://
|
|
325
|
+
client API, please contact `MaxMind support <https://support.maxmind.com/knowledge-base>`_
|
|
327
326
|
for assistance.
|
|
328
327
|
|
|
329
328
|
Copyright and License
|
|
330
329
|
---------------------
|
|
331
330
|
|
|
332
|
-
This software is Copyright © 2015-
|
|
331
|
+
This software is Copyright © 2015-2026 by MaxMind, Inc.
|
|
333
332
|
|
|
334
333
|
This is free software, licensed under the Apache License, Version 2.0.
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "minfraud"
|
|
3
|
-
version = "3.
|
|
3
|
+
version = "3.3.0"
|
|
4
4
|
description = "MaxMind minFraud API"
|
|
5
5
|
authors = [
|
|
6
6
|
{name = "Gregory Oschwald", email = "goschwald@maxmind.com"},
|
|
7
7
|
]
|
|
8
8
|
dependencies = [
|
|
9
|
-
"aiohttp>=3.
|
|
9
|
+
"aiohttp>=3.14.0,<4.0.0",
|
|
10
10
|
"email_validator>=2.0.0,<3.0.0",
|
|
11
|
-
"geoip2>=5.
|
|
11
|
+
"geoip2>=5.3.0,<6.0.0",
|
|
12
12
|
"requests>=2.24.0,<3.0.0",
|
|
13
13
|
"typing-extensions>=4.13.2",
|
|
14
14
|
"voluptuous",
|
|
@@ -42,17 +42,16 @@ dev = [
|
|
|
42
42
|
lint = [
|
|
43
43
|
"mypy>=1.15.0",
|
|
44
44
|
"ruff>=0.11.6",
|
|
45
|
-
"types-requests>=2.32.0.20250328",
|
|
46
45
|
]
|
|
47
46
|
|
|
48
47
|
[project.urls]
|
|
49
|
-
Homepage = "https://www.maxmind.com/"
|
|
50
|
-
Documentation = "https://minfraud.readthedocs.
|
|
48
|
+
Homepage = "https://www.maxmind.com/en/home"
|
|
49
|
+
Documentation = "https://minfraud.readthedocs.io/en/latest/"
|
|
51
50
|
"Source Code" = "https://github.com/maxmind/minfraud-api-python"
|
|
52
51
|
"Issue Tracker" = "https://github.com/maxmind/minfraud-api-python/issues"
|
|
53
52
|
|
|
54
53
|
[build-system]
|
|
55
|
-
requires = ["uv_build>=0.
|
|
54
|
+
requires = ["uv_build>=0.10.0,<0.12.0"]
|
|
56
55
|
build-backend = "uv_build"
|
|
57
56
|
|
|
58
57
|
[tool.uv.build-backend]
|
|
@@ -93,8 +92,7 @@ ignorelist = ["id"]
|
|
|
93
92
|
|
|
94
93
|
[tool.ruff.lint.per-file-ignores]
|
|
95
94
|
"docs/*" = ["ALL"]
|
|
96
|
-
"src/minfraud/models.py" = ["
|
|
97
|
-
"src/minfraud/webservice.py" = ["ANN401"]
|
|
95
|
+
"src/minfraud/models.py" = ["PLR0913"]
|
|
98
96
|
"tests/*" = ["ANN201", "D"]
|
|
99
97
|
|
|
100
98
|
[tool.tox]
|
|
@@ -109,6 +107,7 @@ env_list = [
|
|
|
109
107
|
skip_missing_interpreters = false
|
|
110
108
|
|
|
111
109
|
[tool.tox.env_run_base]
|
|
110
|
+
runner = "uv-venv-lock-runner"
|
|
112
111
|
dependency_groups = [
|
|
113
112
|
"dev",
|
|
114
113
|
]
|
|
@@ -97,17 +97,17 @@ class GeoIP2Location(geoip2.records.Location):
|
|
|
97
97
|
local_time: str | None
|
|
98
98
|
"""The date and time of the transaction in the time
|
|
99
99
|
zone associated with the IP address. The value is formatted according to
|
|
100
|
-
`RFC 3339 <https://
|
|
100
|
+
`RFC 3339 <https://datatracker.ietf.org/doc/html/rfc3339>`_. For instance, the
|
|
101
101
|
local time in Boston might be returned as 2015-04-27T19:17:24-04:00."""
|
|
102
102
|
|
|
103
|
-
def __init__(self, *args: Any, **kwargs: Any) -> None:
|
|
103
|
+
def __init__(self, *args: Any, **kwargs: Any) -> None: # noqa: ANN401
|
|
104
104
|
"""Initialize a GeoIP2Location instance."""
|
|
105
105
|
self.local_time = kwargs.get("local_time")
|
|
106
106
|
super().__init__(*args, **kwargs)
|
|
107
107
|
|
|
108
108
|
|
|
109
109
|
class IPAddress(geoip2.models.Insights):
|
|
110
|
-
"""Model for minFraud and
|
|
110
|
+
"""Model for minFraud and GeoIP data about the IP address.
|
|
111
111
|
|
|
112
112
|
This class inherits from :py:class:`geoip2.models.Insights`. In addition
|
|
113
113
|
to the attributes provided by that class, it provides the ``risk`` and
|
|
@@ -135,7 +135,7 @@ class IPAddress(geoip2.models.Insights):
|
|
|
135
135
|
location: dict[str, Any] | None = None,
|
|
136
136
|
risk: float | None = None,
|
|
137
137
|
risk_reasons: list[dict[str, Any]] | None = None,
|
|
138
|
-
**kwargs: Any,
|
|
138
|
+
**kwargs: Any, # noqa: ANN401
|
|
139
139
|
) -> None:
|
|
140
140
|
"""Initialize an IPAddress instance."""
|
|
141
141
|
# For raw attribute
|
|
@@ -161,7 +161,7 @@ class ScoreIPAddress(_Serializable):
|
|
|
161
161
|
"""This field contains the risk associated with the IP address. The value
|
|
162
162
|
ranges from 0.01 to 99. A higher score indicates a higher risk."""
|
|
163
163
|
|
|
164
|
-
def __init__(self, *, risk: float | None = None, **_:
|
|
164
|
+
def __init__(self, *, risk: float | None = None, **_: object) -> None:
|
|
165
165
|
"""Initialize a ScoreIPAddress instance."""
|
|
166
166
|
self.risk = risk
|
|
167
167
|
|
|
@@ -197,7 +197,7 @@ class Issuer(_Serializable):
|
|
|
197
197
|
matches_provided_name: bool | None = None,
|
|
198
198
|
phone_number: str | None = None,
|
|
199
199
|
matches_provided_phone_number: bool | None = None,
|
|
200
|
-
**_:
|
|
200
|
+
**_: object,
|
|
201
201
|
) -> None:
|
|
202
202
|
"""Initialize an Issuer instance."""
|
|
203
203
|
self.name = name
|
|
@@ -211,7 +211,7 @@ class Device(_Serializable):
|
|
|
211
211
|
|
|
212
212
|
In order to receive device output from minFraud Insights or minFraud
|
|
213
213
|
Factors, you must be using the `Device Tracking Add-on
|
|
214
|
-
<https://dev.maxmind.com/minfraud/track-devices
|
|
214
|
+
<https://dev.maxmind.com/minfraud/track-devices/?lang=en>`_.
|
|
215
215
|
"""
|
|
216
216
|
|
|
217
217
|
confidence: float | None
|
|
@@ -239,7 +239,7 @@ class Device(_Serializable):
|
|
|
239
239
|
id: str | None = None,
|
|
240
240
|
last_seen: str | None = None,
|
|
241
241
|
local_time: str | None = None,
|
|
242
|
-
**_:
|
|
242
|
+
**_: object,
|
|
243
243
|
) -> None:
|
|
244
244
|
"""Initialize a Device instance."""
|
|
245
245
|
self.confidence = confidence
|
|
@@ -277,7 +277,7 @@ class Disposition(_Serializable):
|
|
|
277
277
|
action: str | None = None,
|
|
278
278
|
reason: str | None = None,
|
|
279
279
|
rule_label: str | None = None,
|
|
280
|
-
**_:
|
|
280
|
+
**_: object,
|
|
281
281
|
) -> None:
|
|
282
282
|
"""Initialize a Disposition instance."""
|
|
283
283
|
self.action = action
|
|
@@ -310,7 +310,7 @@ class EmailDomainVisit(_Serializable):
|
|
|
310
310
|
status: str | None = None,
|
|
311
311
|
last_visited_on: str | None = None,
|
|
312
312
|
has_redirect: bool | None = None,
|
|
313
|
-
**_:
|
|
313
|
+
**_: object,
|
|
314
314
|
) -> None:
|
|
315
315
|
"""Initialize an EmailDomainVisit instance."""
|
|
316
316
|
self.status = status
|
|
@@ -354,7 +354,7 @@ class EmailDomain(_Serializable):
|
|
|
354
354
|
risk: float | None = None,
|
|
355
355
|
volume: float | None = None,
|
|
356
356
|
visit: dict[str, Any] | None = None,
|
|
357
|
-
**_:
|
|
357
|
+
**_: object,
|
|
358
358
|
) -> None:
|
|
359
359
|
"""Initialize an EmailDomain instance."""
|
|
360
360
|
self.first_seen = first_seen
|
|
@@ -498,7 +498,7 @@ class BillingAddress(_Serializable):
|
|
|
498
498
|
longitude: float | None = None,
|
|
499
499
|
distance_to_ip_location: int | None = None,
|
|
500
500
|
is_in_ip_country: bool | None = None,
|
|
501
|
-
**_:
|
|
501
|
+
**_: object,
|
|
502
502
|
) -> None:
|
|
503
503
|
"""Initialize a BillingAddress instance."""
|
|
504
504
|
self.is_postal_in_city = is_postal_in_city
|
|
@@ -553,7 +553,7 @@ class ShippingAddress(_Serializable):
|
|
|
553
553
|
is_in_ip_country: bool | None = None,
|
|
554
554
|
is_high_risk: bool | None = None,
|
|
555
555
|
distance_to_billing_address: int | None = None,
|
|
556
|
-
**_:
|
|
556
|
+
**_: object,
|
|
557
557
|
) -> None:
|
|
558
558
|
"""Initialize a ShippingAddress instance."""
|
|
559
559
|
self.is_postal_in_city = is_postal_in_city
|
|
@@ -604,7 +604,7 @@ class Phone(_Serializable):
|
|
|
604
604
|
matches_postal: bool | None = None,
|
|
605
605
|
network_operator: str | None = None,
|
|
606
606
|
number_type: str | None = None,
|
|
607
|
-
**_:
|
|
607
|
+
**_: object,
|
|
608
608
|
) -> None:
|
|
609
609
|
"""Initialize a Phone instance."""
|
|
610
610
|
self.country = country
|
|
@@ -620,7 +620,7 @@ class ServiceWarning(_Serializable):
|
|
|
620
620
|
code: str | None
|
|
621
621
|
"""This value is a machine-readable code identifying the
|
|
622
622
|
warning. See the `response warnings documentation
|
|
623
|
-
<https://dev.maxmind.com/minfraud/api-documentation/responses
|
|
623
|
+
<https://dev.maxmind.com/minfraud/api-documentation/responses/?lang=en#schema--response--warning>`_
|
|
624
624
|
for the current list of of warning codes."""
|
|
625
625
|
|
|
626
626
|
warning: str | None
|
|
@@ -639,7 +639,7 @@ class ServiceWarning(_Serializable):
|
|
|
639
639
|
code: str | None = None,
|
|
640
640
|
warning: str | None = None,
|
|
641
641
|
input_pointer: str | None = None,
|
|
642
|
-
**_:
|
|
642
|
+
**_: object,
|
|
643
643
|
) -> None:
|
|
644
644
|
"""Initialize a ServiceWarning instance."""
|
|
645
645
|
self.code = code
|
|
@@ -783,7 +783,7 @@ class Subscores(_Serializable):
|
|
|
783
783
|
shipping_address: float | None = None,
|
|
784
784
|
shipping_address_distance_to_ip_location: float | None = None,
|
|
785
785
|
time_of_day: float | None = None,
|
|
786
|
-
**_:
|
|
786
|
+
**_: object,
|
|
787
787
|
) -> None:
|
|
788
788
|
"""Initialize a Subscores instance."""
|
|
789
789
|
self.avs_result = avs_result
|
|
@@ -897,7 +897,7 @@ class Reason(_Serializable):
|
|
|
897
897
|
*,
|
|
898
898
|
code: str | None = None,
|
|
899
899
|
reason: str | None = None,
|
|
900
|
-
**_:
|
|
900
|
+
**_: object,
|
|
901
901
|
) -> None:
|
|
902
902
|
"""Initialize a Reason instance."""
|
|
903
903
|
self.code = code
|
|
@@ -922,7 +922,7 @@ class RiskScoreReason(_Serializable):
|
|
|
922
922
|
*,
|
|
923
923
|
multiplier: float,
|
|
924
924
|
reasons: list[dict[str, Any]] | None = None,
|
|
925
|
-
**_:
|
|
925
|
+
**_: object,
|
|
926
926
|
) -> None:
|
|
927
927
|
"""Initialize a RiskScoreReason instance."""
|
|
928
928
|
self.multiplier = multiplier
|
|
@@ -966,7 +966,7 @@ class Factors(_Serializable):
|
|
|
966
966
|
easily identify a particular request."""
|
|
967
967
|
|
|
968
968
|
ip_address: IPAddress
|
|
969
|
-
"""A :class:`.IPAddress` object containing
|
|
969
|
+
"""A :class:`.IPAddress` object containing GeoIP and
|
|
970
970
|
minFraud Insights information about the IP address."""
|
|
971
971
|
|
|
972
972
|
queries_remaining: int
|
|
@@ -1030,7 +1030,7 @@ class Factors(_Serializable):
|
|
|
1030
1030
|
subscores: dict[str, Any] | None = None,
|
|
1031
1031
|
warnings: list[dict[str, Any]] | None = None,
|
|
1032
1032
|
risk_score_reasons: list[dict[str, Any]] | None = None,
|
|
1033
|
-
**_:
|
|
1033
|
+
**_: object,
|
|
1034
1034
|
) -> None:
|
|
1035
1035
|
"""Initialize a Factors instance."""
|
|
1036
1036
|
self.billing_address = BillingAddress(**(billing_address or {}))
|
|
@@ -1090,7 +1090,7 @@ class Insights(_Serializable):
|
|
|
1090
1090
|
easily identify a particular request."""
|
|
1091
1091
|
|
|
1092
1092
|
ip_address: IPAddress
|
|
1093
|
-
"""A :class:`.IPAddress` object containing
|
|
1093
|
+
"""A :class:`.IPAddress` object containing GeoIP and
|
|
1094
1094
|
minFraud Insights information about the IP address."""
|
|
1095
1095
|
|
|
1096
1096
|
queries_remaining: int
|
|
@@ -1136,7 +1136,7 @@ class Insights(_Serializable):
|
|
|
1136
1136
|
shipping_address: dict[str, Any] | None = None,
|
|
1137
1137
|
shipping_phone: dict[str, Any] | None = None,
|
|
1138
1138
|
warnings: list[dict[str, Any]] | None = None,
|
|
1139
|
-
**_:
|
|
1139
|
+
**_: object,
|
|
1140
1140
|
) -> None:
|
|
1141
1141
|
"""Initialize an Insights instance."""
|
|
1142
1142
|
self.billing_address = BillingAddress(**(billing_address or {}))
|
|
@@ -1201,7 +1201,7 @@ class Score(_Serializable):
|
|
|
1201
1201
|
queries_remaining: int,
|
|
1202
1202
|
risk_score: float,
|
|
1203
1203
|
warnings: list[dict[str, Any]] | None = None,
|
|
1204
|
-
**_:
|
|
1204
|
+
**_: object,
|
|
1205
1205
|
) -> None:
|
|
1206
1206
|
"""Initialize a Score instance."""
|
|
1207
1207
|
self.disposition = Disposition(**(disposition or {}))
|
|
@@ -126,6 +126,7 @@ _payment_processor = In(
|
|
|
126
126
|
"aps_payments",
|
|
127
127
|
"authorizenet",
|
|
128
128
|
"balanced",
|
|
129
|
+
"banquest",
|
|
129
130
|
"beanstream",
|
|
130
131
|
"bluepay",
|
|
131
132
|
"bluesnap",
|
|
@@ -174,6 +175,7 @@ _payment_processor = In(
|
|
|
174
175
|
"epx",
|
|
175
176
|
"eway",
|
|
176
177
|
"exact",
|
|
178
|
+
"fat_zebra",
|
|
177
179
|
"first_atlantic_commerce",
|
|
178
180
|
"first_data",
|
|
179
181
|
"fiserv",
|
|
@@ -257,6 +259,7 @@ _payment_processor = In(
|
|
|
257
259
|
"solidtrust_pay",
|
|
258
260
|
"sps_decidir",
|
|
259
261
|
"stripe",
|
|
262
|
+
"summit_payments",
|
|
260
263
|
"synapsefi",
|
|
261
264
|
"systempay",
|
|
262
265
|
"telerecargas",
|
|
@@ -276,6 +279,7 @@ _payment_processor = In(
|
|
|
276
279
|
"windcave",
|
|
277
280
|
"wirecard",
|
|
278
281
|
"worldpay",
|
|
282
|
+
"yaadpay",
|
|
279
283
|
],
|
|
280
284
|
)
|
|
281
285
|
|
|
@@ -361,6 +365,7 @@ validate_transaction: Schema = Schema(
|
|
|
361
365
|
"ip_address": _ip_address,
|
|
362
366
|
"session_age": All(_any_number, Range(min=0)),
|
|
363
367
|
"session_id": str,
|
|
368
|
+
"tracking_token": str,
|
|
364
369
|
"user_agent": str,
|
|
365
370
|
},
|
|
366
371
|
"email": {
|
|
@@ -403,7 +408,7 @@ def _maxmind_id(s: str | None) -> str:
|
|
|
403
408
|
raise ValueError
|
|
404
409
|
|
|
405
410
|
|
|
406
|
-
_tag = In(["chargeback", "not_fraud", "spam_or_abuse", "suspected_fraud"])
|
|
411
|
+
_tag = In(["chargeback", "clear", "not_fraud", "spam_or_abuse", "suspected_fraud"])
|
|
407
412
|
|
|
408
413
|
|
|
409
414
|
def _uuid(s: str) -> str:
|
|
@@ -256,7 +256,7 @@ class AsyncClient(BaseClient):
|
|
|
256
256
|
:type timeout: float
|
|
257
257
|
:param proxy: The URL of an HTTP proxy to use. It may optionally include
|
|
258
258
|
a basic auth username and password, e.g.,
|
|
259
|
-
``http
|
|
259
|
+
``http://<username>:<password>@<host>:<port>``.
|
|
260
260
|
:return: Client object
|
|
261
261
|
:rtype: Client
|
|
262
262
|
"""
|
|
@@ -274,7 +274,7 @@ class AsyncClient(BaseClient):
|
|
|
274
274
|
:param transaction: A dictionary containing the transaction to be
|
|
275
275
|
sent to the minFraud Factors web service as specified in the `REST
|
|
276
276
|
API documentation
|
|
277
|
-
<https://dev.maxmind.com/minfraud/api-documentation/requests
|
|
277
|
+
<https://dev.maxmind.com/minfraud/api-documentation/requests/?lang=en>`_.
|
|
278
278
|
:type transaction: dict
|
|
279
279
|
:param validate: If set to false, validation of the transaction
|
|
280
280
|
dictionary will be disabled. This validation helps ensure that your
|
|
@@ -313,7 +313,7 @@ class AsyncClient(BaseClient):
|
|
|
313
313
|
:param transaction: A dictionary containing the transaction to be
|
|
314
314
|
sent to the minFraud Insights web service as specified in the `REST
|
|
315
315
|
API documentation
|
|
316
|
-
<https://dev.maxmind.com/minfraud/api-documentation/requests
|
|
316
|
+
<https://dev.maxmind.com/minfraud/api-documentation/requests/?lang=en>`_.
|
|
317
317
|
:type transaction: dict
|
|
318
318
|
:param validate: If set to false, validation of the transaction
|
|
319
319
|
dictionary will be disabled. This validation helps ensure that your
|
|
@@ -352,7 +352,7 @@ class AsyncClient(BaseClient):
|
|
|
352
352
|
:param transaction: A dictionary containing the transaction to be
|
|
353
353
|
sent to the minFraud Score web service as specified in the `REST API
|
|
354
354
|
documentation
|
|
355
|
-
<https://dev.maxmind.com/minfraud/api-documentation/requests
|
|
355
|
+
<https://dev.maxmind.com/minfraud/api-documentation/requests/?lang=en>`_.
|
|
356
356
|
:type transaction: dict
|
|
357
357
|
:param validate: If set to false, validation of the transaction
|
|
358
358
|
dictionary will be disabled. This validation helps ensure that your
|
|
@@ -388,9 +388,9 @@ class AsyncClient(BaseClient):
|
|
|
388
388
|
"""Send a transaction report to the Report Transaction endpoint.
|
|
389
389
|
|
|
390
390
|
:param report: A dictionary containing the transaction report to be sent
|
|
391
|
-
to the Report Transations web service as specified in the `REST API
|
|
391
|
+
to the Report Transations web service as specified in the `REST API
|
|
392
392
|
documentation
|
|
393
|
-
<https://dev.maxmind.com/minfraud/report-a-transaction
|
|
393
|
+
<https://dev.maxmind.com/minfraud/report-a-transaction/?lang=en>`_.
|
|
394
394
|
:type report: dict
|
|
395
395
|
:param validate: If set to false, validation of the report dictionary
|
|
396
396
|
will be disabled. This validation helps ensure that your request is
|
|
@@ -442,8 +442,14 @@ class AsyncClient(BaseClient):
|
|
|
442
442
|
async def _session(self) -> aiohttp.ClientSession:
|
|
443
443
|
if not hasattr(self, "_existing_session"):
|
|
444
444
|
self._existing_session = aiohttp.ClientSession(
|
|
445
|
-
|
|
446
|
-
|
|
445
|
+
headers={
|
|
446
|
+
"Accept": "application/json",
|
|
447
|
+
"Authorization": aiohttp.encode_basic_auth(
|
|
448
|
+
self._account_id,
|
|
449
|
+
self._license_key,
|
|
450
|
+
),
|
|
451
|
+
"User-Agent": _AIOHTTP_UA,
|
|
452
|
+
},
|
|
447
453
|
timeout=aiohttp.ClientTimeout(total=self._timeout),
|
|
448
454
|
)
|
|
449
455
|
|
|
@@ -504,7 +510,7 @@ class Client(BaseClient):
|
|
|
504
510
|
60.
|
|
505
511
|
:param proxy: The URL of an HTTP proxy to use. It may optionally include
|
|
506
512
|
a basic auth username and password, e.g.,
|
|
507
|
-
``http
|
|
513
|
+
``http://<username>:<password>@<host>:<port>``.
|
|
508
514
|
:type timeout: float
|
|
509
515
|
:return: Client object
|
|
510
516
|
:rtype: Client
|
|
@@ -532,7 +538,7 @@ class Client(BaseClient):
|
|
|
532
538
|
:param transaction: A dictionary containing the transaction to be
|
|
533
539
|
sent to the minFraud Factors web service as specified in the `REST
|
|
534
540
|
API documentation
|
|
535
|
-
<https://dev.maxmind.com/minfraud/api-documentation/requests
|
|
541
|
+
<https://dev.maxmind.com/minfraud/api-documentation/requests/?lang=en>`_.
|
|
536
542
|
:type transaction: dict
|
|
537
543
|
:param validate: If set to false, validation of the transaction
|
|
538
544
|
dictionary will be disabled. This validation helps ensure that your
|
|
@@ -571,7 +577,7 @@ class Client(BaseClient):
|
|
|
571
577
|
:param transaction: A dictionary containing the transaction to be
|
|
572
578
|
sent to the minFraud Insights web service as specified in the `REST
|
|
573
579
|
API documentation
|
|
574
|
-
<https://dev.maxmind.com/minfraud/api-documentation/requests
|
|
580
|
+
<https://dev.maxmind.com/minfraud/api-documentation/requests/?lang=en>`_.
|
|
575
581
|
:type transaction: dict
|
|
576
582
|
:param validate: If set to false, validation of the transaction
|
|
577
583
|
dictionary will be disabled. This validation helps ensure that your
|
|
@@ -610,7 +616,7 @@ class Client(BaseClient):
|
|
|
610
616
|
:param transaction: A dictionary containing the transaction to be
|
|
611
617
|
sent to the minFraud Score web service as specified in the `REST API
|
|
612
618
|
documentation
|
|
613
|
-
<https://dev.maxmind.com/minfraud/api-documentation/requests
|
|
619
|
+
<https://dev.maxmind.com/minfraud/api-documentation/requests/?lang=en>`_.
|
|
614
620
|
:type transaction: dict
|
|
615
621
|
:param validate: If set to false, validation of the transaction
|
|
616
622
|
dictionary will be disabled. This validation helps ensure that your
|
|
@@ -646,9 +652,9 @@ class Client(BaseClient):
|
|
|
646
652
|
"""Send a transaction report to the Report Transaction endpoint.
|
|
647
653
|
|
|
648
654
|
:param report: A dictionary containing the transaction report to be sent
|
|
649
|
-
to the Report Transations web service as specified in the `REST API
|
|
655
|
+
to the Report Transations web service as specified in the `REST API
|
|
650
656
|
documentation
|
|
651
|
-
<https://dev.maxmind.com/minfraud/report-transaction
|
|
657
|
+
<https://dev.maxmind.com/minfraud/report-a-transaction/?lang=en>`_.
|
|
652
658
|
:type report: dict
|
|
653
659
|
:param validate: If set to false, validation of the report dictionary
|
|
654
660
|
will be disabled. This validation helps ensure that your request is
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
from __future__ import annotations
|
|
2
2
|
|
|
3
|
+
import datetime
|
|
3
4
|
import unittest
|
|
4
5
|
from typing import Any
|
|
5
6
|
|
|
@@ -187,6 +188,21 @@ class TestModels(unittest.TestCase):
|
|
|
187
188
|
"across minFraud customers.",
|
|
188
189
|
},
|
|
189
190
|
],
|
|
191
|
+
anonymizer={
|
|
192
|
+
"confidence": 99,
|
|
193
|
+
"is_anonymous": True,
|
|
194
|
+
"is_anonymous_vpn": True,
|
|
195
|
+
"is_hosting_provider": True,
|
|
196
|
+
"is_public_proxy": True,
|
|
197
|
+
"is_tor_exit_node": True,
|
|
198
|
+
"network_last_seen": "2025-01-15",
|
|
199
|
+
"provider_name": "TestVPN",
|
|
200
|
+
"residential": {
|
|
201
|
+
"confidence": 82,
|
|
202
|
+
"network_last_seen": "2026-05-11",
|
|
203
|
+
"provider_name": "quickshift",
|
|
204
|
+
},
|
|
205
|
+
},
|
|
190
206
|
traits={
|
|
191
207
|
"is_anonymous": True,
|
|
192
208
|
"is_anonymous_proxy": True,
|
|
@@ -215,6 +231,37 @@ class TestModels(unittest.TestCase):
|
|
|
215
231
|
self.assertEqual("310", address.traits.mobile_country_code)
|
|
216
232
|
self.assertEqual("004", address.traits.mobile_network_code)
|
|
217
233
|
|
|
234
|
+
# Test anonymizer attribute
|
|
235
|
+
self.assertEqual(99, address.anonymizer.confidence)
|
|
236
|
+
self.assertEqual(True, address.anonymizer.is_anonymous)
|
|
237
|
+
self.assertEqual(True, address.anonymizer.is_anonymous_vpn)
|
|
238
|
+
self.assertEqual(True, address.anonymizer.is_hosting_provider)
|
|
239
|
+
self.assertEqual(True, address.anonymizer.is_public_proxy)
|
|
240
|
+
self.assertEqual(True, address.anonymizer.is_tor_exit_node)
|
|
241
|
+
self.assertEqual(
|
|
242
|
+
datetime.date(2025, 1, 15), address.anonymizer.network_last_seen
|
|
243
|
+
)
|
|
244
|
+
self.assertEqual("TestVPN", address.anonymizer.provider_name)
|
|
245
|
+
|
|
246
|
+
# Test anonymizer.residential attribute
|
|
247
|
+
self.assertEqual(82, address.anonymizer.residential.confidence)
|
|
248
|
+
self.assertEqual(
|
|
249
|
+
datetime.date(2026, 5, 11),
|
|
250
|
+
address.anonymizer.residential.network_last_seen,
|
|
251
|
+
)
|
|
252
|
+
self.assertEqual("quickshift", address.anonymizer.residential.provider_name)
|
|
253
|
+
|
|
254
|
+
# Test to_dict() serialization of anonymizer.residential. The date
|
|
255
|
+
# is serialized in its ISO 8601 format.
|
|
256
|
+
self.assertEqual(
|
|
257
|
+
{
|
|
258
|
+
"confidence": 82,
|
|
259
|
+
"network_last_seen": "2026-05-11",
|
|
260
|
+
"provider_name": "quickshift",
|
|
261
|
+
},
|
|
262
|
+
address.to_dict()["anonymizer"]["residential"],
|
|
263
|
+
)
|
|
264
|
+
|
|
218
265
|
self.assertEqual("ANONYMOUS_IP", address.risk_reasons[0].code)
|
|
219
266
|
self.assertEqual(
|
|
220
267
|
"The IP address belongs to an anonymous network. "
|
|
@@ -229,6 +276,23 @@ class TestModels(unittest.TestCase):
|
|
|
229
276
|
address.risk_reasons[1].reason,
|
|
230
277
|
)
|
|
231
278
|
|
|
279
|
+
def test_ip_address_anonymizer_without_residential(self) -> None:
|
|
280
|
+
address = IPAddress(
|
|
281
|
+
["en"],
|
|
282
|
+
anonymizer={
|
|
283
|
+
"is_anonymous": True,
|
|
284
|
+
"provider_name": "TestVPN",
|
|
285
|
+
},
|
|
286
|
+
)
|
|
287
|
+
|
|
288
|
+
self.assertIsNone(address.anonymizer.residential.confidence)
|
|
289
|
+
self.assertIsNone(address.anonymizer.residential.network_last_seen)
|
|
290
|
+
self.assertIsNone(address.anonymizer.residential.provider_name)
|
|
291
|
+
|
|
292
|
+
# Empty nested records are skipped during serialization, so there
|
|
293
|
+
# should be no residential key.
|
|
294
|
+
self.assertNotIn("residential", address.to_dict()["anonymizer"])
|
|
295
|
+
|
|
232
296
|
def test_empty_address(self) -> None:
|
|
233
297
|
address = IPAddress([])
|
|
234
298
|
self.assertEqual([], address.risk_reasons)
|
|
@@ -291,6 +291,9 @@ class TestDevice(ValidationBase, unittest.TestCase):
|
|
|
291
291
|
{"device": {"ip_address": "4.4.4.4", "session_age": invalid}},
|
|
292
292
|
)
|
|
293
293
|
|
|
294
|
+
def test_tracking_token(self) -> None:
|
|
295
|
+
self.check_transaction_str_type("device", "tracking_token")
|
|
296
|
+
|
|
294
297
|
|
|
295
298
|
class TestEmail(ValidationBase, unittest.TestCase):
|
|
296
299
|
def test_address(self) -> None:
|
|
@@ -467,7 +470,13 @@ class TestReport(ValidationBase):
|
|
|
467
470
|
self.check_report_str_type(key)
|
|
468
471
|
|
|
469
472
|
def test_tag(self) -> None:
|
|
470
|
-
for good in (
|
|
473
|
+
for good in (
|
|
474
|
+
"chargeback",
|
|
475
|
+
"clear",
|
|
476
|
+
"not_fraud",
|
|
477
|
+
"spam_or_abuse",
|
|
478
|
+
"suspected_fraud",
|
|
479
|
+
):
|
|
471
480
|
self.check_report({"tag": good})
|
|
472
481
|
for bad in ("risky_business", "", None):
|
|
473
482
|
self.check_invalid_report({"tag": bad})
|
|
@@ -236,6 +236,25 @@ class BaseTransactionTest(BaseTest):
|
|
|
236
236
|
self.assertEqual("310", model.ip_address.traits.mobile_country_code)
|
|
237
237
|
self.assertEqual("004", model.ip_address.traits.mobile_network_code)
|
|
238
238
|
self.assertEqual("ANONYMOUS_IP", model.ip_address.risk_reasons[0].code)
|
|
239
|
+
self.assertEqual(
|
|
240
|
+
82,
|
|
241
|
+
model.ip_address.anonymizer.residential.confidence,
|
|
242
|
+
)
|
|
243
|
+
self.assertEqual(
|
|
244
|
+
"quickshift",
|
|
245
|
+
model.ip_address.anonymizer.residential.provider_name,
|
|
246
|
+
)
|
|
247
|
+
|
|
248
|
+
def test_authorization_header(self) -> None:
|
|
249
|
+
# Credentials must be sent via the Authorization header rather than the
|
|
250
|
+
# deprecated aiohttp BasicAuth / auth= parameter. The expected value is
|
|
251
|
+
# base64("42:abcdef123456").
|
|
252
|
+
self.create_success()
|
|
253
|
+
request, _ = self.httpserver.log[-1]
|
|
254
|
+
self.assertEqual(
|
|
255
|
+
"Basic NDI6YWJjZGVmMTIzNDU2",
|
|
256
|
+
request.headers.get("Authorization"),
|
|
257
|
+
)
|
|
239
258
|
|
|
240
259
|
def test_200_on_request_with_nones(self) -> None:
|
|
241
260
|
model = self.create_success(
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|