Ejemplo n.º 1
0
        public CustomerServiceModel.Cost GetCost(ShippingModel shipping)
        {
            CustomerServiceModel.Cost costResponse   = new CustomerServiceModel.Cost();
            viewLiquidacion           preLiquidacion = new viewLiquidacion();


            double VL  = shipping.content.Measures.Sum(c => c.VolumetricWeight);
            double VLW = shipping.content.Measures.Sum(c => c.Weight);

            try
            {
                var result = client.GetPreLiquidacion(ref eEncabezado, 2739, (decimal)shipping.content.Value, shipping.content.Quantity, (decimal)VLW, (decimal)VL, shipping.origin.Location.CityCode, shipping.receiver.Location.CityCode, ref preLiquidacion);

                costResponse.MainCost     = (float)preLiquidacion.valorFlete;
                costResponse.VariableCost = (float)preLiquidacion.costoManejo;
                costResponse.TotalCost    = (float)preLiquidacion.TotalFlete;
            }
            catch (Exception e)
            {
                costResponse.error.HasError = true;
                costResponse.error.Message  = e.Message;
            }


            return(costResponse);
        }
Ejemplo n.º 2
0
        private ShippingModel GetPdfGuide(ShippingModel shipping)
        {
            string[] codigorem = new string[1];
            codigorem[0] = shipping.guide.Code;
            Agw_imprimirRotulosIn rotulo = new Agw_imprimirRotulosIn();

            rotulo.clave              = PWD;
            rotulo.id_rotulo          = "44";
            rotulo.usuario            = "mekagroup.ws";
            rotulo.codigos_remisiones = codigorem;

            try
            {
                //Thread.Sleep(1000);
                var response = ServiceGuiaManagement.Guias_imprimirRotulos(rotulo);
                if (response.error)
                {
                    shipping.error.HasError = true;
                    shipping.error.Message  = "GetPdfGuide: " + response.errorMessage;

                    return(shipping);
                }
                shipping.guide.PdfGuide = response.rotulos;
            }
            catch (Exception e)
            {
                shipping.error.HasError = true;
                shipping.error.Message  = "GetPdfGuide: " + e.Message;
            }

            return(shipping);
        }
Ejemplo n.º 3
0
        public ActionResult Checkout(ShippingModel entity)
        {
            var cart = GetCart();

            if (cart.GetCartLines.Count() == 0)
            {
                ModelState.AddModelError("NoProductError", "There are no products in your cart.");
            }

            if (ModelState.IsValid)
            {
                //siparişi veritabanına kayıt et
                //cart ı sıfırla

                SaveOrder(cart, entity);
                cart.Clear();
                return(View("Completed"));
            }
            else
            {
                return(View(entity));
            }



            return(View());
        }
Ejemplo n.º 4
0
        private void SaveOrder(Cart cart, ShippingModel entity)
        {
            var order = new Order();

            order.OrderNumber = "A" + (new Random()).Next(11111, 99999).ToString();
            order.Total       = cart.TotalPrice();
            order.OrderDate   = DateTime.Now;
            order.OrderState  = EnumOrderState.Waiting;
            order.Username    = User.Identity.Name;

            order.AddressTitle = entity.AddressTitle;
            order.Address      = entity.Address;
            order.City         = entity.City;
            order.District     = entity.District;
            order.Neighborhood = entity.Neighborhood;
            order.PostCode     = entity.PostCode;

            order.OrderLines = new List <OrderLine>();

            foreach (var pr in cart.GetCartLines)
            {
                var orderline = new OrderLine();

                orderline.Quantity  = pr.Quantity;
                orderline.Price     = pr.Quantity * pr.Product.Price;
                orderline.ProductId = pr.Product.Id;

                order.OrderLines.Add(orderline);
            }

            db.Orders.Add(order);
            db.SaveChanges();
        }
Ejemplo n.º 5
0
        public IHttpActionResult PaymentTest(string value)
        {
            try
            {
                var shipping = new ShippingModel();
                shipping.payment = new ShippingModel.Payment()
                {
                    PaymentMethod = "cash"
                };
                shipping.payment.Cost = new ShippingModel.Cost()
                {
                    TotalCost = Int32.Parse(value)
                };
                var data = _paymentService.RequestPayment(shipping);
                if (data.error.HasError)
                {
                    string service = shipping.payment.PaymentMethod == "pos" ? CubiQManagerModel.KioskoService.POSTERMINALSERVICE : CubiQManagerModel.KioskoService.CASHSERVICE;
                    _cubiqManagerService.PostLogService(service, false, data.error.Message);
                    data.error.Message = "Hubo un error al realizar el pago. Por favor intente nuevamente.";
                }

                var response = new
                {
                    data
                };
                return(Ok(response));
            }
            catch (Exception e)
            {
                return(NotFound());
            }
        }
