Hey Guys,
I’m working on a library for the bunq API on NodeJS but there’s something weird going on with the response validation.
It seems to work fine for the simpler response formats but for the more complex ones it seems to count them as invalid.
Currently I’ve got the following two scenarios:
- Device server request with the simple Id parameter as the response. The data which will be validated looks as follows:
200\n
X-Bunq-Client-Request-Id: 1\n
X-Bunq-Client-Response-Id: 88e42470-3791-4f6a-99bb-2c1f4df9729e\n
\n
{
"Response": [
{
"Id": {
"id": 17509
}
}
]
}
This works.
- The session-server request is made with a more complicated response. The data which will be validated looks as follows:
200\n
X-Bunq-Client-Request-Id: 2\n
X-Bunq-Client-Response-Id: e34b0611-35ba-4f4b-bc93-6eb98953519e\n
\n
{
"Response": [
{
"Id": {
"id": 209774
}
},
{
"Token": {
"id": 209774,
"created": "2018-12-02 12:07:51.374916",
"updated": "2018-12-02 12:07:51.374916",
"token": "48e9ff4b4580bfd40d2352fbef9e005868556df47f34fed004dd5e19372ca92e"
}
},
{
"UserPerson": {
"id": 6458,
"created": "2018-12-01 21:39:04.146337",
"updated": "2018-12-01 21:39:14.523394",
"alias": [
{
"type": "PHONE_NUMBER",
"value": "+31649277874",
"name": "+31649277874"
},
{
"type": "EMAIL",
"value": "yvonne.cadieux@bunq.bar",
"name": "yvonne.cadieux@bunq.bar"
}
],
"avatar": {
"uuid": "c7833be8-6254-4732-94f6-905571675b44",
"image": [
{
"attachment_public_uuid": "ddf892cd-95f2-4936-a456-c23f51ab985b",
"height": 126,
"width": 200,
"content_type": "image/jpeg"
}
],
"anchor_uuid": "9a821958-cc94-4771-9f9d-263da6c33008"
},
"status": "ACTIVE",
"sub_status": "NONE",
"public_uuid": "9a821958-cc94-4771-9f9d-263da6c33008",
"display_name": "Cadieux",
"public_nick_name": "Yvonne",
"language": "en_US",
"region": "nl_NL",
"session_timeout": 604800,
"daily_limit_without_confirmation_login": {
"currency": "EUR",
"value": "25.00"
},
"notification_filters": [],
"address_main": {
"street": "Montagu Place",
"house_number": "969",
"postal_code": "2492 FH",
"city": "Winsum",
"country": "NL",
"province": null
},
"address_postal": {
"street": "Montagu Place",
"house_number": "969",
"postal_code": "2492 FH",
"city": "Winsum",
"country": "NL",
"province": null
},
"first_name": "Yvonne",
"middle_name": "",
"last_name": "Cadieux",
"legal_name": "Yvonne Cadieux",
"tax_resident": null,
"date_of_birth": "1983-03-11",
"place_of_birth": "Amsterdam",
"country_of_birth": "NL",
"nationality": "NL",
"gender": "FEMALE",
"version_terms_of_service": "1.0",
"document_number": null,
"document_type": null,
"document_country_of_issuance": null,
"document_front_attachment": null,
"document_back_attachment": null,
"flarum_username": null,
"customer": {
"id": 5060,
"created": "2018-12-01 21:39:04.201571",
"updated": "2018-12-01 21:39:04.201571",
"billing_account_id": 9638,
"invoice_notification_preference": "NONE"
},
"customer_limit": {
"limit_monetary_account": 25,
"limit_card_debit_maestro": 1,
"limit_card_debit_mastercard": 2,
"limit_card_debit_wildcard": 3,
"limit_card_debit_replacement": 1
},
"billing_contract": [
{
"BillingContractSubscription": {
"id": 25195,
"created": "2018-12-01 21:39:04.188137",
"updated": "2018-12-01 21:39:04.188137",
"contract_date_start": "2018-12-01",
"contract_date_end": null,
"contract_version": 1,
"subscription_type": "PERSON_PREMIUM_V1",
"status": "ACTIVE",
"sub_status": "NONE"
}
}
],
"pack_membership": null
}
}
]
}
(Bodies pretty printed, in reality there are no newlines in the JSON and only spaces in the values where they are specified above) Which doesn’t work.
- I’ve also tried not validating the login flow and validating a test response from the monetary-account endpoint which also didn’t work.
The body part of the data to sign is passed directly from the request to the validation function and parsed to a string with JSON.stringify().
Any of you have a clue what might be going wrong here?