bunq / sdk_php

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

Balance is null #194

Closed Tantuss closed 4 years ago

Tantuss commented 4 years ago

Steps to reproduce:

Small piece of PHP code: $monetaryAccounts = MonetaryAccount::listing()->getValue(); foreach ($monetaryAccounts as $monetaryAccount) { $account = $monetaryAccount->getMonetaryAccountBank(); $balance = $account->getBalance()->getValue(); }

This '$account->getBalance()' is already returning NULL, so the getValue() is generating an error.

What should happen:

  1. Get a balance back.

What happens:

  1. Balance is NULL, what isn't correct. There is for sure money on the accounts.

SDK version and environment

basst85 commented 4 years ago

Steps to reproduce:

Small piece of PHP code: $monetaryAccounts = MonetaryAccount::listing()->getValue(); foreach ($monetaryAccounts as $monetaryAccount) { $account = $monetaryAccount->getMonetaryAccountBank(); $balance = $account->getBalance()->getValue(); }

This '$account->getBalance()' is already returning NULL, so the getValue() is generating an error.

Hello!

This code works on my machine, it returns the balances of all active monetary accounts:

$monetaryAccountList = MonetaryAccountBank::listing([])->getValue();

foreach ($monetaryAccountList as $monetaryAccount) {
    if ($monetaryAccount->getStatus() === 'ACTIVE') {
        echo $monetaryAccount->getBalance()->getValue() . '<br/>';
    }
}
Tantuss commented 4 years ago

Is it possible to do some setting in the app to hide your balance in the API?

basst85 commented 4 years ago

Is it possible to do some setting in the app to hide your balance in the API?

Nope, your account balances are always visible via the API

Tantuss commented 4 years ago

I tried with another Bunq account, then it works fine. I attached the debugger and then I really see that the balance value is null, so it looks like it's some issue in the Bunq API and not in this library.

Tantuss commented 4 years ago

I think it's some security issue, I will send a detailed report how to reproduce directly to the support of Bunq. So their tech support can look into it.