Ejemplo n.º 6
0
        public ShippingModel PrintRemesa(List <FacturaModel> ord, ShippingModel shipping, PdfPrinterSettings sett)
        {
            try
            {
                shipping.error.HasError = false;
                using (var pdfViewer = new DevExpress.XtraPdfViewer.PdfViewer())
                {
                    PageSettings sets = sett.Settings.DefaultPageSettings;
                    XtraReport   rem  = new RemesaTCC();
                    rem.DataSource            = ord;
                    rem.PrinterName           = "kioskobillprint";
                    rem.ShowPrintStatusDialog = false;
                    rem.PaperKind             = System.Drawing.Printing.PaperKind.Custom;
                    string path = @"C:\Kiosko\temp\invoice\" + shipping.guide.Code + ".pdf";
                    rem.CreateDocument(false);
                    rem.ExportToPdf(path);
                    rem.ExportToPdf(path);
                    pdfViewer.LoadDocument(path);
                    PaperSize paperSize = new PaperSize("Print", (int)(800 / 2.94), (int)(rem.PageHeight / 2.94));
                    paperSize.RawKind = (int)PaperKind.Custom;
                    sets.PaperSize    = paperSize;
                    pdfViewer.ShowPrintStatusDialog = false;
                    pdfViewer.Print(sett);
                    pdfViewer.CloseDocument();
                }
            }catch (SystemException E)
            {
                shipping.error.HasError = true;
                shipping.error.Message  = E.Message;

                return(shipping);
            }
            return(shipping);
        }
Ejemplo n.º 7
0
        public IActionResult Shipping()
        {
            var model = new ShippingModel();

            if (User.Identity.IsAuthenticated)
            {
                var user = userManager.Users.FirstOrDefault(x => x.UserName == User.Identity.Name || x.Email == User.Identity.Name);
                model.CustomerName   = user.Name;
                model.PhoneNumber    = user.PhoneNumber;
                model.Email          = user.Email;
                model.UserId         = user.Id;
                model.City           = user.City;
                model.Street         = user.Street;
                model.Building       = user.Building;
                model.FlatNumber     = user.FlatNumber;
                model.AvailableMoney = user.AvailableMoney;
            }
            else
            {
                model.AvailableMoney = 5000;
            }
            var cartItems   = cart.GetCartItems();
            var productList = unitOfWork.Repository <Product>().Query().AsNoTracking().Where(x => cartItems.Any(item => item.ProductId == x.Id)).ToList();
            var sum         = 0m;

            foreach (var cartItem in cartItems)
            {
                var product = productList.FirstOrDefault(x => x.Id == cartItem.ProductId);
                sum += cartItem.Count * product.Price;
            }
            model.PriceTotal = sum;
            return(View(model));
        }
Ejemplo n.º 8
0
        public CubiQManagerModel.CubiQManagerResponse PostShippingData(ShippingModel _shipping)
        {
            var    shipping = MapShippingData(_shipping);
            string resource = CubiQManagerModel.KioskoResource.SAVEKIOSKOSHIPPING;
            var    response = Helpers.Utilities.doRequest <CubiQManagerModel.CubiQManagerResponse>(CubiQManagerModel.Resource.URL, resource, shipping, "POST");

            return(response);
        }
Ejemplo n.º 9
0
        public void RequestPaymentTest()
        {
            ShippingModel     shipping = GenerateShipping();
            PaymentController pcl      = new PaymentController();

            shipping = pcl.RequestPayment(shipping);
            ShippingModel.Payment py = shipping.payment;
        }
