Repository: cuenca-mx/cuenca-python

Issue:
Parametros validación de pin en card_validations
Agregar parametro en `card_validations` para enviar desde `card-authorizer` a `Knox` la bandera de intentos de pin excedidos de forma offline

Discussion:
codecov[bot]: # [Codecov](https://codecov.io/gh/cuenca-mx/cuenca-python/pull/174?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=cuenca-mx) Report
> Merging [#174](https://codecov.io/gh/cuenca-mx/cuenca-python/pull/174?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=cuenca-mx) (2c67b50) into [main](https://codecov.io/gh/cuenca-mx/cuenca-python/commit/4e0bbbb56b42a02b44d40764bb68537cc768bc4c?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=cuenca-mx) (4e0bbbb) will **not change** coverage.
> The diff coverage is `100.00%`.

> :exclamation: Current head 2c67b50 differs from pull request most recent head 8ef8319. Consider uploading reports for the commit 8ef8319 to get more accurate results

```diff
@@            Coverage Diff            @@
##              main      #174   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           27        27           
  Lines          651       651           
=========================================
  Hits           651       651           
```

| Flag | Coverage Δ | |
|---|---|---|
| unittests | `100.00% <100.00%> (ø)` | |

Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=cuenca-mx#carryforward-flags-in-the-pull-request-comment) to find out more.

| [Impacted Files](https://codecov.io/gh/cuenca-mx/cuenca-python/pull/174?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=cuenca-mx) | Coverage Δ | |
|---|---|---|
| [cuenca/resources/card\_validations.py](https://codecov.io/gh/cuenca-mx/cuenca-python/pull/174/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=cuenca-mx#diff-Y3VlbmNhL3Jlc291cmNlcy9jYXJkX3ZhbGlkYXRpb25zLnB5) | `100.00% <ø> (ø)` | |
| [cuenca/version.py](https://codecov.io/gh/cuenca-mx/cuenca-python/pull/174/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=cuenca-mx#diff-Y3VlbmNhL3ZlcnNpb24ucHk=) | `100.00% <100.00%> (ø)` | |

------

[Continue to review full report at Codecov](https://codecov.io/gh/cuenca-mx/cuenca-python/pull/174?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=cuenca-mx).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=cuenca-mx)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/cuenca-mx/cuenca-python/pull/174?src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=cuenca-mx). Last update [4e0bbbb...8ef8319](https://codecov.io/gh/cuenca-mx/cuenca-python/pull/174?src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=cuenca-mx). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=cuenca-mx).


Patch:
diff --git a/cuenca/resources/card_validations.py b/cuenca/resources/card_validations.py
index 33f8a62..44a0aa6 100644
--- a/cuenca/resources/card_validations.py
+++ b/cuenca/resources/card_validations.py
@@ -25,6 +25,7 @@ class CardValidation(Creatable):
     is_valid_icvv: Optional[bool]
     is_valid_pin_block: Optional[bool]
     is_valid_exp_date: Optional[bool]
+    is_pin_attempts_exceeded: bool
     is_expired: bool
 
     @classmethod
@@ -37,6 +38,7 @@ class CardValidation(Creatable):
         exp_month: Optional[int] = None,
         exp_year: Optional[int] = None,
         pin_block: Optional[str] = None,
+        pin_attempts_exceeded: Optional[str] = None,
         *,
         session: Session = global_session,
     ) -> 'CardValidation':
@@ -48,6 +50,7 @@ class CardValidation(Creatable):
             exp_month=exp_month,
             exp_year=exp_year,
             pin_block=pin_block,
+            pin_attempts_exceeded=pin_attempts_exceeded,
         )
         return cast(
             'CardValidation', cls._create(session=session, **req.dict())
diff --git a/cuenca/version.py b/cuenca/version.py
index 854a755..60f6c44 100644
--- a/cuenca/version.py
+++ b/cuenca/version.py
@@ -1,3 +1,3 @@
-__version__ = '0.7.7'
+__version__ = '0.7.8'
 CLIENT_VERSION = __version__
 API_VERSION = '2020-03-19'
diff --git a/requirements.txt b/requirements.txt
index 7b6a9c4..ff7b5fd 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -1,3 +1,3 @@
 requests==2.25.1
-cuenca-validations==0.9.3
+cuenca-validations==0.9.8
 dataclasses>=0.7;python_version<"3.7"


Test patch:
diff --git a/tests/resources/cassettes/test_card_validations.yaml b/tests/resources/cassettes/test_card_validations.yaml
index eda3c0e..609d969 100644
--- a/tests/resources/cassettes/test_card_validations.yaml
+++ b/tests/resources/cassettes/test_card_validations.yaml
@@ -1,7 +1,7 @@
 interactions:
 - request:
-    body: '{"number": "1234567890123403", "exp_month": 2, "exp_year": 25, "cvv": "685",
-      "cvv2": "150", "icvv": "399", "pin_block": "BDIEHA38457W"}'
+    body: '{"number": "5448750129965637", "exp_month": 2, "exp_year": 25, "cvv": "685",
+      "cvv2": "150", "icvv": "399", "pin_block": "3B241739AB05D290"}'
     headers:
       Accept:
       - '*/*'
@@ -16,41 +16,41 @@ interactions:
       Content-Type:
       - application/json
       User-Agent:
-      - cuenca-python/0.7.5
+      - cuenca-python/0.7.8.dev4
       X-Cuenca-Api-Version:
       - '2020-03-19'
     method: POST
     uri: https://sandbox.cuenca.com/card_validations
   response:
     body:
-      string: '{"id":"CVlYj-hNIfQpmJH7mcc8GpoA","created_at":"2021-04-14T23:19:53.928000","card_uri":"/cards/CA7pET83WM25VXO3IQ8BwYO3","user_id":"US3zGWi1n852bTyqD1wCZ1ft","card_status":"active","card_type":"physical","is_active":true,"is_valid_cvv":true,"is_valid_cvv2":true,"is_valid_icvv":true,"is_valid_pin_block":true,"is_valid_exp_date":true,"is_expired":false}'
+      string: '{"id":"CVW12jNalJQA6_-jqIPL1aSw","created_at":"2021-07-19T21:49:43.691266","card_uri":"/cards/CA7pET83WM25VXO3IQ8BwYO3","card_status":"active","is_valid_cvv":true,"is_valid_cvv2":true,"is_valid_icvv":true,"is_valid_pin_block":true,"is_valid_exp_date":true,"is_expired":false,"is_pin_attempts_exceeded":true,"user_id":"US3zGWi1n852bTyqD1wCZ1ft","card_type":"physical"}'
     headers:
       Connection:
       - keep-alive
       Content-Length:
-      - '353'
+      - '365'
       Content-Type:
       - application/json
       Date:
-      - Wed, 14 Apr 2021 23:19:54 GMT
+      - Mon, 19 Jul 2021 21:49:45 GMT
       X-Amzn-Trace-Id:
-      - Root=1-60777894-7b1b1c365ab7d3e818fd9b89;Sampled=0
+      - Root=1-60f5f376-75f7965c3976d7c804797f9d;Sampled=0
       X-Request-Time:
-      - 'value: 5.099'
+      - 'value: 2.115'
       x-amz-apigw-id:
-      - dy_HSH_miYcF2Yw=
+      - CvL6mFAwiYcFcUw=
       x-amzn-Remapped-Connection:
       - keep-alive
       x-amzn-Remapped-Content-Length:
-      - '353'
+      - '365'
       x-amzn-Remapped-Date:
-      - Wed, 14 Apr 2021 23:19:54 GMT
+      - Mon, 19 Jul 2021 21:49:45 GMT
       x-amzn-Remapped-Server:
-      - nginx/1.18.0
+      - nginx/1.20.1
       x-amzn-Remapped-x-amzn-RequestId:
-      - 1b3475f9-24d3-4d08-bad5-de61287be5e4
+      - f60d03ba-c92b-466e-88b7-8e555c909328
       x-amzn-RequestId:
-      - c0f8ddfb-88d8-4d11-b3cf-7a4048abdea5
+      - 1361d0a6-9c7f-4b26-b616-df302cdc2152
     status:
       code: 201
       message: Created
@@ -66,41 +66,41 @@ interactions:
       Connection:
       - keep-alive
       User-Agent:
-      - cuenca-python/0.7.5
+      - cuenca-python/0.7.8.dev4
       X-Cuenca-Api-Version:
       - '2020-03-19'
     method: GET
     uri: https://sandbox.cuenca.com/cards/CA7pET83WM25VXO3IQ8BwYO3
   response:
     body:
-      string: '{"id":"CA7pET83WM25VXO3IQ8BwYO3","created_at":"2021-03-11T22:54:35.337000","updated_at":"2021-03-11T23:45:23.266000","user_id":"US3zGWi1n852bTyqD1wCZ1ft","number":"5448750129965637","exp_month":2,"exp_year":25,"cvv2":"150","type":"physical","status":"active","pin":"6725","issuer":"cuenca","funding_type":"debit","pin_block":"461F248CA285A5CB","batch":null,"manufacturer":null,"cvv":"685","icvv":"399","pin_block_switch":"3B241739AB05D290","pin_block_embosser":"26641FB1CB03B667"}'
+      string: '{"id":"CA7pET83WM25VXO3IQ8BwYO3","created_at":"2021-03-11T22:54:35.337000","updated_at":"2021-07-19T21:49:43.822000","user_id":"US3zGWi1n852bTyqD1wCZ1ft","number":"5448750129965637","exp_month":2,"exp_year":25,"cvv2":"150","type":"physical","status":"active","pin":"6725","issuer":"cuenca","funding_type":"debit","pin_attempts_failed":0,"manufacturer":null,"cvv":"685","icvv":"399","pin_block":null,"pin_block_switch":"3B241739AB05D290"}'
     headers:
       Connection:
       - keep-alive
       Content-Length:
-      - '480'
+      - '434'
       Content-Type:
       - application/json
       Date:
-      - Wed, 14 Apr 2021 23:19:54 GMT
+      - Mon, 19 Jul 2021 21:49:45 GMT
       X-Amzn-Trace-Id:
-      - Root=1-6077789a-1895180e4d53b05655b53c24;Sampled=0
+      - Root=1-60f5f379-4f32cc71419805e2107977e4;Sampled=0
       X-Request-Time:
-      - 'value: 0.708'
+      - 'value: 0.720'
       x-amz-apigw-id:
-      - dy_IHEEZiYcFQsw=
+      - CvL68HpIiYcFuGA=
       x-amzn-Remapped-Connection:
       - keep-alive
       x-amzn-Remapped-Content-Length:
-      - '480'
+      - '434'
       x-amzn-Remapped-Date:
-      - Wed, 14 Apr 2021 23:19:54 GMT
+      - Mon, 19 Jul 2021 21:49:45 GMT
       x-amzn-Remapped-Server:
-      - nginx/1.18.0
+      - nginx/1.20.1
       x-amzn-Remapped-x-amzn-RequestId:
-      - fbde3e85-a233-481e-b0c0-33b0e9fc92d1
+      - 55f363d5-693b-4c1f-a07c-b24a58233b9f
       x-amzn-RequestId:
-      - 624ac3a8-9c57-4b4e-83b8-a7f21722e4ff
+      - e0d9cb0e-494e-4e46-aab6-7fcff66ad713
     status:
       code: 200
       message: OK
diff --git a/tests/resources/test_card_validations.py b/tests/resources/test_card_validations.py
index 948e7ef..c7afed1 100644
--- a/tests/resources/test_card_validations.py
+++ b/tests/resources/test_card_validations.py
@@ -6,13 +6,14 @@ from cuenca.resources import CardValidation
 @pytest.mark.vcr
 def test_card_validations():
     card_data = dict(
-        number='1234567890123403',
+        number='5448750129965637',
         cvv='685',
         cvv2='150',
         icvv='399',
         exp_month=2,
         exp_year=25,
-        pin_block='BDIEHA38457W',
+        pin_block='3B241739AB05D290',
+        pin_attempts_exceeded=True,
     )
     validation = CardValidation.create(**card_data)
     assert validation.is_active
@@ -26,3 +27,4 @@ def test_card_validations():
     c = validation.card
     assert validation.card_id == c.id
     assert validation.is_active
+    assert validation.is_pin_attempts_exceeded