Skip to content

Commit a3e28dc

Browse files
authored
Cash Reference Resource (#306)
1 parent f9a634e commit a3e28dc

File tree

8 files changed

+130
-4
lines changed

8 files changed

+130
-4
lines changed

cuenca/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
'CardActivation',
1010
'CardTransaction',
1111
'CardValidation',
12+
'CashReference',
1213
'Clabe',
1314
'CurpValidation',
1415
'Commission',
@@ -52,6 +53,7 @@
5253
CardActivation,
5354
CardTransaction,
5455
CardValidation,
56+
CashReference,
5557
Clabe,
5658
Commission,
5759
CurpValidation,

cuenca/resources/__init__.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
'CardActivation',
99
'CardTransaction',
1010
'CardValidation',
11+
'CashReference',
1112
'Clabe',
1213
'Commission',
1314
'CurpValidation',
@@ -44,6 +45,7 @@
4445
from .card_transactions import CardTransaction
4546
from .card_validations import CardValidation
4647
from .cards import Card
48+
from .cash_references import CashReference
4749
from .clabes import Clabe
4850
from .commissions import Commission
4951
from .curp_validations import CurpValidation
@@ -83,6 +85,7 @@
8385
CardActivation,
8486
CardTransaction,
8587
CardValidation,
88+
CashReference,
8689
Clabe,
8790
CurpValidation,
8891
Commission,
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
from typing import ClassVar
2+
3+
from .base import Queryable, Retrievable
4+
5+
6+
class CashReference(Queryable, Retrievable):
7+
_resource: ClassVar = 'cash_references'
8+
9+
number: str
10+
user_id: str

cuenca/resources/clabes.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,11 @@
11
from typing import ClassVar, cast
22

3-
from cuenca_validations.types import QueryParams
4-
53
from ..http import Session, session as global_session
64
from .base import Creatable, Queryable, Retrievable
75

86

97
class Clabe(Creatable, Queryable, Retrievable):
108
_resource: ClassVar = 'clabes'
11-
_query_params: ClassVar = QueryParams
129
clabe: str
1310
user_id: str
1411

cuenca/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
__version__ = '0.13.10'
1+
__version__ = '0.14.0'
22
CLIENT_VERSION = __version__
33
API_VERSION = '2020-03-19'
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
interactions:
2+
- request:
3+
body: null
4+
headers:
5+
Accept:
6+
- '*/*'
7+
Accept-Encoding:
8+
- gzip, deflate
9+
Authorization:
10+
- DUMMY
11+
Connection:
12+
- keep-alive
13+
User-Agent:
14+
- cuenca-python/0.13.10
15+
X-Cuenca-Api-Version:
16+
- '2020-03-19'
17+
method: GET
18+
uri: https://sandbox.cuenca.com/cash_references
19+
response:
20+
body:
21+
string: '{"items":[{"id":"CR4EI4kVBwHboi8gCUxMnP9q","number":"2718285113832091","user_id":"USlen-v7UQSqqZTGVe3vQmLQ","created_at":"2022-08-23T22:44:45.259000"}],"next_page_uri":null,"count":null}'
22+
headers:
23+
Connection:
24+
- keep-alive
25+
Content-Length:
26+
- '186'
27+
Content-Type:
28+
- application/json
29+
Date:
30+
- Tue, 23 Aug 2022 23:13:07 GMT
31+
X-Request-Time:
32+
- 'value: 0.063'
33+
x-amz-apigw-id:
34+
- XVvIgGbxoAMFZ7w=
35+
x-amzn-Remapped-Connection:
36+
- keep-alive
37+
x-amzn-Remapped-Content-Length:
38+
- '186'
39+
x-amzn-Remapped-Date:
40+
- Tue, 23 Aug 2022 23:13:07 GMT
41+
x-amzn-Remapped-Server:
42+
- nginx/1.22.0
43+
x-amzn-RequestId:
44+
- bbfddca2-09f2-44cc-88a2-b41688c63cfb
45+
status:
46+
code: 200
47+
message: OK
48+
version: 1
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
interactions:
2+
- request:
3+
body: null
4+
headers:
5+
Accept:
6+
- '*/*'
7+
Accept-Encoding:
8+
- gzip, deflate
9+
Authorization:
10+
- DUMMY
11+
Connection:
12+
- keep-alive
13+
User-Agent:
14+
- cuenca-python/0.13.10
15+
X-Cuenca-Api-Version:
16+
- '2020-03-19'
17+
method: GET
18+
uri: https://sandbox.cuenca.com/cash_references/CR4EI4kVBwHboi8gCUxMnP9q
19+
response:
20+
body:
21+
string: '{"id":"CR4EI4kVBwHboi8gCUxMnP9q","number":"2718285113832091","user_id":"USlen-v7UQSqqZTGVe3vQmLQ","created_at":"2022-08-23T22:44:45.259000"}'
22+
headers:
23+
Connection:
24+
- keep-alive
25+
Content-Length:
26+
- '140'
27+
Content-Type:
28+
- application/json
29+
Date:
30+
- Tue, 23 Aug 2022 23:13:06 GMT
31+
X-Request-Time:
32+
- 'value: 0.126'
33+
x-amz-apigw-id:
34+
- XVvIcGW2IAMF4Zg=
35+
x-amzn-Remapped-Connection:
36+
- keep-alive
37+
x-amzn-Remapped-Content-Length:
38+
- '140'
39+
x-amzn-Remapped-Date:
40+
- Tue, 23 Aug 2022 23:13:06 GMT
41+
x-amzn-Remapped-Server:
42+
- nginx/1.22.0
43+
x-amzn-RequestId:
44+
- 20d0f1fa-5bb2-4748-a464-de141117dcd4
45+
status:
46+
code: 200
47+
message: OK
48+
version: 1
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import pytest
2+
3+
from cuenca import CashReference
4+
5+
6+
@pytest.mark.vcr
7+
def test_cash_reference_retrieve():
8+
reference = 'CR4EI4kVBwHboi8gCUxMnP9q'
9+
clabe = CashReference.retrieve(reference)
10+
assert clabe
11+
assert clabe.id == reference
12+
assert clabe.number
13+
14+
15+
@pytest.mark.vcr
16+
def test_cash_reference_all():
17+
references = list(CashReference.all())
18+
assert len(references) == 1

0 commit comments

Comments
 (0)