Ejemplo n.º 10
0
        private static Alegra MapShippingData(ShippingModel shipping)
        {
            Alegra            mapped = new Alegra();
            List <Alegra.Tax> taxes  = new List <Alegra.Tax>();

            taxes.Add(new Alegra.Tax()
            {
                id = 1
            });

            List <Alegra.Payment> payment = new List <Alegra.Payment>();

            payment.Add(new Alegra.Payment()
            {
                amount        = Convert.ToInt32(shipping.payment.Cost.TotalCost),
                date          = Utilities.GetDate(),
                paymentMethod = "cash",
                account       = new Alegra.Account()
                {
                    id = 3
                }
            });

            List <Alegra.Item> items = new List <Alegra.Item>();

            Alegra.Item item = new Alegra.Item()
            {
                description = "Envio por kiosko",
                discount    = 0,
                price       = Convert.ToInt32(shipping.payment.Cost.TotalCost),
                quantity    = 1,
                tax         = taxes,
                id          = 45
            };
            items.Add(item);


            mapped.date         = Utilities.GetDate();
            mapped.dueDate      = Utilities.GetDate();
            mapped.observations = "Factura generada por kiosko";
            mapped.anotation    = shipping.code;
            mapped.status       = "open";
            mapped.client       = new Alegra.Client()
            {
                id = 128
            };
            mapped.numberTemplate = new Alegra.NumberTemplate()
            {
                id = 1
            };

            mapped.items    = items;
            mapped.payments = payment;

            return(mapped);
        }
Ejemplo n.º 11
0
        public AlegraResult CreateInvoice(ShippingModel _shipping)
        {
            var    shipping = MapShippingData(_shipping);
            string url      = "https://app.alegra.com";
            string resource = "/api/v1/invoices";
            string base64   = Utilities.Base64Encode("[email protected]:26227c0b2a984dfb01a7");
            var    response = Kiosko.Helpers.Utilities.doRequest <AlegraResult>(url, resource, shipping, "POST", 5000, base64);

            return(response);
        }
Ejemplo n.º 12
0
        public ShippingModel GenerateGuide(ShippingModel shipping)
        {
            CustomerServiceModel.Guide guideResponse = new CustomerServiceModel.Guide();
            EFacturaKiosco             fact          = new EFacturaKiosco();

            fact.Cantidad         = shipping.content.Measures.Count;
            fact.CelularDestino   = shipping.receiver.Phone;
            fact.Contenido        = shipping.content.Description;
            fact.DireccionCliente = shipping.receiver.Location.Address;
            fact.DireccionDestino = shipping.origin.Location.Address;
            fact.FormaPago        = "CONTADO";
            fact.IdCuentaCliente  = 2739;
            fact.IdDestino        = shipping.receiver.Location.CityCode;
            fact.Identificacion   = shipping.receiver.Identification;
            fact.IdOrigen         = shipping.origin.Location.CityCode;
            fact.Kilos            = (float)shipping.content.Measures.Sum(item => item.Weight);
            fact.KilosXvolumen    = (int)shipping.content.Measures.Sum(item => item.VolumetricWeight);
            fact.NombreCliente    = shipping.origin.Name;
            fact.NombreDestino    = shipping.receiver.Name;
            fact.Obs             = "Guia generada por kiosko";
            fact.Referencia      = "";
            fact.TelefonoCliente = shipping.origin.Phone;
            fact.TelefonoDestino = shipping.receiver.Phone;
            fact.ValorDeclarado  = (int)shipping.content.Value;

            string factid = "254546";



            EError Er = client.RegistrarFactura(ref eEncabezado, ref fact);

            factid = fact.IdFactura;



            shipping.guide.Code = fact.IdFactura;


            EFacturaKioscoDetalle efactura = new EFacturaKioscoDetalle();


            string Etiqueta = client.ConsultaEtiquetaPdf(ref eEncabezado, factid);


            EError err2 = client.ConsultarFactura(ref eEncabezado, factid, ref efactura);



            shipping.guide.PdfGuide = Etiqueta;
            shipping.guide.Code     = factid;
            // shipping.guide.Id = factid;
            this.GenerateInvoice(shipping, efactura);

            return(shipping);
        }
Ejemplo n.º 13
0
 public IHttpActionResult GenerateGuide([FromBody] ShippingModel shipping)
 {
     try
     {
         return(Ok(_service.GenerateGuide(shipping)));
     }
     catch (Exception e)
     {
         return(NotFound());
     }
 }
Ejemplo n.º 14
0
 public IHttpActionResult GetCost([FromBody] ShippingModel shipping)
 {
     try
     {
         return Ok(_service.GetCost(shipping));
     }
     catch (Exception e)
     {
         return NotFound();
     }
 }
