Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

create NotificationFilterUrlMonetaryAccount _FIELD_ID mismatch #130

Open
1 of 2 tasks
abelstam12 opened this issue Mar 11, 2020 · 1 comment
Open
1 of 2 tasks

create NotificationFilterUrlMonetaryAccount _FIELD_ID mismatch #130

abelstam12 opened this issue Mar 11, 2020 · 1 comment

Comments

@abelstam12
Copy link

abelstam12 commented Mar 11, 2020

Steps to reproduce:

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)

What should happen:

print the NotificationFilterModel

What happens:

  1. Throws keyerror exception 'Id'

Traceback

[{'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])

SDK version and environment

  • Tested on 0.12.4
  • Sandbox
  • Production
    aenum==2.2.3
    bunq-sdk==1.13.1
    certifi==2019.11.28
    cffi==1.14.0
    chardet==3.0.4
    cryptography==2.8
    idna==2.9
    pycparser==2.20
    pycryptodomex==3.9.7
    requests==2.23.0
    simplejson==3.17.0
    six==1.14.0
    urllib3==1.25.8

Response id

  • Response id:

Extra info:

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).

@jelle-r
Copy link

jelle-r commented Feb 19, 2024

I have this problem as well. Via

endpoint.NotificationFilterUrlUser.create(notification_filters=[NotificationFilterUrl("MUTATION", "https://test.com")])

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants