public async Task <HttpResponseMessage> Calculate(Address customer, Address supplier, OrderDetail order)
        {
            var values = new Dictionary <string, string>()
            {
                //origin
                { "from_country", supplier.Country },
                { "from_zip", supplier.Zip.ToString() },
                { "from_state", supplier.State },
                { "from_city", supplier.City },
                { "from_street", supplier.Street },
                //destination
                { "to_country", customer.Country },
                { "to_zip", customer.Zip.ToString() },
                { "to_state", customer.State },
                { "to_city", customer.City },
                { "to_street", customer.Street },
                //order
                { "amount", order.Amount.ToString() },
                { "shipping", order.Shipping.ToString() },
                { "customer_id", order.CustomerId },
                { "exemption_type", order.ExemptionType }
            }.Where(pair => pair.Value != null);


            var content = new FormUrlEncodedContent(values);

            //HttpResponseMessage response = new HttpResponseMessage();


            var response = await _client.PostAsync(_urlTaxForOrder, content);


            return(response);
        }
Пример #2
0
        public async Task <HttpResponseMessage> Calculate(Address customer, Address supplier, OrderDetail order)
        {
            var result = await _calculator.Calculate(customer, supplier, order);

            return(result);
        }