Ejemplo n.º 15
0
        public async Task <IActionResult> Index(
            string fname,
            string lname,
            string address,
            string state,
            string city,
            int zip,
            string creditcardnumber,
            string creditcardname,
            string creditcardverificationvalue,
            string expirationmonth,
            string expirationyear,
            ShippingModel model)
        {
            ViewData["States"] = new string[] { "Alabama", "Alaska",
                                                "Arkansas", "Illinois" };

            if (ModelState.IsValid)
            {
                string cartId;
                Guid   cartCode;
                if (Request.Cookies.TryGetValue("cartId", out cartId) && Guid.TryParse(cartId, out cartCode) && _context.Carts.Any(x => x.CartCode == cartCode))
                {
                    var cart = _context.Carts.Include(x => x.CartsProducts).ThenInclude(y => y.Product).Single(x => x.CartCode == cartCode);
                    //return View(cart);


                    //var cart = _context.Carts.Include(x => x.CartsProducts).ThenInclude(y => y.Product).Single(x => x.CartCode == cartCode);
                    Braintree.TransactionRequest saleRequest = new Braintree.TransactionRequest();
                    saleRequest.Amount     = cart.CartsProducts.Sum(x => x.Quantity * (x.Product.Price ?? 0));
                    saleRequest.CreditCard = new Braintree.TransactionCreditCardRequest
                    {
                        CardholderName  = creditcardname,
                        CVV             = creditcardverificationvalue,
                        ExpirationMonth = expirationmonth,
                        ExpirationYear  = expirationyear,
                        Number          = creditcardnumber
                    };
                    var result = await _braintreeGateway.Transaction.SaleAsync(saleRequest);

                    if (result.IsSuccess())
                    {
                        //If model state is valid, proceed to the next step.
                        return(RedirectToAction("Index", "Home"));
                    }
                    foreach (var error in result.Errors.All())
                    {
                        ModelState.AddModelError(error.Code.ToString(), error.Message);
                    }
                }
            }
            return(View());
        }
Ejemplo n.º 16
0
 public IActionResult Ship(ShippingModel model)
 {
     _logger.LogInformation("Start calling Ship method");
     // your logic here
     if (model.Address.Contains("China"))
     {
         _logger.LogError("Something wrong with Ship method");
         return(BadRequest());
     }
     _logger.LogInformation("End calling Ship method");
     return(Ok());
 }
Ejemplo n.º 17
0
 public static int UpdateRule(SqlDbHelper dbhelper, ShippingModel model)
 {
     using (var cmd = new SqlCommand(@"UPDATE  Configuration.[dbo].[tbl_DeliveryFee] SET Types=@Types,Value=@Value, UserType = @UserType WHERE  PKID=@PKID"))
     {
         cmd.CommandType = CommandType.Text;
         cmd.Parameters.AddWithValue("@Types", model.Types);
         cmd.Parameters.AddWithValue("@Value", model.Value);
         cmd.Parameters.AddWithValue("@UserType", model.UserType);
         cmd.Parameters.AddWithValue("@PKID", model.PKID);
         return(dbhelper.ExecuteNonQuery(cmd));
     }
 }
Ejemplo n.º 18
0
 public IHttpActionResult PostShipping([FromBody] ShippingModel shipping)
 {
     try
     {
         var data = _cubiqManagerService.PostShippingData(shipping);
         return(Ok(data));
     }
     catch (Exception e)
     {
         return(NotFound());
     }
 }
