python-amazon-sp-api icon indicating copy to clipboard operation
python-amazon-sp-api copied to clipboard

Implement bulk call for ProductFees

Open dtilchin opened this issue 3 years ago • 0 comments

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:

  1. There are a few issues with the sandbox for the product fee calls. The first is that OptionalFulfillmentProgram cannot be null, 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.
  2. product_fees.py should be named test_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.

dtilchin avatar Aug 11 '22 18:08 dtilchin