bunq / sdk_php

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

ApiContext::restore() billing_contract is null resulting in "BunqModel::createFromResponseArray() must be of the type array" error #214

Closed RoodFruit closed 2 years ago

RoodFruit commented 3 years ago

Steps to reproduce:

  1. Create a new bunq json file as a company (UserCompany) using ApiContext::create(.... Using your existing one will not produce the error, since the node billing_contract causing it, is probably not in your json file yet.
  2. Run a command to the API. This uses your existing ApiContext by using ApiContext::restore(...
  3. Using this restore() will create an error:
    Argument 1 passed to bunq\Model\Core\BunqModel::createFromResponseArray() must be of the type array, null given, called in ...vendor/bunq/sdk_php/src/Model/Core/BunqModel.php on line 254

What should happen

  1. Return an empty array for the field billing_contract of UserCompany instead of a null value.

What happens:

  1. In your newly created bunq json file is a node called billing_contract like so:
    "billing_contract": [
     null,
     null,
     null
    ],

    Since this is null, the the parser prompts an error resulting in an unusable API.

SDK version and environment

Dirty workaround

RoodFruit commented 3 years ago

See #206

RoodFruit commented 2 years ago

Bunq fixed the issue in 1.14.2.