Skip to content

Commit 0e97982

Browse files
committed
Upgrade geoip2 to 4.5.0 and add MCC/MNC tests
1 parent 5f18c3b commit 0e97982

6 files changed

Lines changed: 16 additions & 1 deletion

File tree

HISTORY.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,11 @@ History
66
2.6.0
77
++++++++++++++++++
88

9+
* Upgraded ``geoip2`` to 4.5.0. This adds mobile country code (MCC) and mobile
10+
network code (MNC) to minFraud Insights and Factors responses. These are
11+
available at ``response.ip_address.traits.mobile_country_code`` and
12+
``response.ip_address.traits.mobile_network_code``. We expect this data to be
13+
available by late January, 2022.
914
* Added the following new values to the ``/payment/processor`` validation:
1015
* ``boacompra``
1116
* ``boku``

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
requirements = [
2020
"aiohttp>=3.6.2,<4.0.0",
2121
"email_validator>=1.1.1,<2.0.0",
22-
"geoip2>=4.3.0,<5.0.0",
22+
"geoip2>=4.5.0,<5.0.0",
2323
"requests>=2.24.0,<3.0.0",
2424
"urllib3>=1.25.2,<2.0.0",
2525
"voluptuous",

tests/data/factors-response.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,8 @@
108108
"is_satellite_provider": true,
109109
"is_tor_exit_node": true,
110110
"isp": "Andrews & Arnold Ltd",
111+
"mobile_country_code" : "310",
112+
"mobile_network_code" : "004",
111113
"organization": "STONEHOUSE office network",
112114
"user_type": "government"
113115
}

tests/data/insights-response.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,8 @@
108108
"is_satellite_provider": true,
109109
"is_tor_exit_node": true,
110110
"isp": "Andrews & Arnold Ltd",
111+
"mobile_country_code" : "310",
112+
"mobile_network_code" : "004",
111113
"organization": "STONEHOUSE office network",
112114
"user_type": "government"
113115
}

tests/test_models.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,8 @@ def test_ip_address(self):
175175
"is_residential_proxy": True,
176176
"is_satellite_provider": True,
177177
"is_tor_exit_node": True,
178+
"mobile_country_code": "310",
179+
"mobile_network_code": "004",
178180
},
179181
}
180182
)
@@ -191,6 +193,8 @@ def test_ip_address(self):
191193
self.assertEqual(True, address.traits.is_residential_proxy)
192194
self.assertEqual(True, address.traits.is_satellite_provider)
193195
self.assertEqual(True, address.traits.is_tor_exit_node)
196+
self.assertEqual("310", address.traits.mobile_country_code)
197+
self.assertEqual("004", address.traits.mobile_network_code)
194198
self.assertEqual(True, address.country.is_high_risk)
195199

196200
self.assertEqual("ANONYMOUS_IP", address.risk_reasons[0].code)

tests/test_webservice.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,8 @@ def test_200(self):
193193
if self.has_ip_location():
194194
self.assertEqual("United Kingdom", model.ip_address.country.name)
195195
self.assertEqual(True, model.ip_address.traits.is_residential_proxy)
196+
self.assertEqual("310", model.ip_address.traits.mobile_country_code)
197+
self.assertEqual("004", model.ip_address.traits.mobile_network_code)
196198
self.assertEqual("ANONYMOUS_IP", model.ip_address.risk_reasons[0].code)
197199

198200
@httprettified

0 commit comments

Comments
 (0)