Skip to content
Merged
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
3 changes: 3 additions & 0 deletions HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ History
3.1.0
++++++++++++++++++

* Added support for the ``/billing_phone/matches_postal`` and
``/shipping_phone/matches_postal`` outputs. These are available as the
``matches_postal`` attribute on ``minfraud.model.Phone``.
* Added ``cryptomus`` to the ``/payment/processor`` validation.

3.0.0 (2025-02-10)
Expand Down
10 changes: 10 additions & 0 deletions minfraud/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -509,6 +509,14 @@ class Phone(_Serializable):
``False`` when the number is not VoIP. If the phone number was not
provided or we do not have data for it, the property will be ``None``."""

matches_postal: Optional[bool]
"""This is ```True``` if the phone number's prefix is commonly
associated with the postal code. It is ```False``` if the prefix is not
associated with the postal code. It is non-```None``` only when the phone
number is in the US, the number prefix is in our database, and the
postal code and country are provided in the request.
"""

network_operator: Optional[str]
"""The name of the original network operator associated with the phone
number. This field does not reflect phone numbers that have been ported
Expand All @@ -524,13 +532,15 @@ def __init__(
*,
country: Optional[str] = None,
is_voip: Optional[bool] = None,
matches_postal: Optional[bool] = None,
network_operator: Optional[str] = None,
number_type: Optional[str] = None,
**_,
) -> None:
"""Initialize a Phone instance."""
self.country = country
self.is_voip = is_voip
self.matches_postal = matches_postal
self.network_operator = network_operator
self.number_type = number_type

Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ authors = [
dependencies = [
"aiohttp>=3.6.2,<4.0.0",
"email_validator>=2.0.0,<3.0.0",
"geoip2>=5.0.1,<6.0.0",
"geoip2>=5.1.0,<6.0.0",
"requests>=2.24.0,<3.0.0",
"typing-extensions>=4.13.2",
"voluptuous",
Expand Down
2 changes: 2 additions & 0 deletions tests/data/factors-response.json
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@
"billing_phone": {
"country": "US",
"is_voip": true,
"matches_postal": true,
"network_operator": "Verizon/1",
"number_type": "fixed"
},
Expand Down Expand Up @@ -168,6 +169,7 @@
"shipping_phone": {
"country": "CA",
"is_voip": true,
"matches_postal": true,
"network_operator": "Telus Mobility-SVR/2",
"number_type": "mobile"
},
Expand Down
2 changes: 2 additions & 0 deletions tests/data/insights-response.json
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@
"billing_phone": {
"country": "US",
"is_voip": true,
"matches_postal": true,
"network_operator": "Verizon/1",
"number_type": "fixed"
},
Expand Down Expand Up @@ -168,6 +169,7 @@
"shipping_phone": {
"country": "CA",
"is_voip": true,
"matches_postal": true,
"network_operator": "Telus Mobility-SVR/2",
"number_type": "mobile"
},
Expand Down
2 changes: 2 additions & 0 deletions tests/test_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -234,12 +234,14 @@ def test_phone(self) -> None:
phone = Phone(
country="US",
is_voip=True,
matches_postal=True,
network_operator="Verizon/1",
number_type="fixed",
)

self.assertEqual("US", phone.country)
self.assertEqual(True, phone.is_voip)
self.assertEqual(True, phone.matches_postal)
self.assertEqual("Verizon/1", phone.network_operator)
self.assertEqual("fixed", phone.number_type)

Expand Down
1,746 changes: 886 additions & 860 deletions uv.lock

Large diffs are not rendered by default.

Loading