Skip to content

Unexpected response field from Bunq API: "id" => "Id" #31

Description

@holtkamp

It seems Bunq has updated its API.

The documentation at https://doc.bunq.com/api/1/call/session-server/method/post

Suggests to return:

{

    "Response": [
        {
            "Id": {
                "id": 49
            }
        }
    ]
}

But it seems to return (note the casing of "id" => "Id":

{

    "Response": [
        {
            "Id": {
                "Id": 49
            }
        }
    ]
}

Since fetching the value is hard-coded to "id", this results in an error like:

Uncaught TypeError: Argument 1 passed to Link0\Bunq\Domain\Id::fromInteger() must be of the type integer, null given, called in /app/vendor/link0/bunq/src/Client.php on line 141 and defined in /app/vendor/link0/bunq/src/Domain/Id.php:27
Stack trace:
#0 /app/vendor/link0/bunq/src/Client.php(141): Link0\Bunq\Domain\Id::fromInteger(NULL)
#1 /app/vendor/link0/bunq/src/Client.php(120): Link0\Bunq\Client->mapResponse('Id', Array)
#2 /app/vendor/link0/bunq/src/Client.php(78): Link0\Bunq\Client->processResponse(Object(GuzzleHttp\Psr7\Response))
#3 /app/vendor/link0/bunq/src/Service/InstallationService.php(74): Link0\Bunq\Client->post('session-server', Array, Array)

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