bunq / sdk_php

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

MonetaryAccount listing succeeds on sandbox but fails on production #145

Closed mbernson closed 6 years ago

mbernson commented 6 years ago

Steps to reproduce:

  1. Have a joint account. In my case it's a closed one.
  2. Install tinker and run ./go-pro to get a production config file
  3. Run the attached piece of code within the tinker folder

What should happen:

  1. It lists the monetary accounts without a problem

What happens:

  1. Decoding the response fails, apparently on one of the LabelUser objects within the CoOwner object of the joint account

Traceback

Fatal error: Uncaught TypeError: Argument 1 passed to bunq\Model\Core\BunqModel::createFromResponseArray() must be of the type array, string given, called in /Users/mathijsb/tinkerbug/vendor/bunq/sdk_php/src/Model/Core/BunqModel.php on line 236 and defined in /Users/mathijsb/tinkerbug/vendor/bunq/sdk_php/src/Model/Core/BunqModel.php:97
Stack trace:
#0 /Users/mathijsb/tinkerbug/vendor/bunq/sdk_php/src/Model/Core/BunqModel.php(236): bunq\Model\Core\BunqModel::createFromResponseArray('[uuid here]...', NULL)
#1 /Users/mathijsb/tinkerbug/vendor/bunq/sdk_php/src/Model/Core/BunqModel.php(201): bunq\Model\Core\BunqModel::createListFromResponseArray(Array)
#2 /Users/mathijsb/tinkerbug/vendor/bunq/sdk_php/src/Model/Core/BunqModel.php(159): bunq\Model\Core\BunqModel::determineFieldContents(Object(ReflectionProperty), Array)
#3 /Users/mathijsb/tinkerbug/vendor/bunq/sdk_php/src/Model/Core/BunqModel.php(113): bunq\Model\Core\BunqModel::createInstanceFromResponseArray(Array)
#4 /Users/mathijsb/tinkerbug/vendor/bunq/sdk_php/src/Model in /Users/mathijsb/tinkerbug/vendor/bunq/sdk_php/src/Model/Core/BunqModel.php on line 97

Sample code

<?php

use bunq\Context\ApiContext;
use bunq\Context\BunqContext;
use bunq\Model\Generated\Endpoint\MonetaryAccount;

require 'vendor/autoload.php';

// Config file produced via Tinker/go-pro. The code works fine when using 'bunq-sandbox.conf'.
$configPath = 'bunq-production.conf';
$apiContext = ApiContext::restore($configPath);
$apiContext->ensureSessionActive();
BunqContext::loadApiContext($apiContext);

$allAccount = MonetaryAccount::listing();

SDK version and environment

OGKevin commented 6 years ago

This is fixed in #76

Please use develop branch until next release.

Thanks for reporting.