Open timvisee opened 4 years ago
Seems related to #177, though it was marked as fixed.
You can wrap this in a try/catch block as temporary workaround (in PHP 7+). The callback URLs are set on the server, just the response is faulty.
I do not recommend this approach in a production environment, because this will ignore real errors as well. But yes, this works:
try {
NotificationFilterUrlMonetaryAccount::create($id, $filters);
} catch(\Error $e) {}
Have a look at the readme, it says:
Note! Due to an in internal change in the way we handle NotificationFilters (Callbacks), you should not use the default classes included in this SDK. Please make sure you make use of the associated Internal-classes. For example when you need NotificationFilterUrlUser, make use of NotificationFilterUrlUserInternal. You can use every method of these classes, except for the create() method. Always use createWithListResponse() instead.
So it works as long as you use NotificationFilterUrlMonetaryAccountInternal::createWithListResponse() instead of NotificationFilterUrlMonetaryAccount::create() because createWithListResponse() does have the correct return type.
Thanks a bunch for mentioning this! This different approach using these internal objects does work fine indeed.
But I think it's weird the regular endpoint object doesn't work, even if you'd consider this to be because of 'compatibility purposes', because the actual implementation is broken. Therefore I'll leave this open.
NotificationFilterUrlMonetaryAccountInternal::createWithListResponse returns an empty result set as does NotificationFilterUrlMonetaryAccountInternal::listing: ...... 'notificationFilters' => NULL, 'notificationFiltersFieldForRequest' => NULL,
createWithListResponse does create the notification correctly but I cannot check if it has been made using sdk_php.
I am able to check using the direct api https://public-api.sandbox.bunq.com/v1/user/xxxxxx/monetary-account/xxxxxx/notification-filter-url or production equivalent.
Seems to get to Guzzle ok but the response is wrong!
Ugh, is this still not fixed? I am unable to see my notifications or callbacks whatever bunq calls them. It would be convenient to offer a way to manage these "webhooks" through a web interface, like Wise, Mollie, Stripe etc does.
@hurnell how did you create a call to this direct API? Because I need to see if I created a notification or not :P
It appears there's an API specification and server response inconsistency.
The API specification clearly states that
NotificationFilterUrlMonetaryAccount::create
should respond with anId
object. Instead, the server responds with a list ofNotificationFilterUrl
objects.Steps to reproduce:
$id
.What should happen:
What happens:
Id
is not found. See 'Extra info'.Traceback
SDK version and environment
Extra info:
Here is a prettified JSON response, that is received from the server when invoking the
create
function:This clearly shows the API responds with
NotificationFilterUrl
objects, and not anId
object.Providing a different number of filters doesn't improve things.
It is not clear to me what the response
Id
should represent.I see two possible solutions for this:
Id
object, as shown in the specification.