Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,13 @@ CHANGELOG
3.7.0
------------------

* Added the `residential` property to the `anonymizer` object on
`MaxMind\MinFraud\Model\IpAddress`. This is a `GeoIp2\Record\AnonymizerFeed`
object providing residential proxy data for the network: `confidence`,
`networkLastSeen`, and `providerName`. It may be populated even when no
other anonymizer properties are set. This data is available from the
minFraud Insights and Factors web services. This requires
`geoip2/geoip2` 3.4.0 or greater.
* Added `tracking_token` to the `/device` request object. This is the
token generated by the
[Device Tracking Add-on](https://dev.maxmind.com/minfraud/track-devices)
Expand Down
25 changes: 25 additions & 0 deletions tests/MaxMind/Test/MinFraud/Model/InsightsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

namespace MaxMind\Test\MinFraud\Model;

use GeoIp2\Record\AnonymizerFeed;
use MaxMind\MinFraud\Model\Insights;
use MaxMind\MinFraud\Model\Score;
use MaxMind\Test\MinFraudData as Data;
Expand Down Expand Up @@ -156,6 +157,30 @@
'correct anonymizer network last seen'
);

$this->assertInstanceOf(
AnonymizerFeed::class,

Check failure on line 161 in tests/MaxMind/Test/MinFraud/Model/InsightsTest.php

View workflow job for this annotation

GitHub Actions / PHP Lints

Class GeoIp2\Record\AnonymizerFeed not found.

Check failure on line 161 in tests/MaxMind/Test/MinFraud/Model/InsightsTest.php

View workflow job for this annotation

GitHub Actions / PHP Lints

Class GeoIp2\Record\AnonymizerFeed not found.

Check failure on line 161 in tests/MaxMind/Test/MinFraud/Model/InsightsTest.php

View workflow job for this annotation

GitHub Actions / PHP Lints

Class GeoIp2\Record\AnonymizerFeed not found.

Check failure on line 161 in tests/MaxMind/Test/MinFraud/Model/InsightsTest.php

View workflow job for this annotation

GitHub Actions / PHP Lints

Class GeoIp2\Record\AnonymizerFeed not found.
$insights->ipAddress->anonymizer->residential,

Check failure on line 162 in tests/MaxMind/Test/MinFraud/Model/InsightsTest.php

View workflow job for this annotation

GitHub Actions / PHP Lints

Access to an undefined property GeoIp2\Record\Anonymizer::$residential.

Check failure on line 162 in tests/MaxMind/Test/MinFraud/Model/InsightsTest.php

View workflow job for this annotation

GitHub Actions / PHP Lints

Access to an undefined property GeoIp2\Record\Anonymizer::$residential.

Check failure on line 162 in tests/MaxMind/Test/MinFraud/Model/InsightsTest.php

View workflow job for this annotation

GitHub Actions / PHP Lints

Access to an undefined property GeoIp2\Record\Anonymizer::$residential.

Check failure on line 162 in tests/MaxMind/Test/MinFraud/Model/InsightsTest.php

View workflow job for this annotation

GitHub Actions / PHP Lints

Access to an undefined property GeoIp2\Record\Anonymizer::$residential.
'anonymizer residential is an AnonymizerFeed'
);
Comment on lines +160 to +164

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Prefer using class name resolution via \GeoIp2\Record\AnonymizerFeed::class instead of a hardcoded string literal. This ensures better type safety, allows static analysis tools (like PHPStan) to verify the class exists, and enables IDE refactoring support.

        $this->assertInstanceOf(
            \GeoIp2\Record\AnonymizerFeed::class,
            $insights->ipAddress->anonymizer->residential,
            'anonymizer residential is an AnonymizerFeed'
        );

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Claude, on behalf of Greg: Done in the current revision — the assertion now uses \GeoIp2\Record\AnonymizerFeed::class.


