예제 #1
0
        public IActionResult Abonar(SigoCreditosInfoModel model)
        {
            long Cod_Abono = 0;

            try
            {
                if (!ModelState.IsValid)
                {
                    return(Configure());
                }
                var result = CRMContext.CRMContext.AbonarPuntos(model);
                if (result != null)
                {
                    var SCPaypalmodel = new SigoCreditosPaypal
                    {
                        TransaccionPaypalID = model.IdTransaccion,
                        TransaccionCreditID = result.Cod_Abono,
                        CedulaReceptor      = model.AddBalanceModel.OwnerBalance == 1 ? model.CustomerDocumentValue : model.AddBalanceModel.ReceiverDocumentValue,
                        Estatus_Operacion   = result.Cod_Abono != 0 ? true : false,
                        Monto          = Convert.ToDecimal(model.AddBalanceModel.TransactionAmount),
                        FechaCreacion  = DateTime.Now,
                        NombreReceptor = model.CostumerName,
                        CustomerID     = model.CustomerID,
                    };
                    model.Cod_Abono = result.Cod_Abono;
                    _SigoCreditosPayPalService.InsertSigoCreditosPaypal(SCPaypalmodel);
                    return(Json(model));
                    //return RedirectToRoute("CustomerSigoCreditos");
                }
                else
                {
                    return(Configure());
                }
            }
            catch (Exception ex)
            {
                var SCPaypalmodel = new SigoCreditosPaypal
                {
                    TransaccionPaypalID = model.IdTransaccion,
                    TransaccionCreditID = model.Cod_Abono,
                    CedulaReceptor      = model.AddBalanceModel.OwnerBalance == 1 ? model.CustomerDocumentValue : model.AddBalanceModel.ReceiverDocumentValue,
                    Estatus_Operacion   = false,
                    Monto          = Convert.ToDecimal(model.AddBalanceModel.TransactionAmount.Replace(".", string.Empty).Replace(",", ".").Trim()),
                    FechaCreacion  = DateTime.Now,
                    NombreReceptor = model.CostumerName,
                    CustomerID     = model.CustomerID,
                };
                _SigoCreditosPayPalService.InsertSigoCreditosPaypal(SCPaypalmodel);
                return(Json(model));
                //throw ex;
            }


            //now clear settings cache
        }
예제 #2
0
        /// <summary>
        /// Inserts a pickup point
        /// </summary>
        /// <param name="bank">Pickup point</param>
        public virtual void InsertSigoCreditosPaypal(SigoCreditosPaypal SCPaypal)
        {
            try
            {
                if (SCPaypal == null)
                {
                    throw new ArgumentNullException(nameof(SCPaypal));
                }

                _SigoCreditosPaypalRepository.Insert(SCPaypal);
                // _cacheManager.RemoveByPattern(BANK_PATTERN_KEY);
            }
            catch (Exception ex)
            {
                throw new NopException("Error al insertar el banco: " + ex.Message, ex);
            }
        }
예제 #3
0
 /// <summary>
 /// Guarda los datos de la transaccion de paypal
 /// </summary>
 /// <param name="model"></param>
 /// <param name="estatus"></param>
 private void InsertarPaypal(TransaccionModel model)
 {
     try
     {
         var SCPaypalmodel = new SigoCreditosPaypal
         {
             TransaccionPaypalID = model.TransaccionPaypalID,
             TransaccionCreditID = model.Cod_Abono,
             CedulaReceptor      = model.CedulaReceptor,
             Estatus_Operacion   = model.Estatus_Operacion,
             Monto          = model.Monto,
             FechaCreacion  = DateTime.Now,
             NombreReceptor = model.NombreReceptor,
             CustomerID     = model.CustomerID,
             EsGiftCard     = model.IndGiftCard,
             CodigoGiftCard = model.CodigoGiftCard
         };
         _SigoCreditosPayPalService.InsertSigoCreditosPaypal(SCPaypalmodel);
     }
     catch (Exception ex)
     {
         throw new NopException("Error al InsertarPaypal: " + ex.Message, ex);
     }
 }
예제 #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);
            }
        }