Ejemplo n.º 19
0
        private void button_shipping_Click(object sender, RibbonControlEventArgs e)
        {
            Workbook  wb        = (Workbook)Globals.ThisAddIn.Application.ActiveWorkbook;
            Worksheet worksheet = wb.ActiveSheet;

            //Check
            if (!"Số tờ khai".Equals(worksheet.Range["C4"].Value2) || !worksheet.Range["E2"].Value2.Contains("Tờ khai"))
            {
                MessageBox.Show("Hãy mở tờ khai để tạo shipping");
                return;
            }
            ShippingModel ship = new ShippingModel();
            string        a;

            a                = worksheet.Range["F8"].Value2;
            ship.date        = a.Substring(0, 10);
            a                = worksheet.Range["I46"].Value2;
            ship.shipment    = a.Substring(3, 3) + a.Substring(0, 3) + a.Substring(6, 4);
            a                = worksheet.Range["L6"].Value2;
            ship.transport   = "BY " + (("" + a[a.Length - 1]).Equals("3") || ("" + a[a.Length - 1]).Equals("2") ? "SEA" : ("" + a[a.Length - 1]).Equals("4") ? "TRUCK" : ("" + a[a.Length - 1]).Equals("1") ? "AIR" : "OTHER");
            ship.destination = worksheet.Range["M43"].Value2;
            ship.portload    = worksheet.Range["M44"].Value2;
            ship.voyage      = worksheet.Range["M45"].Value2;
            ship.comodity    = "AS PER INVOICE NO: " + worksheet.Range["R49"].Value2;
            ship.amount      = worksheet.Range["U53"].Value2;

            ship.total = worksheet.Range["H40"].Value2;
            if (!"CT".Equals(worksheet.Range["M40"].Value2))
            {
                a = worksheet.Range["H47"].Value2;
                if (a.LastIndexOf("=") < a.LastIndexOf(")") && a.LastIndexOf("C") < a.LastIndexOf("T") && a.LastIndexOf("=") < a.LastIndexOf("C") && a.LastIndexOf("T") < a.LastIndexOf(")"))
                {
                    ship.total = a.Substring(a.LastIndexOf("=") + 1, a.LastIndexOf("C") - a.LastIndexOf("=") - 1);
                }
            }

            ship.gross = worksheet.Range["H41"].Value2;

            if (checkBox_xuatRieng.Checked)
            {
                ship.filename  = @"SUNZEX_SHIPING." + worksheet.Range["R49"].Value2.Replace("/", "");
                ship.sheetname = worksheet.Range["R49"].Value2.Replace("/", "");
            }
            else
            {
                a = ship.comodity.Substring(ship.comodity.IndexOf(@":") + 6, 2) + "." + ship.comodity.Substring(ship.comodity.IndexOf(@":") + 8, 3);
                ship.sheetname = a.Replace("/", "");

                ship.filename = @"SUNZEX_SHIPING." + ship.date.Substring(6, 4) + ".T" + ship.date.Substring(3, 2);
            }

            Copy_shipping_work_sheet(ship);
        }
Ejemplo n.º 20
0
        private int ReturnUnidadDeNegocio(ShippingModel shipping)
        {
            int unidad = 1;

            if (shipping.content.Measures.Sum(t => t.Weight) <= 5 && shipping.content.Measures.Sum(t => t.VolumetricWeight) <= 5)
            {
                return(unidad = 2);
            }
            else
            {
                return(unidad);
            }
        }
Ejemplo n.º 21
0
        public AlegraResult CreateDummyInvoice(ShippingModel _shipping)
        {
            AlegraResult alegra = new AlegraResult();

            alegra.client                 = new AlegraResult.Client();
            alegra.client.address         = new AlegraResult.Address();
            alegra.client.address.address = _shipping.origin.Location.Address;
            alegra.client.address.city    = _shipping.origin.Location.City;
            alegra.client.email           = _shipping.origin.Email;
            alegra.numberTemplate         = new AlegraResult.NumberTemplate();
            alegra.numberTemplate.number  = "1242323";
            return(alegra);
        }
        public Result <ShippingModel> GetShippingMethods(GetShippingArgs getShippingArgs)
        {
            var model  = new ShippingModel();
            var result = new Result <ShippingModel>();

            try
            {
                result.SetResult(model);
                var currentCart = this.CartManager.GetCurrentCart(
                    this.StorefrontContext.ShopName,
                    this.VisitorContext.ContactId);
                if (!currentCart.ServiceProviderResult.Success)
                {
                    result.SetErrors(currentCart.ServiceProviderResult);
                    return(result);
                }

                var         shippingOptionType = ConnectOptionTypeHelper.ToShippingOptionType(getShippingArgs.ShippingPreferenceType);
                PartyEntity address            = null;
                if (getShippingArgs.ShippingAddress != null)
                {
                    address = this.EntityMapper.MapToPartyEntity(getShippingArgs.ShippingAddress);
                }

                var shippingMethods = this.ShippingManager.GetShippingMethods(
                    this.StorefrontContext.ShopName,
                    currentCart.Result,
                    shippingOptionType,
                    address,
                    null);
                if (!currentCart.ServiceProviderResult.Success)
                {
                    result.SetErrors(currentCart.ServiceProviderResult);
                    return(result);
                }

                result.Data.ShippingMethods = new List <ShippingMethodModel>();
                foreach (var shippingMethod in shippingMethods.ServiceProviderResult.ShippingMethods)
                {
                    var shippingModel = this.EntityMapper.MapToShippingMethodModel(shippingMethod);
                    result.Data.ShippingMethods.Add(shippingModel);
                }
            }
            catch (Exception ex)
            {
                Log.Error(ex.Message, ex, this);
                result.SetErrors(nameof(this.GetShippingMethods), ex);
            }

            return(result);
        }
