Exemple #1
0
        public IViewComponentResult Invoke(int id)
        {
            try
            {
                if (id == 0)
                {
                    throw new ArgumentNullException(nameof(id));
                }

                var zelle = _consolidateService.GetPaymentByOrderId(id);

                var model = new ConfigurationModel();
                if (zelle != null)
                {
                    model = new ConfigurationModel
                    {
                        Id          = zelle.Id,
                        OrdenId     = zelle.OrdenId,
                        EmailEmisor = zelle.EmailEmisor,
                        Referencia  = zelle.Referencia,
                        //StatusPaymentOrder = zelle.StatusPaymentOrder
                        StatusPaymentOrder = zelle.StatusPaymentOrder.ToString()
                    };
                }
                else
                {
                    model.OrdenId = id;
                }
                return(View("~/Plugins/Payments.ConsolidatePayment/Views/RegisterPaymentZelle.cshtml", model));
            }
            catch (Exception ex)
            {
                throw new NopException(ex.Message, ex);
            }
        }
Exemple #2
0
        public IViewComponentResult Invoke(int id)
        {
            try
            {
                var allBank             = _bankService.GetBankAlls();
                var listaBancos         = new List <SelectListItem>();
                var allBankReceiver     = _bankService.GetBankReceiver();
                var listaBancosReceiver = new List <SelectListItem>();


                // verificamos que la orden no tenga transferencia registrada
                var transfer = _consolidateService.GetPaymentByOrderId(id);

                var model = new ConfigurationModel();
                if (transfer != null)
                {
                    // preparamos el modelo para el mostrar.
                    listaBancosReceiver.Clear();
                    listaBancos.Clear();

                    foreach (var bank in allBankReceiver)
                    {
                        listaBancosReceiver.Add(new SelectListItem {
                            Text = bank.Name + " - " + bank.AccountNumber, Value = bank.Id.ToString()
                        });
                    }

                    foreach (var bank in allBank)
                    {
                        listaBancos.Add(new SelectListItem {
                            Text = bank.Name, Value = bank.Id.ToString()
                        });
                    }


                    model = new ConfigurationModel
                    {
                        Id               = transfer.Id,
                        OrdenId          = transfer.OrdenId,
                        BancosEmisores   = listaBancos,
                        BancosReceptores = listaBancosReceiver,
                        BancoEmisorId    = transfer.BancoEmisorId,
                        BancoReceptorId  = transfer.BancoReceptorId,
                        Referencia       = transfer.Referencia,
                        //StatusPaymentOrder = transfer.StatusPaymentOrder
                        StatusPaymentOrder = transfer.StatusPaymentOrder.ToString()
                    };
                }
                else
                {
                    // Creamos el modelo para el registrar.
                    listaBancosReceiver.Clear();
                    listaBancos.Clear();

                    foreach (var bank in allBankReceiver)
                    {
                        listaBancosReceiver.Add(new SelectListItem {
                            Text = bank.Name + " - " + bank.AccountNumber, Value = bank.Id.ToString()
                        });
                    }

                    foreach (var bank in allBank)
                    {
                        listaBancos.Add(new SelectListItem {
                            Text = bank.Name, Value = bank.Id.ToString()
                        });
                    }

                    model.BancosEmisores   = listaBancos;
                    model.BancosReceptores = listaBancosReceiver;
                    model.OrdenId          = id;
                }

                return(View("~/Plugins/Payments.ConsolidatePayment/Views/RegisterPaymentTransfer.cshtml", model));
            }
            catch (Exception ex)
            {
                throw new NopException(ex.Message, ex);
            }
        }