Skip to content

Commit aee295c

Browse files
authored
pin_tries in card_validations (#174)
* pin_tries in card_validations * lint * version * version * version * pin tries in card-validation * fix tests * version * optional field * versions * check pin_tries_exceeded * pin_attempts_exceeded
1 parent 4e0bbbb commit aee295c

File tree

5 files changed

+35
-30
lines changed

5 files changed

+35
-30
lines changed

cuenca/resources/card_validations.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ class CardValidation(Creatable):
2525
is_valid_icvv: Optional[bool]
2626
is_valid_pin_block: Optional[bool]
2727
is_valid_exp_date: Optional[bool]
28+
is_pin_attempts_exceeded: bool
2829
is_expired: bool
2930

3031
@classmethod
@@ -37,6 +38,7 @@ def create(
3738
exp_month: Optional[int] = None,
3839
exp_year: Optional[int] = None,
3940
pin_block: Optional[str] = None,
41+
pin_attempts_exceeded: Optional[str] = None,
4042
*,
4143
session: Session = global_session,
4244
) -> 'CardValidation':
@@ -48,6 +50,7 @@ def create(
4850
exp_month=exp_month,
4951
exp_year=exp_year,
5052
pin_block=pin_block,
53+
pin_attempts_exceeded=pin_attempts_exceeded,
5154
)
5255
return cast(
5356
'CardValidation', cls._create(session=session, **req.dict())

cuenca/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
__version__ = '0.7.7'
1+
__version__ = '0.7.8'
22
CLIENT_VERSION = __version__
33
API_VERSION = '2020-03-19'

requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
requests==2.25.1
2-
cuenca-validations==0.9.3
2+
cuenca-validations==0.9.8
33
dataclasses>=0.7;python_version<"3.7"

tests/resources/cassettes/test_card_validations.yaml

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
interactions:
22
- request:
3-
body: '{"number": "1234567890123403", "exp_month": 2, "exp_year": 25, "cvv": "685",
4-
"cvv2": "150", "icvv": "399", "pin_block": "BDIEHA38457W"}'
3+
body: '{"number": "5448750129965637", "exp_month": 2, "exp_year": 25, "cvv": "685",
4+
"cvv2": "150", "icvv": "399", "pin_block": "3B241739AB05D290"}'
55
headers:
66
Accept:
77
- '*/*'
@@ -16,41 +16,41 @@ interactions:
1616
Content-Type:
1717
- application/json
1818
User-Agent:
19-
- cuenca-python/0.7.5
19+
- cuenca-python/0.7.8.dev4
2020
X-Cuenca-Api-Version:
2121
- '2020-03-19'
2222
method: POST
2323
uri: https://sandbox.cuenca.com/card_validations
2424
response:
2525
body:
26-
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}'
26+
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"}'
2727
headers:
2828
Connection:
2929
- keep-alive
3030
Content-Length:
31-
- '353'
31+
- '365'
3232
Content-Type:
3333
- application/json
3434
Date:
35-
- Wed, 14 Apr 2021 23:19:54 GMT
35+
- Mon, 19 Jul 2021 21:49:45 GMT
3636
X-Amzn-Trace-Id:
37-
- Root=1-60777894-7b1b1c365ab7d3e818fd9b89;Sampled=0
37+
- Root=1-60f5f376-75f7965c3976d7c804797f9d;Sampled=0
3838
X-Request-Time:
39-
- 'value: 5.099'
39+
- 'value: 2.115'
4040
x-amz-apigw-id:
41-
- dy_HSH_miYcF2Yw=
41+
- CvL6mFAwiYcFcUw=
4242
x-amzn-Remapped-Connection:
4343
- keep-alive
4444
x-amzn-Remapped-Content-Length:
45-
- '353'
45+
- '365'
4646
x-amzn-Remapped-Date:
47-
- Wed, 14 Apr 2021 23:19:54 GMT
47+
- Mon, 19 Jul 2021 21:49:45 GMT
4848
x-amzn-Remapped-Server:
49-
- nginx/1.18.0
49+
- nginx/1.20.1
5050
x-amzn-Remapped-x-amzn-RequestId:
51-
- 1b3475f9-24d3-4d08-bad5-de61287be5e4
51+
- f60d03ba-c92b-466e-88b7-8e555c909328
5252
x-amzn-RequestId:
53-
- c0f8ddfb-88d8-4d11-b3cf-7a4048abdea5
53+
- 1361d0a6-9c7f-4b26-b616-df302cdc2152
5454
status:
5555
code: 201
5656
message: Created
@@ -66,41 +66,41 @@ interactions:
6666
Connection:
6767
- keep-alive
6868
User-Agent:
69-
- cuenca-python/0.7.5
69+
- cuenca-python/0.7.8.dev4
7070
X-Cuenca-Api-Version:
7171
- '2020-03-19'
7272
method: GET
7373
uri: https://sandbox.cuenca.com/cards/CA7pET83WM25VXO3IQ8BwYO3
7474
response:
7575
body:
76-
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"}'
76+
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"}'
7777
headers:
7878
Connection:
7979
- keep-alive
8080
Content-Length:
81-
- '480'
81+
- '434'
8282
Content-Type:
8383
- application/json
8484
Date:
85-
- Wed, 14 Apr 2021 23:19:54 GMT
85+
- Mon, 19 Jul 2021 21:49:45 GMT
8686
X-Amzn-Trace-Id:
87-
- Root=1-6077789a-1895180e4d53b05655b53c24;Sampled=0
87+
- Root=1-60f5f379-4f32cc71419805e2107977e4;Sampled=0
8888
X-Request-Time:
89-
- 'value: 0.708'
89+
- 'value: 0.720'
9090
x-amz-apigw-id:
91-
- dy_IHEEZiYcFQsw=
91+
- CvL68HpIiYcFuGA=
9292
x-amzn-Remapped-Connection:
9393
- keep-alive
9494
x-amzn-Remapped-Content-Length:
95-
- '480'
95+
- '434'
9696
x-amzn-Remapped-Date:
97-
- Wed, 14 Apr 2021 23:19:54 GMT
97+
- Mon, 19 Jul 2021 21:49:45 GMT
9898
x-amzn-Remapped-Server:
99-
- nginx/1.18.0
99+
- nginx/1.20.1
100100
x-amzn-Remapped-x-amzn-RequestId:
101-
- fbde3e85-a233-481e-b0c0-33b0e9fc92d1
101+
- 55f363d5-693b-4c1f-a07c-b24a58233b9f
102102
x-amzn-RequestId:
103-
- 624ac3a8-9c57-4b4e-83b8-a7f21722e4ff
103+
- e0d9cb0e-494e-4e46-aab6-7fcff66ad713
104104
status:
105105
code: 200
106106
message: OK

tests/resources/test_card_validations.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,14 @@
66
@pytest.mark.vcr
77
def test_card_validations():
88
card_data = dict(
9-
number='1234567890123403',
9+
number='5448750129965637',
1010
cvv='685',
1111
cvv2='150',
1212
icvv='399',
1313
exp_month=2,
1414
exp_year=25,
15-
pin_block='BDIEHA38457W',
15+
pin_block='3B241739AB05D290',
16+
pin_attempts_exceeded=True,
1617
)
1718
validation = CardValidation.create(**card_data)
1819
assert validation.is_active
@@ -26,3 +27,4 @@ def test_card_validations():
2627
c = validation.card
2728
assert validation.card_id == c.id
2829
assert validation.is_active
30+
assert validation.is_pin_attempts_exceeded

0 commit comments

Comments
 (0)