$this->assertSame(
$array['ip_address']['anonymizer']['residential']['confidence'],
$insights->ipAddress->anonymizer->residential->confidence,

Check failure on line 168 in tests/MaxMind/Test/MinFraud/Model/InsightsTest.php

View workflow job for this annotation

GitHub Actions / PHP Lints

Access to property $confidence on an unknown class GeoIp2\Record\AnonymizerFeed.

Check failure on line 168 in tests/MaxMind/Test/MinFraud/Model/InsightsTest.php

View workflow job for this annotation

GitHub Actions / PHP Lints

Access to property $confidence on an unknown class GeoIp2\Record\AnonymizerFeed.

Check failure on line 168 in tests/MaxMind/Test/MinFraud/Model/InsightsTest.php

View workflow job for this annotation

GitHub Actions / PHP Lints

Access to property $confidence on an unknown class GeoIp2\Record\AnonymizerFeed.

Check failure on line 168 in tests/MaxMind/Test/MinFraud/Model/InsightsTest.php

View workflow job for this annotation

GitHub Actions / PHP Lints

Access to property $confidence on an unknown class GeoIp2\Record\AnonymizerFeed.
'correct anonymizer residential confidence'
);

$this->assertSame(
$array['ip_address']['anonymizer']['residential']['network_last_seen'],
$insights->ipAddress->anonymizer->residential->networkLastSeen,

Check failure on line 174 in tests/MaxMind/Test/MinFraud/Model/InsightsTest.php

View workflow job for this annotation

GitHub Actions / PHP Lints

Access to property $networkLastSeen on an unknown class GeoIp2\Record\AnonymizerFeed.

Check failure on line 174 in tests/MaxMind/Test/MinFraud/Model/InsightsTest.php

View workflow job for this annotation

GitHub Actions / PHP Lints

Access to property $networkLastSeen on an unknown class GeoIp2\Record\AnonymizerFeed.

Check failure on line 174 in tests/MaxMind/Test/MinFraud/Model/InsightsTest.php

View workflow job for this annotation

GitHub Actions / PHP Lints

Access to property $networkLastSeen on an unknown class GeoIp2\Record\AnonymizerFeed.

Check failure on line 174 in tests/MaxMind/Test/MinFraud/Model/InsightsTest.php

View workflow job for this annotation

GitHub Actions / PHP Lints

Access to property $networkLastSeen on an unknown class GeoIp2\Record\AnonymizerFeed.
'correct anonymizer residential network last seen'
);

$this->assertSame(
$array['ip_address']['anonymizer']['residential']['provider_name'],
$insights->ipAddress->anonymizer->residential->providerName,

Check failure on line 180 in tests/MaxMind/Test/MinFraud/Model/InsightsTest.php

View workflow job for this annotation

GitHub Actions / PHP Lints

Access to property $providerName on an unknown class GeoIp2\Record\AnonymizerFeed.

Check failure on line 180 in tests/MaxMind/Test/MinFraud/Model/InsightsTest.php

View workflow job for this annotation

GitHub Actions / PHP Lints

Access to property $providerName on an unknown class GeoIp2\Record\AnonymizerFeed.

Check failure on line 180 in tests/MaxMind/Test/MinFraud/Model/InsightsTest.php

View workflow job for this annotation

GitHub Actions / PHP Lints

Access to property $providerName on an unknown class GeoIp2\Record\AnonymizerFeed.

Check failure on line 180 in tests/MaxMind/Test/MinFraud/Model/InsightsTest.php

View workflow job for this annotation

GitHub Actions / PHP Lints

Access to property $providerName on an unknown class GeoIp2\Record\AnonymizerFeed.
'correct anonymizer residential provider name'
);

$this->assertSame(
$array['billing_phone']['country'],
$insights->billingPhone->country,
Expand Down
7 changes: 6 additions & 1 deletion tests/data/minfraud/factors-response.json
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,12 @@
"is_public_proxy": true,
"is_tor_exit_node": true,
"network_last_seen": "2025-01-15",
"provider_name": "TestVPN"
"provider_name": "TestVPN",
"residential": {
"confidence": 82,
"network_last_seen": "2026-05-11",
"provider_name": "quickshift"
}
}
},
"billing_address": {
Expand Down
7 changes: 6 additions & 1 deletion tests/data/minfraud/insights-response.json
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,12 @@
"is_public_proxy": true,
"is_tor_exit_node": true,
"network_last_seen": "2025-01-15",
"provider_name": "TestVPN"
"provider_name": "TestVPN",
"residential": {
"confidence": 82,
"network_last_seen": "2026-05-11",
"provider_name": "quickshift"
}
}
},
"billing_address": {
Expand Down
Loading