Ejemplo n.º 1
0
 private async Task SendMercadoLivreMessage(Shipment shipment, string message)
 {
     var orderId   = Int64.Parse(shipment.MarketplaceData.SaleId);
     var accountId = Int64.Parse(shipment.MarketplaceData.AccountId);
     var req       = new GrpcSendMessageReq()
     {
         AccountId = accountId, OrderId = orderId, MessageText = message
     };
     await MercadoLivreClient.SendMessage(req);
 }
        private async Task <GrpcShipmentDetail> GetBoundryShipmentDetails()
        {
            var request = new GrpcGetShipmentDetailReq()
            {
                AccountId = AccountId, ShipmentId = ShipmentId
            };
            var shipmentDetails = await MercadoLivreClient.GetShipmentDetail(request);

            return(shipmentDetails);
        }
        private async Task <GrpcOrder> GetSaleDetails(long accountId, long orderId)
        {
            var request = new GrpcGetOrderDetailReq()
            {
                AccountId = accountId,
                OrderId   = orderId
            };

            return(await MercadoLivreClient.GetOrderDetail(request));
        }
Ejemplo n.º 4
0
 private static void InitializeRoutines()
 {
     try
     {
         MercadoLivreClient.Initialize();
         RoutineScheduler.Initialize();
     }
     catch (Exception e)
     {
         throw e;
     }
 }
Ejemplo n.º 5
0
 private static async Task RunInitializationRoutine()
 {
     try
     {
         InitializeDatabase();
         ViewClient.Initialize();
         ShippingClient.Initialize();
         MercadoLivreClient.Initialize();
         SaleClient.Initialize();
     }
     catch (Exception e)
     {
         HandleInitializationFailure(e);
     }
 }
 public async Task ProcessAuthCodeExchange(string code, string metadata = null)
 {
     try
     {
         var request = new AddAccountReq()
         {
             AuthCode = code
         };
         var grpcRequest = AddAccountReqAdapter.AdaptToGrpc(request);
         await MercadoLivreClient.AddAccount(grpcRequest);
     }
     catch (Exception)
     {
         throw;
     }
 }
        public async Task <IActionResult> GetAppId()
        {
            try
            {
                var grpcStringResp = await MercadoLivreClient.GetAppId();

                return(new ContentResult()
                {
                    Content = grpcStringResp.Data,
                    ContentType = "application/json",
                    StatusCode = 200
                });
            }
            catch (Exception)
            {
                throw;
            }
        }
        public async Task <IActionResult> SearchAccounts(SearchAccountsReq request)
        {
            try
            {
                var grpcRequest  = SearchAccountsReqAdapter.AdaptToGrpc(request);
                var grpcResponse = await MercadoLivreClient.SearchAccounts(grpcRequest);

                return(new ContentResult()
                {
                    Content = GrpcAccountListAdapter.AdaptSerialized(grpcResponse),
                    ContentType = "application/json",
                    StatusCode = 200
                });
            }
            catch (Exception)
            {
                throw;
            }
        }
        public async Task <IActionResult> GetAccountByMarketplaceId(long id)
        {
            try
            {
                var grpcReq = new GrpcGetByIdReq()
                {
                    Id = id.ToString()
                };
                var grpcResp = await MercadoLivreClient.GetAccountByMarketplaceId(grpcReq);

                var json = JsonSerializer.Serialize(grpcResp);
                return(new ContentResult()
                {
                    ContentType = "application/json",
                    Content = json,
                    StatusCode = 200
                });
            }
            catch (Exception)
            {
                throw;
            }
        }