Skip to content

Commit 004fb68

Browse files
authored
Merge pull request #97 from maxmind/greg/cc-country-input
Add new /credit_card/country input
2 parents a422b8d + 32d44d7 commit 004fb68

4 files changed

Lines changed: 16 additions & 0 deletions

File tree

HISTORY.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,14 @@
33
History
44
-------
55

6+
2.7.0
7+
++++++++++++++++++
8+
9+
* Added the input ``/credit_card/country``. This is the country where the
10+
issuer of the card is located. This may be passed instead of
11+
``/credit_card/issuer_id_number`` if you do not wish to pass partial
12+
account numbers or if your payment processor does not provide them.
13+
614
2.6.0 (2022-01-25)
715
++++++++++++++++++
816

minfraud/validation.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -308,6 +308,7 @@ def _uri(s: str) -> str:
308308
"bank_name": str,
309309
"bank_phone_country_code": _telephone_country_code,
310310
"bank_phone_number": str,
311+
"country": _country_code,
311312
"cvv_result": _single_char,
312313
"issuer_id_number": _iin,
313314
"last_digits": _credit_card_last_digits,

tests/data/full-transaction-request.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@
4646
"decline_code": "invalid number"
4747
},
4848
"credit_card": {
49+
"country": "US",
4950
"issuer_id_number": "411111",
5051
"last_digits": "7643",
5152
"bank_name": "Bank of No Hope",

tests/test_validation.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,12 @@ def test_delivery_speed(self):
142142

143143

144144
class TestCreditCard(ValidationBase, unittest.TestCase):
145+
def test_country(self):
146+
for code in ("CA", "US"):
147+
self.check_transaction({"credit_card": {"country": code}})
148+
for invalid in (1, None, "", "A1", "Canada"):
149+
self.check_invalid_transaction({"credit_card": {"country": invalid}})
150+
145151
def test_issuer_id_number(self):
146152
for iin in ("123456", "532313", "88888888"):
147153
self.check_transaction({"credit_card": {"issuer_id_number": iin}})

0 commit comments

Comments
 (0)