Skip to content

Commit 59aff48

Browse files
oschwaldclaude
andcommitted
Add tracking_token to Device request object
This adds the optional tracking_token field to the Device request object for explicit device linking via the Device Tracking Add-on. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent bcd18ab commit 59aff48

File tree

4 files changed

+9
-0
lines changed

4 files changed

+9
-0
lines changed

HISTORY.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ History
66
3.3.0
77
++++++++++++++++++
88

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.
913
* Added ``banquest``, ``summit_payments``, and ``yaadpay`` to the
1014
``/payment/processor`` validation.
1115
* The version is now retrieved from package metadata at runtime using

README.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,7 @@ Score, Insights and Factors Example
153153
>>> 'accept_language': 'en-US,en;q=0.8',
154154
>>> 'session_age': 3600,
155155
>>> 'session_id': 'a333a4e127f880d8820e56a66f40717c',
156+
>>> 'tracking_token': '...',
156157
>>> 'user_agent': 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2272.89 Safari/537.36'
157158
>>> },
158159
>>> 'event': {

src/minfraud/validation.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -364,6 +364,7 @@ def _uri(s: str) -> str:
364364
"ip_address": _ip_address,
365365
"session_age": All(_any_number, Range(min=0)),
366366
"session_id": str,
367+
"tracking_token": str,
367368
"user_agent": str,
368369
},
369370
"email": {

tests/test_validation.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -291,6 +291,9 @@ def test_session_age(self) -> None:
291291
{"device": {"ip_address": "4.4.4.4", "session_age": invalid}},
292292
)
293293

294+
def test_tracking_token(self) -> None:
295+
self.check_transaction_str_type("device", "tracking_token")
296+
294297

295298
class TestEmail(ValidationBase, unittest.TestCase):
296299
def test_address(self) -> None:

0 commit comments

Comments
 (0)