Repository: cuenca-mx/cuenca-python (language: python)

Issue:
Add pin_attemps in resource card



Discussion / hints:

Fix patch:
diff --git a/cuenca/resources/cards.py b/cuenca/resources/cards.py
index 0eff1162..66f04806 100644
--- a/cuenca/resources/cards.py
+++ b/cuenca/resources/cards.py
@@ -14,6 +14,8 @@
 
 from ..http import Session, session as global_session
 
+MAX_PIN_ATTEMPTS = 3
+
 
 @dataclass
 class Card(Retrievable, Queryable, Creatable, Updateable):
@@ -30,6 +32,7 @@ class Card(Retrievable, Queryable, Creatable, Updateable):
     status: CardStatus
     issuer: CardIssuer
     funding_type: CardFundingType
+    pin_attempts_failed: Optional[int] = None
 
     @property
     def last_4_digits(self):
@@ -39,6 +42,14 @@ def last_4_digits(self):
     def bin(self):
         return self.number[:6]
 
+    @property
+    def pin_attempts_exceeded(self) -> bool:
+        return (
+            self.pin_attempts_failed >= MAX_PIN_ATTEMPTS
+            if self.pin_attempts_failed
+            else False
+        )
+
     @classmethod
     def create(
         cls,
diff --git a/cuenca/version.py b/cuenca/version.py
index 60f6c448..7a488e7c 100644
--- a/cuenca/version.py
+++ b/cuenca/version.py
@@ -1,3 +1,3 @@
-__version__ = '0.7.8'
+__version__ = '0.7.10'
 CLIENT_VERSION = __version__
 API_VERSION = '2020-03-19'
diff --git a/requirements.txt b/requirements.txt
index ff7b5fd8..d4b51aed 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -1,3 +1,3 @@
 requests==2.25.1
-cuenca-validations==0.9.8
+cuenca-validations==0.9.10
 dataclasses>=0.7;python_version<"3.7"


Test patch:
diff --git a/tests/resources/test_cards.py b/tests/resources/test_cards.py
index 19b4a42c..31e7dca5 100644
--- a/tests/resources/test_cards.py
+++ b/tests/resources/test_cards.py
@@ -37,6 +37,7 @@ def test_card_retrieve():
     assert card.last_4_digits == '9849'
     assert card.bin == '544875'
     assert card.type == CardType.virtual
+    assert not card.pin_attempts_exceeded
 
 
 @pytest.mark.vcr