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

Monetary account joint cannot be retrieved. #76

Closed
OGKevin opened this issue Dec 3, 2017 · 5 comments
Closed

Monetary account joint cannot be retrieved. #76

OGKevin opened this issue Dec 3, 2017 · 5 comments

Comments

@OGKevin
Copy link
Contributor

OGKevin commented Dec 3, 2017

Steps to reproduce:

  1. Create a new joint account
  2. try something like MonetaryAccount.list

What should happen:

  1. Monetary account joints are also listed

What happens:

  1. you will get all accounts except the new joint accounts

Logs

  • Logs no logs

Extra info:

@OGKevin OGKevin self-assigned this Dec 3, 2017
@OGKevin OGKevin changed the title Monetary account joint cannot be retrieve via pub api. Monetary account joint cannot be retrieved via pub api. Dec 3, 2017
@OGKevin OGKevin changed the title Monetary account joint cannot be retrieved via pub api. Monetary account joint cannot be retrieved. Jan 5, 2018
@JanMisker
Copy link

The joint accounts are returned in the response, but a call to MonetaryAccount::listing() now fails, I think because in the MonetaryAccountJoint in the response the property all_co_owner with the co-owners is not properly mapped to the CoOwner model.

Background: debugging I found that the MonetaryAccountJoint looks very much like the MonetaryAccountBank, except for the addition of the all_co_owner property, which is an object with two properties: alias (user object for the co-owner) and status. Somehow this isn't picked up properly, maybe because in CoOwner.php the declaration of $alias has@var LabelUser[] instead of @var LabelUser (although that last also didn't work when I quickly tried it).

@OGKevin
Copy link
Contributor Author

OGKevin commented Apr 6, 2018

Interesting, if its not mapped/populated with data then there is indeed a definition error. The response contains data or the data is structured in some way that the SDK does not know what to do with it. To actually write a test case for this will be hard as creating a joint account requires 2 users 🤔.

So the way I could test this is to get my hands on a raw monetary account joint response and map it to the model and ensure the fields are set.

@JanMisker thanks for reporting.

@OGKevin OGKevin added the bug label Apr 6, 2018
@JanMisker
Copy link

I should have been more clear, there is now a Fatal error on the listing call, it's not just the all_co_owner field that doesn't get populated.

Fatal error: Uncaught TypeError: Argument 1 passed to bunq\Model\Core\BunqModel::createFromResponseArray() must be of the type array, string given, called in /MYPATH/vendor/bunq/sdk_php/src/Model/Core/BunqModel.php on line 236 and defined in /MYPATH/vendor/bunq/sdk_php/src/Model/Core/BunqModel.php on line 97

Call Stack:

    0.1188     379760   1. {main}() /MYPATH/test.php:0
    1.8088    2383488   2. bunq\Model\Generated\Endpoint\MonetaryAccount::listing(???, ???) /MYPATH/test.php:111
    8.1000    2419968   3. bunq\Model\Core\BunqModel::fromJsonList(???, ???) /MYPATH/vendor/bunq/sdk_php/src/Model/Generated/Endpoint/MonetaryAccount.php:100
    8.1007    2495224   4. bunq\Model\Core\BunqModel::createListFromResponseArray(???, ???) /MYPATH/vendor/bunq/sdk_php/src/Model/Core/BunqModel.php:296
    8.1111    2498968   5. bunq\Model\Core\BunqModel::createFromResponseArray(???, ???) /MYPATH/vendor/bunq/sdk_php/src/Model/Core/BunqModel.php:236
    8.1111    2498968   6. bunq\Model\Core\BunqModel::createFromResponseArrayAnchorObject(???, ???) /MYPATH/vendor/bunq/sdk_php/src/Model/Core/BunqModel.php:102
    8.1111    2498968   7. bunq\Model\Core\BunqModel::createInstanceFromResponseArray(???) /MYPATH/vendor/bunq/sdk_php/src/Model/Core/BunqModel.php:134
    8.1112    2499440   8. bunq\Model\Core\BunqModel::determineFieldContents(???, ???) /MYPATH/vendor/bunq/sdk_php/src/Model/Core/BunqModel.php:159
    8.1131    2542304   9. bunq\Model\Core\BunqModel::createFromResponseArray(???, ???) /MYPATH/vendor/bunq/sdk_php/src/Model/Core/BunqModel.php:206
    8.1131    2542304  10. bunq\Model\Core\BunqModel::createInstanceFromResponseArray(???) /MYPATH/vendor/bunq/sdk_php/src/Model/Core/BunqModel.php:113
    8.1215    2544584  11. bunq\Model\Core\BunqModel::determineFieldContents(???, ???) /MYPATH/vendor/bunq/sdk_php/src/Model/Core/BunqModel.php:159
   15.0952    2553800  12. bunq\Model\Core\BunqModel::createListFromResponseArray(???, ???) /MYPATH/vendor/bunq/sdk_php/src/Model/Core/BunqModel.php:201
   15.0954    2553800  13. bunq\Model\Core\BunqModel::createFromResponseArray(???, ???) /MYPATH/vendor/bunq/sdk_php/src/Model/Core/BunqModel.php:236
   15.0954    2553800  14. bunq\Model\Core\BunqModel::createInstanceFromResponseArray(???) /MYPATH/vendor/bunq/sdk_php/src/Model/Core/BunqModel.php:113
   15.0957    2554224  15. bunq\Model\Core\BunqModel::determineFieldContents(???, ???) /MYPATH/vendor/bunq/sdk_php/src/Model/Core/BunqModel.php:159
   16.0959    2569968  16. bunq\Model\Core\BunqModel::createListFromResponseArray(???, ???) /MYPATH/vendor/bunq/sdk_php/src/Model/Core/BunqModel.php:201
   16.0962    2569968  17. bunq\Model\Core\BunqModel::createFromResponseArray(???, ???) /MYPATH/vendor/bunq/sdk_php/src/Model/Core/BunqModel.php:236

@JanMisker
Copy link

Found it, in

Replace
* @var LabelUser[]
with
* @var LabelUser
and it works.

But this is generated code, so probably needs to be changed elsewhere, but for my purposes it works now.

@OGKevin
Copy link
Contributor Author

OGKevin commented Apr 7, 2018

@JanMisker thanks for reporting, debugging and finding the solution!

This is indeed generated code and has te be changed on our side. As its a miss definition, it should be an ez fix. I will take it over from here.

@OGKevin OGKevin added this to To do in 1.0.0 - SDK via automation Apr 7, 2018
@OGKevin OGKevin added this to the 0.13.5 milestone Apr 7, 2018
@OGKevin OGKevin moved this from To do to pending review in 1.0.0 - SDK Apr 7, 2018
@OGKevin OGKevin moved this from pending review to To do in 1.0.0 - SDK Apr 8, 2018
OGKevin added a commit that referenced this issue Apr 9, 2018
@OGKevin OGKevin moved this from To do to In progress in 1.0.0 - SDK Apr 9, 2018
OGKevin added a commit that referenced this issue Apr 29, 2018
@OGKevin OGKevin moved this from In progress to pending review in 1.0.0 - SDK Apr 29, 2018
OGKevin added a commit that referenced this issue May 1, 2018
@OGKevin OGKevin closed this as completed May 1, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
No open projects
1.0.0 - SDK
  
Done
Development

No branches or pull requests

2 participants