Skip to content

Commit

Permalink
Add new /credit_card/country input
Browse files Browse the repository at this point in the history
  • Loading branch information
oschwald committed Mar 7, 2022
1 parent a422b8d commit 32d44d7
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 0 deletions.
8 changes: 8 additions & 0 deletions HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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)
++++++++++++++++++

Expand Down
1 change: 1 addition & 0 deletions minfraud/validation.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
1 change: 1 addition & 0 deletions tests/data/full-transaction-request.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
6 changes: 6 additions & 0 deletions tests/test_validation.py
Original file line number Diff line number Diff line change
Expand Up @@ -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}})
Expand Down

0 comments on commit 32d44d7

Please sign in to comment.