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

No payment details in the result inquiries of a bunq me tab in the api #114

Closed
1 task
degeusio opened this issue Apr 2, 2019 · 1 comment · Fixed by #119
Closed
1 task

No payment details in the result inquiries of a bunq me tab in the api #114

degeusio opened this issue Apr 2, 2019 · 1 comment · Fixed by #119

Comments

@degeusio
Copy link

degeusio commented Apr 2, 2019

Steps to reproduce:

  1. Create a BunqMeTab
  2. Make a payment using the BunqMeTab share url
  3. Get the BunqMeTab again

What should happen:

  1. The response under 3. should contain the payment detail

What happens:

  1. The response under 3. does not contain the payment detail

Traceback

SDK version and environment

  • Tested on released version 1.1.0
  • Sandbox
  • [ X] Production

Response id

  • Response id:

Extra info:

This is exactly the same issue as reported here for the python sdk

https://together.bunq.com/d/4500-no-payment-details-in-the-result-inquiries-of-a-bunq-me-tab-in-the-api/3

Confirmed that the Raw response DOES contain the expected payment detail. The issue is caused by erroneous unmarshalling here:

BunqModel.java:

protected static BunqResponse fromJson(Class classOfObject, BunqResponseRaw responseRaw, String wrapper) {
JsonObject responseItemObject = getResponseItemObject(responseRaw); // RAW RESPONSE LOOKS OK, CONTAINS THE PAYMENT DETAIL
JsonObject responseItemObjectUnwrapped = getWrappedContent(responseItemObject, wrapper);
T responseValue = gson.fromJson(responseItemObjectUnwrapped, classOfObject); // HERE IT GOES WRONG, PAYMENT DETAIL IS EMPTY
return new BunqResponse(responseValue, responseRaw.getHeaders());
}

@degeusio
Copy link
Author

degeusio commented Apr 2, 2019

Update:
The bug is caused by a difference between the Java object hierarchy and the hierarchy in the api response. The payment object is nested twice.

Unmarshalling the raw reponse as follows resolves a Payment included in the first 'inquiry_result'.

JsonObject target = jsonObject.getAsJsonArray("Response")
                        .get(0)
                        .getAsJsonObject()
                        .getAsJsonObject("BunqMeTab")
                        .getAsJsonArray("result_inquiries")
                        .get(0)
                        .getAsJsonObject()
                        .getAsJsonObject("payment")
                        .getAsJsonObject("Payment") // this is were the bug caused by mapping error java vs. Json is...
        );
        Payment payment = gson.fromJson(target, Payment.class); //now unmarshals to correct object  

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

Successfully merging a pull request may close this issue.

1 participant