Ejemplo n.º 23
0
        private static CubiQManagerShippingModel MapShippingData(ShippingModel _shipping)
        {
            CubiQManagerShippingModel mapped = new CubiQManagerShippingModel();

            mapped.shipping = new CubiQManagerShippingDataModel()
            {
                code                           = _shipping.guide.Code,
                declared_value                 = _shipping.content.Value,
                shipping_type                  = _shipping.shippingType.KeyName,
                content                        = _shipping.content.Description,
                origin_name                    = _shipping.origin.Name,
                origin_id                      = _shipping.origin.Identification,
                origin_phone                   = _shipping.origin.Phone,
                origin_email                   = _shipping.origin.Email,
                origin_address                 = _shipping.origin.Location.Address,
                origin_city_name               = _shipping.origin.Location.City,
                origin_department_name         = _shipping.origin.Location.Department,
                receiver_id                    = _shipping.receiver.Identification,
                receiver_name                  = _shipping.receiver.Name,
                receiver_address               = _shipping.receiver.Location.Address,
                receiver_city_name             = _shipping.receiver.Location.City,
                receiver_department_name       = _shipping.receiver.Location.Department,
                receiver_phone                 = _shipping.receiver.Phone,
                initial_date                   = _shipping.tracking.InitialDate,
                final_date                     = Helpers.Utilities.GetDate(),
                authorization_transaction_code = _shipping.payment.AuthorizationTransactionCode,
                payment_method                 = _shipping.payment.PaymentMethod,
                total_payment                  = _shipping.payment.Cost.TotalCost,
                vat_number                     = _shipping.payment.Invoice,
                kiosko_pid                     = Helpers.Utilities.GetMachinePid()
            };

            mapped.measures = new List <CubiQManagerShippingMeasuresModel>();

            foreach (var dimension in _shipping.content.Measures)
            {
                mapped.measures.Add(
                    new CubiQManagerShippingMeasuresModel()
                {
                    height  = dimension.Height,
                    length  = dimension.Length,
                    weight  = dimension.Weight,
                    width   = dimension.Width,
                    image64 = dimension.ImageBase64
                }
                    );
            }

            return(mapped);
        }
Ejemplo n.º 24
0
        public CustomerServiceModel.Cost GetCost(ShippingModel shipping)
        {
            ServiceCotizadorManagement = new RpcServerSoapManagerService();
            ServiceGuiaManagement      = new JRpcServerSoapManagerService();
            List <Cotizador_detalleEmpaques> empaque = new List <Cotizador_detalleEmpaques>();

            CustomerServiceModel.Cost costResponse = new CustomerServiceModel.Cost();

            Cotizador_cotizarIn CotizarIn = new Cotizador_cotizarIn
            {
                apikey         = APIKEY,
                clave          = Cont,
                cuenta         = "1",
                nit            = "",
                origen         = Origen,
                producto       = "0",
                nivel_servicio = new int[0],
                valoracion     = shipping.content.Value.ToString().Replace(".", "").Replace(",", ""),
                destino        = shipping.receiver.Location.CityCode,
            };

            foreach (var measure in shipping.content.Measures)
            {
                empaque.Add(new Cotizador_detalleEmpaques()
                {
                    alto     = measure.Height.ToString(),
                    ancho    = measure.Width.ToString(),
                    largo    = measure.Length.ToString(),
                    peso     = measure.Weight.ToString(),
                    ubl      = "0",
                    unidades = "1"
                });
            }

            CotizarIn.detalle = empaque.ToArray();
            try
            {
                var request = ServiceCotizadorManagement.Cotizador_cotizar(CotizarIn);
                costResponse.MainCost     = request.flete_fijo;
                costResponse.VariableCost = request.flete_variable;
                costResponse.TotalCost    = request.flete_total;
            }
            catch (Exception e)
            {
                costResponse.error.HasError = true;
                costResponse.error.Message  = e.Message;
            }

            return(costResponse);
        }
