public GetMyFeesEstimateResponse InvokeGetMyFeesEstimate(string ASIN) { try { GetMyFeesEstimateRequest request = new GetMyFeesEstimateRequest(); request.SellerId = sellerId; request.MWSAuthToken = "example"; FeesEstimateRequestList feesEstimateRequestList = new FeesEstimateRequestList(); feesEstimateRequestList.FeesEstimateRequest.Add(new FeesEstimateRequest { MarketplaceId = marketplaceID, IdType = "ASIN", IdValue = ASIN, PriceToEstimateFees = new PriceToEstimateFees { ListingPrice = new MoneyType { Amount = 0M, CurrencyCode = "USD" } }, Identifier = "request_" + Guid.NewGuid().ToString(), IsAmazonFulfilled = true }); request.FeesEstimateRequestList = feesEstimateRequestList; return(_productClient.GetMyFeesEstimate(request)); } catch (Exception ex) { return(null); } }
public GetMyFeesEstimateResponse InvokeGetMyFeesEstimate() { // Create a request. GetMyFeesEstimateRequest request = new GetMyFeesEstimateRequest(); FeesEstimateRequestList list = new FeesEstimateRequestList(); MoneyType price = new MoneyType() { Amount = 100m, CurrencyCode = "USD" }; MoneyType ship = new MoneyType() { Amount = 10m, CurrencyCode = "USD" }; PriceToEstimateFees priceToEstimateFees = new PriceToEstimateFees() { ListingPrice = price, Shipping = ship }; list.FeesEstimateRequest.Add(new FeesEstimateRequest() { Identifier = "123", IdType = "ASIN", IdValue = "B01LWB4SVH", IsAmazonFulfilled = true, MarketplaceId = marketplaceId, PriceToEstimateFees = priceToEstimateFees }); request.FeesEstimateRequestList = list; request.SellerId = sellerId; request.MWSAuthToken = mwsAuthToken; return(this.client.GetMyFeesEstimate(request)); }
public GetMyFeesEstimateResponse InvokeGetMyFeesEstimate() { // Create a request. GetMyFeesEstimateRequest request = new GetMyFeesEstimateRequest(); string sellerId = "example"; request.SellerId = sellerId; string mwsAuthToken = "example"; request.MWSAuthToken = mwsAuthToken; FeesEstimateRequestList feesEstimateRequestList = new FeesEstimateRequestList(); request.FeesEstimateRequestList = feesEstimateRequestList; return(this.client.GetMyFeesEstimate(request)); }
public GetMyFeesEstimateResponse InvokeGetMyFeesEstimate(string sellerId, string mwsAuthToken, out APIResults results) { try { // Create a request. GetMyFeesEstimateRequest request = new GetMyFeesEstimateRequest(); request.SellerId = sellerId; request.MWSAuthToken = mwsAuthToken; FeesEstimateRequestList feesEstimateRequestList = new FeesEstimateRequestList(); request.FeesEstimateRequestList = feesEstimateRequestList; GetMyFeesEstimateResponse output = this.productClient.GetMyFeesEstimate(request); results = new APIResults((IMWSResponse)output); return(output); } catch (MarketplaceWebServiceProductsException ex) { results = new APIResults(ex); throw ex; } }
public GetMyFeesEstimateResponse InvokeGetMyFeesEstimate() { // Create a request. GetMyFeesEstimateRequest request = new GetMyFeesEstimateRequest(); string sellerId = ""; request.SellerId = sellerId; string mwsAuthToken = "example"; request.MWSAuthToken = mwsAuthToken; FeesEstimateRequestList feesEstimateRequestList = new FeesEstimateRequestList { FeesEstimateRequest = new List <FeesEstimateRequest>() { new FeesEstimateRequest() { MarketplaceId = "ATVPDKIKX0DER", IdType = "ASIN", IdValue = "B016W63ZYS", IsAmazonFulfilled = false, Identifier = "request1", PriceToEstimateFees = new PriceToEstimateFees() { ListingPrice = new MoneyType() { Amount = 12.99M, CurrencyCode = "USD", }, } } } }; request.FeesEstimateRequestList = feesEstimateRequestList; return(this.client.GetMyFeesEstimate(request)); }
public GetMyFeesEstimateResponse GetMyFeesEstimate(GetMyFeesEstimateRequest request) { return(newResponse <GetMyFeesEstimateResponse>()); }
public GetMyFeesEstimateResponse GetMyFeesEstimate(GetMyFeesEstimateRequest request) { return(connection.Call( new MarketplaceWebServiceProductsClient.Request <GetMyFeesEstimateResponse>("GetMyFeesEstimate", typeof(GetMyFeesEstimateResponse), servicePath), request)); }
public GetMyFeesEstimateResponse InvokeGetMyFeesEstimate() { // Create a request. GetMyFeesEstimateRequest request = new GetMyFeesEstimateRequest(); FeesEstimateRequestList list = new FeesEstimateRequestList(); list.FeesEstimateRequest.Add(new FeesEstimateRequest() { )
/// <summary> /// Returns the estimated fees for the item indicated by the specified Asin in /// the marketplace specified in the request body. /// /// You can call getMyFeesEstimateForASIN for an item on behalf of a selling /// partner before the selling partner sets the item's price. They can then /// take estimated fees into account. With each product fees request, you must /// include an original identifier. This identifier is included in the fees /// estimate so you can correlate a fees estimate with the original request. /// /// **Note:** This value is only an estimate, actual costs may vary. Search /// "fees" in [Seller Central](https://sellercentral.amazon.com/) and consult /// the store-specific fee schedule for the most up-to-date information. /// /// **Usage Plans:** /// /// | Plan type | Rate (requests per second) | Burst | /// | ---- | ---- | ---- | /// |Default| 10 | 20 | /// |Selling partner specific| Variable | Variable | /// /// The x-amzn-RateLimit-Limit response header returns the usage plan rate /// limits that were applied to the requested operation. Rate limits for some /// selling partners will vary from the default rate and burst shown in the /// table above. For more information, see "Usage Plans and Rate Limits" in the /// Selling Partner API documentation. /// </summary> /// <param name='body'> /// </param> /// <param name='asin'> /// The Amazon Standard Identification Number (ASIN) of the item. /// </param> /// <param name='customHeaders'> /// Headers that will be added to request. /// </param> /// <param name='cancellationToken'> /// The cancellation token. /// </param> /// <exception cref="HttpOperationException"> /// Thrown when the operation returned an invalid status code /// </exception> /// <exception cref="SerializationException"> /// Thrown when unable to deserialize the response /// </exception> /// <exception cref="ValidationException"> /// Thrown when a required parameter is null /// </exception> /// <exception cref="System.ArgumentNullException"> /// Thrown when a required parameter is null /// </exception> /// <return> /// A response object containing the response body and response headers. /// </return> public async Task <HttpOperationResponse <GetMyFeesEstimateResponse, GetMyFeesEstimateForASINHeaders> > GetMyFeesEstimateForASINWithHttpMessagesAsync(GetMyFeesEstimateRequest body, string asin, Dictionary <string, List <string> > customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (body == null) { throw new ValidationException(ValidationRules.CannotBeNull, "body"); } if (body != null) { body.Validate(); } if (asin == null) { throw new ValidationException(ValidationRules.CannotBeNull, "asin"); } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary <string, object> tracingParameters = new Dictionary <string, object>(); tracingParameters.Add("body", body); tracingParameters.Add("asin", asin); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "GetMyFeesEstimateForASIN", tracingParameters); } // Construct URL var _baseUrl = BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "products/fees/v0/items/{Asin}/feesEstimate").ToString(); _url = _url.Replace("{Asin}", System.Uri.EscapeDataString(asin)); // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; _httpRequest.Method = new HttpMethod("POST"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (customHeaders != null) { foreach (var _header in customHeaders) { if (_httpRequest.Headers.Contains(_header.Key)) { _httpRequest.Headers.Remove(_header.Key); } _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } // Serialize Request string _requestContent = null; if (body != null) { _requestContent = SafeJsonConvert.SerializeObject(body, SerializationSettings); _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); _httpRequest.Content.Headers.ContentType = System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); } // Send Request if (_shouldTrace) { ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); await IL.Library.Amazon.SPAPI.SharedRuntime.SPAPIInterceptor.PrepareRequest(amazonUserKeyPair, _httpRequest, _configuration, _tokenManagement); _httpResponse = await HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; if ((int)_statusCode != 200 && (int)_statusCode != 400 && (int)_statusCode != 401 && (int)_statusCode != 403 && (int)_statusCode != 404 && (int)_statusCode != 429 && (int)_statusCode != 500 && (int)_statusCode != 503) { var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); if (_httpResponse.Content != null) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); } else { _responseContent = string.Empty; } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw ex; } // Create Result var _result = new HttpOperationResponse <GetMyFeesEstimateResponse, GetMyFeesEstimateForASINHeaders>(); _result.Request = _httpRequest; _result.Response = _httpResponse; // Deserialize Response if ((int)_statusCode == 200) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { _result.Body = SafeJsonConvert.DeserializeObject <GetMyFeesEstimateResponse>(_responseContent, DeserializationSettings); await IL.Library.Amazon.SPAPI.SharedRuntime.SPAPIInterceptor.PrepareResponse <GetMyFeesEstimateResponse>((int)_statusCode, _result.Body, _httpResponse); } catch (JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); } } // Deserialize Response if ((int)_statusCode == 400) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { _result.Body = SafeJsonConvert.DeserializeObject <GetMyFeesEstimateResponse>(_responseContent, DeserializationSettings); await IL.Library.Amazon.SPAPI.SharedRuntime.SPAPIInterceptor.PrepareResponse <GetMyFeesEstimateResponse>((int)_statusCode, _result.Body, _httpResponse); } catch (JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); } } // Deserialize Response if ((int)_statusCode == 401) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { _result.Body = SafeJsonConvert.DeserializeObject <GetMyFeesEstimateResponse>(_responseContent, DeserializationSettings); await IL.Library.Amazon.SPAPI.SharedRuntime.SPAPIInterceptor.PrepareResponse <GetMyFeesEstimateResponse>((int)_statusCode, _result.Body, _httpResponse); } catch (JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); } } // Deserialize Response if ((int)_statusCode == 403) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { _result.Body = SafeJsonConvert.DeserializeObject <GetMyFeesEstimateResponse>(_responseContent, DeserializationSettings); await IL.Library.Amazon.SPAPI.SharedRuntime.SPAPIInterceptor.PrepareResponse <GetMyFeesEstimateResponse>((int)_statusCode, _result.Body, _httpResponse); } catch (JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); } } // Deserialize Response if ((int)_statusCode == 404) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { _result.Body = SafeJsonConvert.DeserializeObject <GetMyFeesEstimateResponse>(_responseContent, DeserializationSettings); await IL.Library.Amazon.SPAPI.SharedRuntime.SPAPIInterceptor.PrepareResponse <GetMyFeesEstimateResponse>((int)_statusCode, _result.Body, _httpResponse); } catch (JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); } } // Deserialize Response if ((int)_statusCode == 429) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { _result.Body = SafeJsonConvert.DeserializeObject <GetMyFeesEstimateResponse>(_responseContent, DeserializationSettings); await IL.Library.Amazon.SPAPI.SharedRuntime.SPAPIInterceptor.PrepareResponse <GetMyFeesEstimateResponse>((int)_statusCode, _result.Body, _httpResponse); } catch (JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); } } // Deserialize Response if ((int)_statusCode == 500) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { _result.Body = SafeJsonConvert.DeserializeObject <GetMyFeesEstimateResponse>(_responseContent, DeserializationSettings); await IL.Library.Amazon.SPAPI.SharedRuntime.SPAPIInterceptor.PrepareResponse <GetMyFeesEstimateResponse>((int)_statusCode, _result.Body, _httpResponse); } catch (JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); } } // Deserialize Response if ((int)_statusCode == 503) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { _result.Body = SafeJsonConvert.DeserializeObject <GetMyFeesEstimateResponse>(_responseContent, DeserializationSettings); await IL.Library.Amazon.SPAPI.SharedRuntime.SPAPIInterceptor.PrepareResponse <GetMyFeesEstimateResponse>((int)_statusCode, _result.Body, _httpResponse); } catch (JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); } } try { _result.Headers = _httpResponse.GetHeadersAsJson().ToObject <GetMyFeesEstimateForASINHeaders>(JsonSerializer.Create(DeserializationSettings)); } catch (JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } throw new SerializationException("Unable to deserialize the headers.", _httpResponse.GetHeadersAsJson().ToString(), ex); } if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); } return(_result); }
/// <summary> /// Returns the estimated fees for the item indicated by the specified seller /// SKU in the marketplace specified in the request body. /// /// You can call getMyFeesEstimateForSKU for an item on behalf of a selling /// partner before the selling partner sets the item's price. They can then /// take estimated fees into account. With each fees estimate request, you must /// include an original identifier. This identifier is included in the fees /// estimate so you can correlate a fees estimate with the original request. /// /// **Note:** This value is only an estimate, actual costs may vary. Search /// "fees" in [Seller Central](https://sellercentral.amazon.com/) and consult /// the store-specific fee schedule for the most up-to-date information. /// /// **Usage Plans:** /// /// | Plan type | Rate (requests per second) | Burst | /// | ---- | ---- | ---- | /// |Default| 10 | 20 | /// |Selling partner specific| Variable | Variable | /// /// The x-amzn-RateLimit-Limit response header returns the usage plan rate /// limits that were applied to the requested operation. Rate limits for some /// selling partners will vary from the default rate and burst shown in the /// table above. For more information, see "Usage Plans and Rate Limits" in the /// Selling Partner API documentation. /// </summary> /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='body'> /// </param> /// <param name='sellerSKU'> /// Used to identify an item in the given marketplace. SellerSKU is qualified /// by the seller's SellerId, which is included with every operation that you /// submit. /// </param> /// <param name='cancellationToken'> /// The cancellation token. /// </param> public static async Task <GetMyFeesEstimateResponse> GetMyFeesEstimateForSKUAsync(this IProductFeesClient operations, GetMyFeesEstimateRequest body, string sellerSKU, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.GetMyFeesEstimateForSKUWithHttpMessagesAsync(body, sellerSKU, null, cancellationToken).ConfigureAwait(false)) { return(_result.Body); } }
/// <summary> /// Returns the estimated fees for the item indicated by the specified seller /// SKU in the marketplace specified in the request body. /// /// You can call getMyFeesEstimateForSKU for an item on behalf of a selling /// partner before the selling partner sets the item's price. They can then /// take estimated fees into account. With each fees estimate request, you must /// include an original identifier. This identifier is included in the fees /// estimate so you can correlate a fees estimate with the original request. /// /// **Note:** This value is only an estimate, actual costs may vary. Search /// "fees" in [Seller Central](https://sellercentral.amazon.com/) and consult /// the store-specific fee schedule for the most up-to-date information. /// /// **Usage Plans:** /// /// | Plan type | Rate (requests per second) | Burst | /// | ---- | ---- | ---- | /// |Default| 10 | 20 | /// |Selling partner specific| Variable | Variable | /// /// The x-amzn-RateLimit-Limit response header returns the usage plan rate /// limits that were applied to the requested operation. Rate limits for some /// selling partners will vary from the default rate and burst shown in the /// table above. For more information, see "Usage Plans and Rate Limits" in the /// Selling Partner API documentation. /// </summary> /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='body'> /// </param> /// <param name='sellerSKU'> /// Used to identify an item in the given marketplace. SellerSKU is qualified /// by the seller's SellerId, which is included with every operation that you /// submit. /// </param> public static GetMyFeesEstimateResponse GetMyFeesEstimateForSKU(this IProductFeesClient operations, GetMyFeesEstimateRequest body, string sellerSKU) { return(operations.GetMyFeesEstimateForSKUAsync(body, sellerSKU).GetAwaiter().GetResult()); }
/// <summary> /// Returns the estimated fees for the item indicated by the specified Asin in /// the marketplace specified in the request body. /// /// You can call getMyFeesEstimateForASIN for an item on behalf of a selling /// partner before the selling partner sets the item's price. They can then /// take estimated fees into account. With each product fees request, you must /// include an original identifier. This identifier is included in the fees /// estimate so you can correlate a fees estimate with the original request. /// /// **Note:** This value is only an estimate, actual costs may vary. Search /// "fees" in [Seller Central](https://sellercentral.amazon.com/) and consult /// the store-specific fee schedule for the most up-to-date information. /// /// **Usage Plans:** /// /// | Plan type | Rate (requests per second) | Burst | /// | ---- | ---- | ---- | /// |Default| 10 | 20 | /// |Selling partner specific| Variable | Variable | /// /// The x-amzn-RateLimit-Limit response header returns the usage plan rate /// limits that were applied to the requested operation. Rate limits for some /// selling partners will vary from the default rate and burst shown in the /// table above. For more information, see "Usage Plans and Rate Limits" in the /// Selling Partner API documentation. /// </summary> /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='body'> /// </param> /// <param name='asin'> /// The Amazon Standard Identification Number (ASIN) of the item. /// </param> public static GetMyFeesEstimateResponse GetMyFeesEstimateForASIN(this IProductFeesClient operations, GetMyFeesEstimateRequest body, string asin) { return(operations.GetMyFeesEstimateForASINAsync(body, asin).GetAwaiter().GetResult()); }