bunq / sdk_php

PHP SDK for bunq API
MIT License
84 stars 54 forks source link

toJson() fails on ApiContext of an user person due to session context #56

Closed OGKevin closed 6 years ago

OGKevin commented 6 years ago

Steps to reproduce:

  1. Make an ApiContext with an UserPerson API key
  2. Call the toJson() method on this context

What should happen:

  1. The user will get a JSON representation of the ApiContext

What happens:

  1. You will get the following error:
Return value of bunq\Model\Core\SessionServer::getUserCompany() must be an instance of bunq\Model\Generated\Endpoint\UserCompany, null returned
 /Users/khellemun/GitHub/bunq/sdk_php/src/Model/Core/SessionServer.php:79
 /Users/khellemun/GitHub/bunq/sdk_php/src/Context/SessionContext.php:76
 /Users/khellemun/GitHub/bunq/sdk_php/src/Context/SessionContext.php:64
 /Users/khellemun/GitHub/bunq/sdk_php/src/Context/SessionContext.php:52
 /Users/khellemun/GitHub/bunq/sdk_php/src/Context/ApiContext.php:164
 /Users/khellemun/GitHub/bunq/sdk_php/src/Context/ApiContext.php:123
 /Users/khellemun/GitHub/bunq/sdk_php/src/Context/ApiContext.php:110
 /Users/khellemun/GitHub/bunq/sdk_php/tests/BunqSdkTestBase.php:64
 /Users/khellemun/GitHub/bunq/sdk_php/tests/Context/ApiContextTest.php:22

Extra info:

basst85 commented 6 years ago

Thanks for writing this issue 👍