public async Task <ActionResult> GetLandedCost([FromBody] RatesForm form)
        {
            var req = new SilicoLandedCostRequest(_config.Value);

            //This is all going to have less values hardcoded and should probably be moved somewhere else.

            req.LandedCostRequest.Request.RequestAction = "LandedCost";

            //Product
            req.LandedCostRequest.EstimateRequest.Shipment.Product.TariffCode = "8416.90.00.00";
            req.LandedCostRequest.EstimateRequest.Shipment.Product.ProductCountryCodeOfOrigin = "BE";

            req.LandedCostRequest.EstimateRequest.Shipment.Product.Quantity.Value = "5";

            req.LandedCostRequest.EstimateRequest.Shipment.Product.Weight.Value = "2";
            req.LandedCostRequest.EstimateRequest.Shipment.Product.Weight.UnitOfMeasure.UnitCode = "KG";
            req.LandedCostRequest.EstimateRequest.Shipment.Product.UnitPrice.MonetaryValue       = "5.5";
            req.LandedCostRequest.EstimateRequest.Shipment.Product.UnitPrice.CurrencyCode        = "LTL";

            req.LandedCostRequest.EstimateRequest.Shipment.Product.Question.Name   = "UOM_REQUIRED_X";
            req.LandedCostRequest.EstimateRequest.Shipment.Product.Question.Answer = "3";

            req.LandedCostRequest.EstimateRequest.TransactionDigest = "...udXBzLnhvbHQudGEubGMuTENSZXN1bHQOqA+6xY5G9QIAFkQAB2ZyZ....";



            var res = await _apiService.MakeLandedCostRequest(req);


            return(Ok(res));
        }
Esempio n. 2
0
        public async Task <RateResponse> MakeLandedCostRequest(SilicoLandedCostRequest req)
        {
            var settings = new JsonSerializerSettings
            {
                NullValueHandling     = NullValueHandling.Ignore,
                MissingMemberHandling = MissingMemberHandling.Ignore
            };


            var json = JsonConvert.SerializeObject(req);

            var response = await _httpClient.PostAsync("LandedCost", new StringContent(json, Encoding.UTF8, "application/json"));

            if (!response.IsSuccessStatusCode)
            {
            }

            var one = await response.Content.ReadAsStringAsync();

            var responseData = JsonConvert.DeserializeObject <RootRatedResponse>(await response.Content.ReadAsStringAsync(), settings).RateResponse;


            return(responseData);
        }