Skip to content

Commit

Permalink
filter funding_instrument_uri in balance entries (#142)
Browse files Browse the repository at this point in the history
* filter funding_instrument in balance_entries

* change version cuenca-validation

* bump version

Co-authored-by: Matin Tamizi <[email protected]>
  • Loading branch information
Keryc Diaz and matin authored Apr 8, 2021
1 parent 896458c commit 0773a50
Show file tree
Hide file tree
Showing 5 changed files with 68 additions and 3 deletions.
3 changes: 2 additions & 1 deletion cuenca/resources/balance_entries.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from typing import ClassVar, TypeVar, cast

from cuenca_validations.types import EntryType
from cuenca_validations.types import BalanceEntryQuery, EntryType
from pydantic.dataclasses import dataclass

from .accounts import Account
Expand All @@ -17,6 +17,7 @@
@dataclass
class BalanceEntry(Retrievable, Queryable):
_resource: ClassVar = 'balance_entries'
_query_params: ClassVar = BalanceEntryQuery

amount: int # negative in the case of a debit
descriptor: str
Expand Down
2 changes: 1 addition & 1 deletion cuenca/version.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
__version__ = '0.7.3'
__version__ = '0.7.4'
CLIENT_VERSION = __version__
API_VERSION = '2020-03-19'
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
requests==2.25.1
cuenca-validations==0.9.0
cuenca-validations==0.9.2
dataclasses>=0.7;python_version<"3.7"
55 changes: 55 additions & 0 deletions tests/resources/cassettes/test_query_balance_entry.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
interactions:
- request:
body: null
headers:
Accept:
- '*/*'
Accept-Encoding:
- gzip, deflate
Authorization:
- DUMMY
Connection:
- keep-alive
User-Agent:
- cuenca-python/0.7.1
X-Cuenca-Api-Version:
- '2021-04-08'
X-Cuenca-LoginToken:
- LTHFBUsQ--SRKYo09VXLuToQ
method: GET
uri: https://sandbox.cuenca.com/balance_entries?limit=2&funding_instrument_uri=/accounts/BA01
response:
body:
string: '{"items":[{"id":"TV01","created_at":"2020-10-15T22:27:53.712000","user_id":"US4PCNV8rLB2wqBfORzIAXUl","name":"Dep\u00f3sito
de efectivo","amount":25000,"descriptor":"Deposito v\u00eda paynet auth 304054","rolling_balance":144519,"type":"credit","related_transaction_uri":"/deposits/CDI7SJOifauN5WnqfMhXK4R","funding_instrument_uri":"/accounts/BA01"}],"next_page_uri":null}'
headers:
Connection:
- keep-alive
Content-Length:
- '232'
Content-Type:
- application/json
Date:
- Thu, 08 Apr 2021 00:03:02 GMT
X-Amzn-Trace-Id:
- Root=1-60553bb5-393799840ea3e46a75052790;Sampled=0
X-Request-Time:
- 'value: 0.283'
x-amz-apigw-id:
- cdZEaGpjiYcFWbg=
x-amzn-Remapped-Connection:
- keep-alive
x-amzn-Remapped-Content-Length:
- '232'
x-amzn-Remapped-Date:
- Thu, 08 Apr 2021 00:03:02 GMT
x-amzn-Remapped-Server:
- nginx/1.18.0
x-amzn-Remapped-x-amzn-RequestId:
- 28c580ed-57e3-4f3f-ae1b-fcacc39c8318
x-amzn-RequestId:
- 29fab010-c42c-442c-8eea-2dad8021df7a
status:
code: 200
message: OK
version: 1
9 changes: 9 additions & 0 deletions tests/resources/test_balance_entries.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,12 @@ def test_balance_entry_retrieve():
assert balance_entry.id == id_entry
assert balance_entry.related_transaction
assert balance_entry.funding_instrument


@pytest.mark.vcr
def test_query_balance_entry():
funding_instrument_uri = '/accounts/BA01'
balance_entry: BalanceEntry = BalanceEntry.one(
funding_instrument_uri=funding_instrument_uri
)
balance_entry.funding_instrument_uri = funding_instrument_uri

0 comments on commit 0773a50

Please sign in to comment.