python-amazon-sp-api
python-amazon-sp-api copied to clipboard
Implement bulk call for ProductFees
This call, POST /products/fees/v0/feesEstimate, is unique among all other implemented calls in that its request and response bodies are arrays (of objects) at the top level; everything else has an object. This wouldn't work as parts of Client assume that the request is a dictionary, hence the addition of wrap_lists. This isn't perfect, as unfortunately Client actually treats data as both the request body and metadata about the request, such as HTTP method. There may be a better solution that doesn't involve massive refactoring, but this is a fairly small change and does work for this use case.
A couple notes on the tests:
- There are a few issues with the sandbox for the product fee calls. The first is that
OptionalFulfillmentProgramcannot benull, failing validation; the production endpoint has no problem with this. The second is that the sandbox for this newly implemented call appears to be broken, in that it does not accept the dummy request body as given in the spec. product_fees.pyshould be namedtest_product_fees.py. The current name means test discovery, for example in the CI, does not see it.
Because of note 1, I decided not to fix note 2. Currently the tests will fail anyway, including the ones that weren't touched by this commit. I waffled about this for a while and figured it's ok that they are skipped, as the sandbox appears to be misbehaving.