First, It is Solved. It is FOR SURE a bug with SDK and the BunqLib in Tinker and Examples.
The basic flow is:
Tinker::addCallbackUrl => BunqLib::addCallbackUrl => UserPerson::getNotificationFilters => Add new notification filters to the current filter list => UserPerson::update().
But this is wrong in several places:
at BunqLib::addCallbackUrl is using "new NotificationFilter()" to generate a new NotificationFilter Object. This is incorrect because the SDK is asking for the NotificationFilterUrlUser / NotificationFilterMonataryAccount;
at BunqLib::addCallbackUrl is using UserPerson::update() to set the new NotificationFiler. This is incorrect because:
a. the parameters are mismatched;
b. the update is no longer taking NotificationFilter as a parameter and it is not going to update the filters;
The Solution:
STEP 1. replace BunqLib::addCallbackUrl with:
public function addCallbackUrl(string $callbackUrl) {
$allUpdatedNotificationFilter[] = new NotificationFilterUrl(
self::NOTIFICATION_CATEGORY_MUTATION,
$callbackUrl
);
$notificationFilterUrlUser = new NotificationFilterUrlUser($allUpdatedNotificationFilter);
$notificationFilterUrlUser -> create($allUpdatedNotificationFilter);
}
STEP 2. (THE BUG):
in bunq\sdk_php\Model\Core\BunqModel.php
at line: 361
Change:
$value = static::createListFromResponseArray($response, $wrapper);
Into:
$value = static::createListFromResponseArray($response[0], $wrapper);
First, It is Solved. It is FOR SURE a bug with SDK and the BunqLib in Tinker and Examples.
The basic flow is: Tinker::addCallbackUrl => BunqLib::addCallbackUrl => UserPerson::getNotificationFilters => Add new notification filters to the current filter list => UserPerson::update().
But this is wrong in several places:
at BunqLib::addCallbackUrl is using "new NotificationFilter()" to generate a new NotificationFilter Object. This is incorrect because the SDK is asking for the NotificationFilterUrlUser / NotificationFilterMonataryAccount;
at BunqLib::addCallbackUrl is using UserPerson::update() to set the new NotificationFiler. This is incorrect because: a. the parameters are mismatched; b. the update is no longer taking NotificationFilter as a parameter and it is not going to update the filters;
The Solution: STEP 1. replace BunqLib::addCallbackUrl with:
STEP 2. (THE BUG): in
bunq\sdk_php\Model\Core\BunqModel.php
at line: 361 Change:$value = static::createListFromResponseArray($response, $wrapper);
Into:$value = static::createListFromResponseArray($response[0], $wrapper);
Because the returned response is like:
There is one more dimension of the response array.
It is tested in both SANDBOX and PRODUCTION environments.