Ejemplo n.º 25
0
        public ShippingModel RequestPayment(ShippingModel shipping)
        {
            switch (shipping.payment.PaymentMethod)
            {
            case "pos":
                shipping = HandlePosPayment(shipping);
                break;

            case "cash":
                shipping = HandleCashPayment(shipping);
                break;
            }

            return(shipping);
        }
Ejemplo n.º 26
0
        //public CustomerServiceModel.Guide ConsultarFactura(ShippingModel shipping)
        //{



        //}


        public CustomerServiceModel.Guide GenerateGuide(ShippingModel shipping)
        {
            CustomerServiceModel.Guide   guideResponse = new CustomerServiceModel.Guide();
            BluWebService.EFacturaKiosco fact          = new BluWebService.EFacturaKiosco();
            fact.Cantidad         = shipping.content.Measures.Count;
            fact.CelularDestino   = shipping.receiver.Phone;
            fact.Contenido        = shipping.content.Description;
            fact.DireccionCliente = shipping.receiver.Location.Address;
            fact.DireccionDestino = shipping.origin.Location.Address;
            fact.FormaPago        = "CONTADO";
            fact.IdCuentaCliente  = 2739;
            fact.IdDestino        = shipping.receiver.Location.CityCode;
            fact.Identificacion   = shipping.receiver.Identification;
            fact.IdOrigen         = shipping.origin.Location.CityCode;
            fact.Kilos            = (float)shipping.content.Measures.Sum(item => item.Weight);
            fact.KilosXvolumen    = (int)shipping.content.Measures.Sum(item => item.VolumetricWeight);
            fact.NombreCliente    = shipping.origin.Name;
            fact.NombreDestino    = shipping.receiver.Name;
            fact.Obs             = "Guia generada por kiosko";
            fact.Referencia      = "";
            fact.TelefonoCliente = shipping.origin.Phone;
            fact.TelefonoDestino = shipping.receiver.Phone;
            fact.ValorDeclarado  = (int)shipping.content.Value;

            string factid = "254546";



            BluWebService.EError Er = client.RegistrarFactura(ref enc, ref fact, ref factid);
            if (Er.Codigo == 1)
            {
                guideResponse.Id   = Convert.ToInt32(fact.Identificacion);
                guideResponse.Code = fact.IdFactura;
                BluWebService.EFacturas fals = new BluWebService.EFacturas();
                fals.IdFactura = fact.IdFactura;
                BluWebService.EFacturas fals2 = new BluWebService.EFacturas();
                BluWebService.EError    er    = client.ConsultarFactura(ref enc, factid, fals, out fals2);


                return(guideResponse);
            }
            else
            {
                guideResponse.error.HasError = true;
                guideResponse.error.Message  = Er.Descripcion;
                return(guideResponse);
            }
        }
Ejemplo n.º 27
0
 public IHttpActionResult GenerateInvoice([FromBody] ShippingModel shipping)
 {
     try
     {
         var data     = _service.GenerateInvoice(shipping);
         var response = new
         {
             data
         };
         return(Ok(response));
     }
     catch (Exception e)
     {
         return(NotFound());
     }
 }
Ejemplo n.º 28
0
 public ViewResult MakeOrder(ShippingModel shippingModel)
 {
     if (GetCart().Lines.Count() == 0)
     {
         ModelState.AddModelError("", "Извините, ваша корзина пуста!");
     }
     if (ModelState.IsValid)
     {
         GetCart().Clear();
         return(View("Completed"));
     }
     else
     {
         return(View(shippingModel));
     }
 }
Ejemplo n.º 29
0
 public IHttpActionResult printInvoice([FromBody] ShippingModel shipping)
 {
     try
     {
         var shipp = _service.PrintInvoice(shipping);
         //var response = new
         //{
         //    shipp
         //};
         return Ok(shipp);
     }
     catch (Exception e)
     {
         return NotFound();
     }
 }
        public IActionResult Shipping()
        {
            ShoppingCartSummary cartSummary = GetCartSummary();
            ShoppingCartDetail  cartDetails = _shoppingCartProvider.GetDetail(cartSummary.Id);

            if (!cartDetails.RequiresShipping)
            {
                return(RedirectToAction(nameof(Checkout)));
            }

            ShippingModel model = new ShippingModel(GetModelData());

            PrepareShippingAddressModel(in model, _accountProvider.GetDeliveryAddresses(GetUserSession().UserID));

            return(View(model));
        }