Example #1
0
        static void PrintTracking(TrackingIntNac tracking)
        {
            if (tracking.Data.ShippingNac?.Cantidad > 0)
            {
                var pais = tracking.Data.ShippingNac.Eventos.Where(x => !string.IsNullOrEmpty(x.NombrePais)).FirstOrDefault();
                WriteLineColor(ConsoleColor.White, $"\nOrigen: {pais.NombrePais}");
            }

            WriteLineColor(ConsoleColor.White, $"Tracking inter: {tracking.Data.Id}");

            // Tracking nacional
            if (tracking.Data.Id != tracking.Data.ItemIdLocal)
            {
                WriteLineColor(ConsoleColor.White, $"Tracking local: {tracking.Data.ItemIdLocal}");
                WriteLineColor(ConsoleColor.White, $"\nGestion Correo Argentino: {tracking.Data.GestionCorreo}");
                WriteLineColor(ConsoleColor.White, $"Gestion AFIP: {tracking.Data.ProcesoAfip}");

                var entrega = tracking.Data.ShippingNac.Eventos.Where(x => x.EstadoEntrega == "ENTREGADO").FirstOrDefault();
                if (entrega != null)
                {
                    WriteLineColor(ConsoleColor.Green, $"Estado: {entrega.EstadoEntrega} - {entrega.MotivoNoEntrega}");
                }
            }

            WriteLineColor(ConsoleColor.White, "\nEstado internacional:");
            foreach (var evento in tracking.Data.Eventos)
            {
                WriteColor(ConsoleColor.DarkGray, $"[{evento.HoraEventoAr}][{evento.Destino}] ");
                WriteColor(ConsoleColor.White, $"{evento.EventoAr,-40}\t");
                WriteColor(ConsoleColor.Cyan, $"{evento.OficinaAr,-40}\n");
            }

            if (tracking.Data.ShippingNac?.Cantidad > 0)
            {
                WriteLineColor(ConsoleColor.White, "\nEstado nacional:");
                foreach (var evento in tracking.Data.ShippingNac.Eventos)
                {
                    WriteColor(ConsoleColor.DarkGray, $"[{evento.FechaEvento}] ");
                    WriteColor(ConsoleColor.White, $"{evento.CodigoEvento,-50}\t");
                    WriteColor(ConsoleColor.Cyan, $"{evento.Planta,-40}\n");
                }
            }
        }
Example #2
0
        static void RetrieveTracking(string tracking)
        {
            using WebClient wc = new WebClient();
            string url = "https://api.correoargentino.com.ar/backendappcorreo/api/api/shipping-tracking-int-nac?id_shipping=" + tracking;

            Console.WriteLine("Obteniendo informacion del tracking...");
            string json = wc.DownloadString(url);

            TrackingIntNac intNac = TrackingIntNac.FromJson(json);

            if (intNac.Rta == "OK")
            {
                PrintTracking(intNac);
            }
            else
            {
                WriteLineColor(ConsoleColor.Red, "Error: " + json);
            }
        }