Skip to content

[SOLUTION] SDK is outdated the BunqLib causing Tinker (and examples) Errors in addCallbackUrl #46

Open
@McSloverd

Description

@McSloverd

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:

  1. 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;

  2. 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);

Because the returned response is like:

     Array(1) => 
           Array(1) => 
                Array(5)
                     "NotificationFilters" => 
                     ....

There is one more dimension of the response array.

It is tested in both SANDBOX and PRODUCTION environments.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions