Esempio n. 1
0
        private async Task <bool> GetIsOrderRegistered(OrderDetailJson order)
        {
            var req = new gRPC.Client.ShippingClientProto.GrpcString()
            {
                Value = order.id.ToString()
            };
            var resp = await ShippingClient.GetIsMarketplaceSaleIdRegistered(req);

            return(resp.Value);
        }
Esempio n. 2
0
 public static GrpcOrder Present(OrderDetailJson json)
 {
     return(new GrpcOrder()
     {
         Id = json.id,
         ShippingId = json.shipping.id,
         ShippingStatus = json.shipping.substatus,
         Status = json.status,
         TotalAmount = json.total_amount,
         PackId = json.pack_id ?? default(long)
     });
 }
Esempio n. 3
0
        private async Task CreateShipment(OrderDetailJson order)
        {
            var isOrderRegistered = await GetIsOrderRegistered(order);

            var shipmentDetails = await GetShipmentDetails(order);

            var trackingCode = shipmentDetails.tracking_number;

            if (!isOrderRegistered && trackingCode != null)
            {
                var req = new gRPC.Client.ShippingClientProto.GrpcNewShipmentRequest()
                {
                    MarketplaceAccountId   = Account.MercadoLivreId.ToString(),
                    TrackingCode           = trackingCode,
                    SetAutoUpdate          = true,
                    BoundMarketplace       = "mercado livre",
                    MarketplaceSaleId      = order.id.ToString(),
                    PackageData            = new gRPC.Client.ShippingClientProto.GrpcNewPackageRequest(),
                    SetCreatedManually     = false,
                    ShippingImplementation = GetShippingImplementation(shipmentDetails)
                };
                await ShippingClient.CreateShipment(req);
            }
        }
Esempio n. 4
0
 private long?GetPackId(OrderDetailJson details)
 {
     return(details.pack_id);
 }
Esempio n. 5
0
 private async Task SetOrder(long id) =>
 Order = await OrderUseCases.GetDetails.Execute(Account.MercadoLivreId, id);
Esempio n. 6
0
 private async Task HanldeOrder(OrderDetailJson order)
 {
     await CreateShipment(order);
 }
Esempio n. 7
0
 private async Task <ShipmentJson> GetShipmentDetails(OrderDetailJson order)
 {
     return(await ShipmentUseCases.GetDetails.Execute(Account.MercadoLivreId, order.shipping.id));
 }