Exemplo n.º 1
0
        public virtual IActionResult ExportXlsxSinAbonar()
        {
            if (!_permissionService.Authorize(StandardPermissionProvider.ManageCategories))
            {
                return(AccessDeniedView());
            }

            try
            {
                ClienteAbonoModel payment = new ClienteAbonoModel
                {
                    Transaccion = new TransaccionModel
                    {
                        Estatus_Operacion = false,
                    }
                };

                var transferList = _SigoCreditosPayPalService.SearchAbonosClientes(payment);

                var xml = ExportPaymentToXlsx(transferList);

                return(File(xml, MimeTypes.TextXlsx, "AbonosExitosos.xlsx"));
            }
            catch (Exception exc)
            {
                ErrorNotification(exc);
                return(RedirectToAction("List"));
            }
        }
Exemplo n.º 2
0
        public IActionResult ListAbonoClientes(ClienteAbonoModel search, DataSourceRequest command)
        {
            try
            {
                if (!_permissionService.Authorize(StandardPermissionProvider.ManageShippingSettings))
                {
                    return(AccessDeniedKendoGridJson());
                }

                if (search == null)
                {
                    throw new ArgumentNullException(nameof(search));
                }

                var ListaClientesAbonos = _SigoCreditosPayPalService.SearchAbonosClientes(search, pageIndex: command.Page - 1, pageSize: command.PageSize);

                return(Json(new DataSourceResult
                {
                    Data = ListaClientesAbonos,
                    Total = ListaClientesAbonos.TotalCount
                }));
            }
            catch (Exception ex)
            {
                throw new NopException(ex.Message, ex);
            }
        }
Exemplo n.º 3
0
        //[HttpPost]
        //[AdminAntiForgery]
        //public IActionResult AbonarGiftCard(SigoCreditosGiftCardModel model)
        //{
        //    if (!_permissionService.Authorize(StandardPermissionProvider.ManagePaymentMethods))
        //        return AccessDeniedView();

        //    if (!ModelState.IsValid)
        //        return Configure();

        //    //load settings for a chosen store scope

        //    bool result = CRMContext.CRMContext.EnviarGiftCard(model);
        //    if (result)
        //    {
        //        var cliente = CRMContext.CRMContext.ObtenerPuntosxCliente(model.DocumentType, model.DocumentValue);
        //        return RedirectToRoute("CustomerSigoCreditos");
        //        //return View("~/Plugins/Payments.SigoCreditos/Views/SigoCreditosInfo.cshtml", cliente);
        //        // return View("~/Plugins/Payments.SigoCreditos/Views/SigoCreditosInfo.cshtml", null);
        //    }
        //    else
        //    {
        //        return Configure();
        //    }

        //    //now clear settings cache

        //}

        #endregion
        #endregion

        #region Abonos Sigo Creditos // Admin


        public IActionResult ConfigureAbonosClientes()
        {
            if (!_permissionService.Authorize(StandardPermissionProvider.ManagePaymentMethods))
            {
                return(AccessDeniedView());
            }
            var AbonosClientes = new ClienteAbonoModel();

            //load settings for a chosen store scope
            return(View("~/Plugins/Payments.SigoCreditos/Views/ConfigureAbonosClientes.cshtml", AbonosClientes));
        }
