bunq / sdk_java

Java SDK for bunq API
MIT License
47 stars 23 forks source link

NullPointerException on creating NotificationFilterUrlUser #117

Closed victorjacobs closed 4 years ago

victorjacobs commented 5 years ago

It seems that the SDK for NotificationFilterUrlUser is out of date with the API response. The Swagger states that the response for a POST to this endpoint should return:

{
  "Id": {
    "id": 0
  }
}

However when I attempt the calls manually using the ApiClient (code copy pasted around from the SDK) it seems like the endpoint returns:

{
  "Response": [
    {
      "NotificationFilterUrl": {
        "category": "MUTATION",
        "notification_target": "https://example.com/callback"
      }
    }
  ],
  "Pagination": {
    "future_url": null,
    "newer_url": null,
    "older_url": null
  }
}

Which results in the SDK exploding. More example code can be found here.

Steps to reproduce:

Create a NotificationFilterUrlUser through:

NotificationFilterUrlUser.create(listOf(NotificationFilterUrl().apply {
    category = "MUTATION"
    notificationTarget = "https://example.com/callback"
}))

What should happen:

NotificationFilterUrlUser is created.

What happens:

NullPointerException is thrown in com.bunq.sdk.model.core.BunqModel.processForId(BunqModel.java:80):

Integer responseValue = gson.fromJson(responseItemObjectUnwrapped, Id.class).getId();

SDK version and environment