bunq / sdk_python

Python SDK for bunq API
MIT License
106 stars 25 forks source link

Event object Payment.counterparty_alias is None #116

Open wilmardo opened 4 years ago

wilmardo commented 4 years ago

Steps to reproduce:

  1. Request events with the endpoint.Event.list()
  2. If an event has event.object_.Payment defined both the counterparty_alias.label_monetary_account and counterparty_alias.pointer are None

Quick test code:

        # Get payments
        payments = endpoint.Payment.list(
            monetary_account_id=monetary_account_id,
            params=params,
        ).value

        # Add parameters to only list for current monetary_account_id
        params['monetary_account_id'] = monetary_account_id      
        params['display_user_event'] = 'false'

        # Get events
        events = endpoint.Event.list(
            params=params,
        ).value

        for payment in payments:
            print(payment.counterparty_alias.label_monetary_account)

        for event in events:
            if event.object_.Payment:
                print(event.object_.Payment.counterparty_alias.label_monetary_account)

Output:

<bunq.sdk.model.generated.object_.LabelMonetaryAccount object at 0x7f3489f4ab70>
<bunq.sdk.model.generated.object_.LabelMonetaryAccount object at 0x7f3489f4d668>
<bunq.sdk.model.generated.object_.LabelMonetaryAccount object at 0x7f3489ed1160>
None
None
None

What should happen:

  1. The Payment object within Event.object_ should have the same attributes as the Payment object

What happens:

  1. the counterparty_alias variables are None

Traceback

SDK version and environment

wilmardo commented 4 years ago

@OGKevin ping, don't want to be rude but the Bunq support is of no help in this case haha

wilmardo commented 4 years ago
payment._counterparty_alias._ERROR_COULD_NOT_INSTANTIATE: ''Could not directly instantiate MonetaryAccountReference. Please use the class factory methods.''

This is the error thrown :)