diff --git a/HISTORY.rst b/HISTORY.rst index 2be2639..eaf97ac 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -3,6 +3,14 @@ History ------- +2.7.0 +++++++++++++++++++ + +* Added the input ``/credit_card/country``. This is the country where the + issuer of the card is located. This may be passed instead of + ``/credit_card/issuer_id_number`` if you do not wish to pass partial + account numbers or if your payment processor does not provide them. + 2.6.0 (2022-01-25) ++++++++++++++++++ diff --git a/minfraud/validation.py b/minfraud/validation.py index 4e23e93..767b54e 100644 --- a/minfraud/validation.py +++ b/minfraud/validation.py @@ -308,6 +308,7 @@ def _uri(s: str) -> str: "bank_name": str, "bank_phone_country_code": _telephone_country_code, "bank_phone_number": str, + "country": _country_code, "cvv_result": _single_char, "issuer_id_number": _iin, "last_digits": _credit_card_last_digits, diff --git a/tests/data/full-transaction-request.json b/tests/data/full-transaction-request.json index b6a1f90..73df585 100644 --- a/tests/data/full-transaction-request.json +++ b/tests/data/full-transaction-request.json @@ -46,6 +46,7 @@ "decline_code": "invalid number" }, "credit_card": { + "country": "US", "issuer_id_number": "411111", "last_digits": "7643", "bank_name": "Bank of No Hope", diff --git a/tests/test_validation.py b/tests/test_validation.py index a61b72d..62a8953 100644 --- a/tests/test_validation.py +++ b/tests/test_validation.py @@ -142,6 +142,12 @@ def test_delivery_speed(self): class TestCreditCard(ValidationBase, unittest.TestCase): + def test_country(self): + for code in ("CA", "US"): + self.check_transaction({"credit_card": {"country": code}}) + for invalid in (1, None, "", "A1", "Canada"): + self.check_invalid_transaction({"credit_card": {"country": invalid}}) + def test_issuer_id_number(self): for iin in ("123456", "532313", "88888888"): self.check_transaction({"credit_card": {"issuer_id_number": iin}})