Open abelstam12 opened 4 years ago
1.
from bunq.sdk.context.api_context import ApiContext from bunq.sdk.context.api_environment_type import ApiEnvironmentType from bunq.sdk.model.generated.object_ import Amount, NotificationFilterUrl from bunq.sdk.http.api_client import ApiClient from bunq.sdk.model.generated import endpoint from bunq.sdk.context.bunq_context import BunqContext CONTEXT_PATH = './context.ctx' try: context = ApiContext.restore(CONTEXT_PATH) except Exception as e: context = ApiContext.create( ApiEnvironmentType.PRODUCTION, SECRET['api_key'], "blablabala", all_permitted_ip=['*'], ) context.save(CONTEXT_PATH) BunqContext.load_api_context(context) client = Client(context) # just to get a monetary acc r=endpoint.MonetaryAccount.list().value for l in r: print(l.MonetaryAccountBank.id_) print(l.MonetaryAccountBank.__dict__) id_ = l.MonetaryAccountBank.id_ break r = endpoint.NotificationFilterUrlMonetaryAccount.create( id_, notification_filters=[ NotificationFilterUrl( category='BUNQME_TAB', notification_target='https://quwy.nl/gimmemymoney/' ) ] ) print(r)
1. print the NotificationFilterModel
[{'NotificationFilterUrl': {'id': 96297678, 'created': '2020-03-11 17:29:22.491900', 'updated': '2020-03-11 17:29:22.491900', 'category': 'BUNQME_TAB', 'notification_target': 'https://quwy.nl/gimmemymoney/'}}] Traceback (most recent call last): File "client.py", line 61, in <module> notification_target='https://quwy.nl/gimmemymoney/' File "/Users/abel/Desktop/elastiek/bunq/env/lib/python3.7/site-packages/bunq/sdk/model/generated/endpoint.py", line 29106, in create cls._process_for_id(response_raw) File "/Users/abel/Desktop/elastiek/bunq/env/lib/python3.7/site-packages/bunq/sdk/model/core/bunq_model.py", line 77, in _process_for_id cls._unwrap_response_single(obj, cls._FIELD_ID) File "/Users/abel/Desktop/elastiek/bunq/env/lib/python3.7/site-packages/bunq/sdk/model/core/bunq_model.py", line 64, in _unwrap_response_single print(obj[cls._FIELD_RESPONSE][cls._INDEX_FIRST][wrapper])
Seems to be a mismatch of cls._FIELD_ID in the BunqModel NotificationFilterUrlMonetaryAccount versus the id provided in the api response. Api response contains key: 'id', whilst the cls._FIELD_ID = 'Id' (capitalized).
cls._FIELD_ID
BunqModel
NotificationFilterUrlMonetaryAccount
I have this problem as well. Via
endpoint.NotificationFilterUrlUser.create(notification_filters=[NotificationFilterUrl("MUTATION", "https://test.com")])
Steps to reproduce:
1.
What should happen:
1. print the NotificationFilterModel
What happens:
Traceback
SDK version and environment
Response id
Extra info:
Seems to be a mismatch of
cls._FIELD_ID
in theBunqModel
NotificationFilterUrlMonetaryAccount
versus the id provided in the api response. Api response contains key: 'id', whilst thecls._FIELD_ID
= 'Id' (capitalized).