beardon / mws-api

Amazon Marketplace Web Services client for Node.js.
79 stars 55 forks source link

Support Products.GetMyFeesEstimate #72

Open colinskow opened 7 years ago

colinskow commented 7 years ago

I would like to be able to use this library to estimate fees for a given list of ASIN numbers. http://docs.developer.amazonservices.com/en_US/products/Products_GetMyFeesEstimate.html

This should be simple, except that the request parameters are a list of objects, and I'm not sure if that is supported.

dobesv commented 7 years ago

I monkeypatched it in there like this:

require('../node_modules/mws-api/lib/sections/products.js').requests.GetMyFeesEstimate = {
  params: {
    MarketplaceId: {name:'FeesEstimateRequestList.FeesEstimateRequest.1.MarketplaceId', required:true},
    IdType: {name:'FeesEstimateRequestList.FeesEstimateRequest.1.IdType', required:true},
    IdValue: {name:'FeesEstimateRequestList.FeesEstimateRequest.1.IdValue', required:true},
    IsAmazonFulfilled: {name:'FeesEstimateRequestList.FeesEstimateRequest.1.IsAmazonFulfilled', required:true},
    Identifier: {name:'FeesEstimateRequestList.FeesEstimateRequest.1.Identifier', required:true},
    CurrencyCode: {name:'FeesEstimateRequestList.FeesEstimateRequest.1.PriceToEstimateFees.ListingPrice.CurrencyCode', required:true},
    PriceToEstimateFees: {name:'FeesEstimateRequestList.FeesEstimateRequest.1.PriceToEstimateFees.ListingPrice.Amount', required:true},
  },
  data: 'FeesEstimateResultList.FeesEstimateResult.FeesEstimate'
};

HOWEVER, the response doesn't start with <?xml so it gets parsed as CSV, which is a problem that I have temporarily solved by editing the XML check in client.js