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 · 2 comments
Open
1 of 2 tasks

create NotificationFilterUrlMonetaryAccount _FIELD_ID mismatch #130

abelstam12 opened this issue Mar 11, 2020 · 2 comments

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")])

@two-trick-pony-NL
Copy link

👋 Hey @abelstam12

I work at bunq and am currently reviewing the bunq API docs, open issues and SDK’s and came across your issue. I know it’s been open for a while, and I’d love to understand how it’s impacting you. Beyond the obvious -fixing this issue-, what else could we do to improve your experience with our API?

If you want to share your thoughts on how we can improve on our public API:

📅 I'd love to schedule a 15 minute interview to understand your needs through: Calendly
💬 Or if you don't have time for a call, you can give us some general feedback through this form

Your feedback will go straight to our product team! 🚀

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

3 participants