mollie / mollie/mollie-api-python
Values requested via the embed parameter are not easy accessible in the response objects
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 127
- Forks
- 53
- PR merge metrics
- No merged PRs in 30d
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.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with ResourceBase.extract_embed and the orders resource, then compare how Payment and Order response objects handle the API's _embedded object. The work is complete when requested embeds are represented consistently as None or mapped resource lists, including chargebacks and refunds, for absent, empty, and populated responses.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- api, backend
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100