-
Notifications
You must be signed in to change notification settings - Fork 56
Values requested via the embed parameter are not easy accessible in the response objects #256
Description
Issue:
The response when adding the embed parameter for e.g. the payments resource will not lead to a response with the embedded values in the Payment object.
There is a static method in ResourceBase called extract_embed, however only used in the orders resource. Currently I'm not using the orders resource but don't see what the functionality of it is. It splits the input provided for the embed parameter and then adds it to the response. It doesn't seem to be doing anything with the _embedded object that will be returned by the mollie API, but maybe I'm overseeing something.
Expected behaviour:
I would expect an embedded value on e.g. the Payment ( or Order ) object representing the resources added through the embed parameter. For this embedded value I would expect the following values:
embedparameter not set in the request to the mollie API- If no embed parameters were set,
embeddedwould be None. So in the response it can be checked if anything was embedded when calling the mollie API.
- If no embed parameters were set,
embed= 'chargebacks' but there are no chargebacksembedded= { 'chargeback': None }, for the similar reason as above, so we can check if the chargeback was actually added to the request or not. The Mollie API simply leaves the full _embedded object out if e.g. you make a request with the parameter embed='chargebacks' but there are no chargebacks. This makes it difficult in the response to determine if the embed='chargebacks' was added to the request or if the embed was not set at all. By setting the embed parameters to None if there there were no entires of that resource we can easily see if there were none of that resource, or we didn't provide it in the embed parameter in the request to the mollie API.
embed= 'chargebacks' and there are chargebacks:embedded= { 'chargeback': List(Chargeback)}
With similar behaviour for refunds as chargebacks, or if both are included in the embed parameter.