ScaleLeap / amazon-mws-api-sdk

A fully typed TypeScript and Node.js Amazon MWS API Unofficial SDK
https://npm.im/@scaleleap/amazon-mws-api-sdk
MIT License
20 stars 12 forks source link

[Bug] listInventorySupply is not supporting SellerSkus #368

Closed danielbebbernovacode closed 3 years ago

danielbebbernovacode commented 3 years ago

Hello,

While I was using the listInventorySupply API call I noticed that it is not possible to use the SellerSkus parameter. I always get an error as response: `

Sender InvalidRequestException One of SellerSkus and QueryStartDateTime is required 41763488-209b-4ea9-bbf7-2c136983c908

`

Since you noted it as "SellerSku" inside the example (which would not match the Amazon API docu) I also tried it with SellerSku but had the same result. Seems like there is a bug there.

Best Regards, Daniel

moltar commented 3 years ago

Yes, the example was wrong. But the implementation was correct.

It is SellerSkus: string[]

github-actions[bot] commented 3 years ago

:tada: This issue has been resolved in version 1.9.50 :tada:

The release is available on:

Your semantic-release bot :package::rocket:

danielbebbernovacode commented 3 years ago

Also tried it with SellerSkus same result.

`

Sender
<Code>InvalidRequestException</Code>
<Message>One of SellerSkus and QueryStartDateTime is required</Message>

`

moltar commented 3 years ago

Hopefully, #372 fixes it! Please test the next release (should be shortly after merge).

github-actions[bot] commented 3 years ago

:tada: This issue has been resolved in version 1.9.51 :tada:

The release is available on:

Your semantic-release bot :package::rocket:

danielbebbernovacode commented 3 years ago

The issue still persists. It seems like SellerSkus is totally ignored.

I tested to provide SellerSkus and QueryStartDateTime (which should result into an error) but it worked. Only providing SellerSkus still results in the same rror.

danielbebbernovacode commented 3 years ago

@moltar could you have a look at this issue again?

moltar commented 3 years ago

@danielbebbernovacode please provide your request example

danielbebbernovacode commented 3 years ago

Query:

const main = async () => {

  const parameters = {
    MarketplaceId: amazonMarketplaces.DE.id,
    SellerSkus: ["QA-D58Q-SVCD"]
  };

  const [
    listInventorySupply,
    requestMeta
  ] = await fulfillmentInventory.listInventorySupply(parameters);

  console.log(listInventorySupply);

Response:

<ErrorResponse xmlns="http://mws.amazonaws.com/FulfillmentInventory/2010-10-01/">
  <Error>
    <Type>Sender</Type>
    <Code>InvalidRequestException</Code>
    <Message>One of SellerSkus and QueryStartDateTime is required</Message>
  </Error>
  <RequestId>b8929c12-bd2e-4cac-b3d7-e4fbf7b1f4e9</RequestId>
</ErrorResponse>
moltar commented 3 years ago

I'm making a request from the examples, and I am seeing the following HTTP request:

GET /FulfillmentInventory/2010-10-01?AWSAccessKeyId=&Action=ListInventorySupply&MWSAuthToken=&MarketplaceId=ATVPDKIKX0DER&SellerId=&SellersSkus.member.1=SKU123&SellersSkus.member.2=SKU456&Signature=...&SignatureMethod=HmacSHA256&SignatureVersion=2&Timestamp=2021-05-11T08%3A56%3A26.664Z&Version=2010-10-01

Which is almost exactly the same as the one in the example:

https://mws.amazonservices.com/FulfillmentInventory/2010-10-01
  ?Action=ListInventorySupply
  &Version=2011-03-01
  &AWSAccessKeyId=AKIAJGUEXAMPLEE2NVUA
  &MWSAuthToken=amzn.mws.4ea38b7b-f563-7709-4bae-87aeaEXAMPLE
  &SignatureVersion=2
  &SignatureMethod=HmacSHA256
  &Signature=ZRA9DR5rveSuz%2F1D18AHvoipg2BAev8yblPQ1BbEbfU%3D
  &Timestamp=2010-10-01T02:40:36Z
  &SellerId=A2NKEXAMPLEF53
  &SellerSkus.member.1=SampleSKU1
  &SellerSkus.member.2=SampleSKU2
  &ResponseGroup=Basic

The only difference I see is that their example has a SellerId, but it is not documented. Never mind that, this was just because it was not set in the config. Once set it is correctly set in the request too.


Can you do a successful request in a scratchpad, and then share the HTTP request?

Scratchpad URL: https://mws.amazonservices.ca/scratchpad/index.html

danielbebbernovacode commented 3 years ago
POST /FulfillmentInventory/2010-10-01?AWSAccessKeyId=ACESSKEY
  &Action=ListInventorySupply
  &SellerId=SELLERID
  &MWSAuthToken=AUTHTOKEN
  &SignatureVersion=2
  &Timestamp=2021-05-11T09%3A07%3A22Z
  &Version=2010-10-01
  &Signature=SIGNATURE
  &SignatureMethod=HmacSHA256
  &SellerSkus.member.1=QA-D58Q-SVCD HTTP/1.1

Host: mws.amazonservices.de
x-amazon-user-agent: AmazonJavascriptScratchpad/1.0 (Language=Javascript)
Content-Type: text/xml

I also get a correct response in scratchpad:

<ListInventorySupplyResponse xmlns="http://mws.amazonaws.com/FulfillmentInventory/2010-10-01/">
  <ListInventorySupplyResult>
    <MarketplaceId>A1PA6795UKMFR9</MarketplaceId>
    <InventorySupplyList>
      <member>
        <Condition>NewItem</Condition>
        <SupplyDetail/>
        <TotalSupplyQuantity>448</TotalSupplyQuantity>
        <EarliestAvailability>
          <TimepointType>Immediately</TimepointType>
        </EarliestAvailability>
        <FNSKU>X00147VYVF</FNSKU>
        <InStockSupplyQuantity>448</InStockSupplyQuantity>
        <ASIN>B07YF3YX9X</ASIN>
        <SellerSKU>QA-D58Q-SVCD</SellerSKU>
      </member>
    </InventorySupplyList>
  </ListInventorySupplyResult>
  <ResponseMetadata>
    <RequestId>12879177-a9ee-430b-9022-6655f35a2b40</RequestId>
  </ResponseMetadata>
</ListInventorySupplyResponse>
moltar commented 3 years ago

Yeah, I found the bug for sure this time. I tested and the call works locally. Wait for the release shortly.

moltar commented 3 years ago

https://github.com/ScaleLeap/amazon-mws-api-sdk/pull/384/files#diff-c8cc4c9b141195cc7c3eba573cb181ef4e73e044ccef1f86cf0684195cf3a8f5L93

github-actions[bot] commented 3 years ago

:tada: This issue has been resolved in version 1.9.55 :tada:

The release is available on:

Your semantic-release bot :package::rocket:

danielbebbernovacode commented 3 years ago

Working fine! Thank you for fixing this issue so fast :)