Exemplo n.º 4
0
        public IPagedList <ClienteAbonoModel> SearchAbonosClientes(ClienteAbonoModel payment, int storeId = 0, int pageIndex = 0, int pageSize = int.MaxValue)
        {
            try
            {
                List <ClienteAbonoModel> ListaClientesaAbonos = new List <ClienteAbonoModel>();
                List <TransaccionModel>  ListaTransacciones   = new List <TransaccionModel>();
                SigoCreditosPaypal       scp = new SigoCreditosPaypal();
                var ListaSigoCreditosPayPal  = _SigoCreditosPaypalRepository.Table;

                if (ListaSigoCreditosPayPal != null && ListaSigoCreditosPayPal.Count() > 0)
                {
                    //foreach (var SCPaypal in ListaSigoCreditosPayPal.Where(x => x.CustomerID == CurrentCustomerId).OrderByDescending(x => x.FechaCreacion))

                    foreach (var SCPaypal in ListaSigoCreditosPayPal.OrderByDescending(x => x.FechaCreacion))

                    {
                        var cliente = _customerService.GetCustomerById(SCPaypal.CustomerID);


                        ClienteAbonoModel ClienteAbono = new ClienteAbonoModel
                        {
                            EcommerceId = SCPaypal.CustomerID,
                            //Nombre =  cliente.Addresses != null ? cliente.Addresses.FirstOrDefault(x => x.FirstName != null).FirstName :
                            Nombre      = (cliente.Addresses.FirstOrDefault(x => x.FirstName != null).FirstName ?? "S/D") + " " + (cliente.Addresses.FirstOrDefault(x => x.LastName != null).LastName ?? "S/D"),
                            Apellido    = cliente.Addresses.FirstOrDefault(x => x.LastName != null).LastName != null?cliente.Addresses.FirstOrDefault(x => x.LastName != null).LastName             : "S/D",
                            Telefono    = cliente.Addresses.FirstOrDefault(x => x.PhoneNumber != null).PhoneNumber != null?cliente.Addresses.FirstOrDefault(x => x.PhoneNumber != null).PhoneNumber : "S/D",
                            Email       = cliente.Email != null ? cliente.Email                                                                                                                     : "S/D",
                            Transaccion = new TransaccionModel
                            {
                                TransaccionPaypalID = !string.IsNullOrWhiteSpace(SCPaypal.TransaccionPaypalID) ? SCPaypal.TransaccionPaypalID : "S/D",
                                Monto               = SCPaypal.Monto,
                                CedulaReceptor      = !string.IsNullOrWhiteSpace(SCPaypal.CedulaReceptor) ? SCPaypal.CedulaReceptor : "S/D",
                                NombreReceptor      = !string.IsNullOrWhiteSpace(SCPaypal.NombreReceptor) ? SCPaypal.NombreReceptor : "S/D",
                                Estatus_Operacion   = SCPaypal.Estatus_Operacion,
                                TransaccionCreditID = SCPaypal.TransaccionCreditID,
                                CustomerID          = SCPaypal.CustomerID,
                                FechaCreacion       = SCPaypal.FechaCreacion,
                                IndGiftCard         = SCPaypal.EsGiftCard,
                                CodigoGiftCard      = !string.IsNullOrWhiteSpace(SCPaypal.CodigoGiftCard) ? SCPaypal.CodigoGiftCard : "S/D"
                            }
                        };


                        ListaClientesaAbonos.Add(ClienteAbono);
                    }
                }
                if (!string.IsNullOrWhiteSpace(payment.Nombre))
                {
                    ListaClientesaAbonos = ListaClientesaAbonos.Where(b => b.Nombre.ToUpper().Contains(payment.Nombre.ToUpper())).ToList();
                }

                if (!string.IsNullOrWhiteSpace(payment.Email))
                {
                    ListaClientesaAbonos = ListaClientesaAbonos.Where(b => b.Email.Contains(payment.Email)).ToList();
                }

                if (!string.IsNullOrWhiteSpace(payment.Transaccion.TransaccionPaypalID))
                {
                    ListaClientesaAbonos = ListaClientesaAbonos.Where(b => b.Transaccion.TransaccionPaypalID.Contains(payment.Transaccion.TransaccionPaypalID)).ToList();
                }

                //if (payment.Transaccion.TransaccionCreditID > 0)
                //    ListaClientesaAbonos = ListaClientesaAbonos.Where(b => b.Transaccion.TransaccionCreditID == payment.Transaccion.TransaccionCreditID).ToList();

                if (!string.IsNullOrWhiteSpace(payment.Transaccion.NombreReceptor))
                {
                    ListaClientesaAbonos = ListaClientesaAbonos.Where(b => b.Transaccion.NombreReceptor.ToUpper().Contains(payment.Transaccion.NombreReceptor.ToUpper())).ToList();
                }

                //  if(payment.Transaccion.Estatus_Operacion != null)
                ListaClientesaAbonos = ListaClientesaAbonos.Where(b => b.Transaccion.Estatus_Operacion == payment.Transaccion.Estatus_Operacion).ToList();


                return(new PagedList <ClienteAbonoModel>(ListaClientesaAbonos.ToList(), pageIndex: pageIndex - 1, pageSize: pageSize));;
            }
            catch (Exception ex)
            {
                throw new NopException("Error al obtener los pagos:: " + ex.Message, ex);
            }
        }