Example #1
0
        public SendTrackNotificationResult SendTrackNotification(OrderTrackingInformation orderTrackingInformation)
        {
            OrderTrackingInfoAdapter adaptee = new OrderTrackingInfoAdapter();

            using (var client = new HttpClient())
            {
                /*
                 * Autenticacao pode ser feita aqui
                 */
                var url = ServiceConfiguration.GetConfigurations()
                          .Configuration
                          .GetConfiguration()
                          .ApiUrl;

                HttpResponseMessage response = null;
                try
                {
                    response = client.PostAsync(url, new JsonContent(adaptee.Adapt(orderTrackingInformation))).Result;
                }
                catch (Exception ex)
                {
                    return(new SendTrackNotificationResult(response));
                }

                return(new SendTrackNotificationResult(response));
            }
        }