Пример #1
0
 public PaymentModel MCashPayment(PaymentModel objPaymentModel)
 {
     try
     {
         PaymentLogic     objPaymentLogic  = new PaymentLogic();
         McashIntegration mcashIntegration = new McashIntegration();
         //objPaymentModel = new PaymentModel();
         //objPaymentModel.PayableAmount = "100";
         //objPaymentModel.TransactionNo = "T2404201876575765";
         //objPaymentModel.ProposalNo = "50125759";
         //objPaymentModel.McashPin = "0000";
         //objPaymentModel.McashMobile = "0718929748";
         //objPaymentModel.Mobile = "0712911111";
         //mcashIntegration.PayUtilitiesDirect(objPaymentModel);
         if (mcashIntegration.PayUtilitiesDirect(objPaymentModel))
         {
             objPaymentModel = objPaymentLogic.SaveProposalPaymentInfo(objPaymentModel);
         }
         return(objPaymentModel);
     }
     catch (Exception ex)
     {
         log4net.GlobalContext.Properties["ErrorCode"] = Codes.GetErrorCode();
         Logger.Error(ex);
         objPaymentModel.Message            = "Error";
         objPaymentModel.Error.ErrorMessage = "Something went wrong. Please contact the admin, your reference code : " + objPaymentModel.Error.ErrorCode;
         return(objPaymentModel);
     }
 }
Пример #2
0
        public void GetAllPaymentsByStudentOnlySubscription()
        {
            AddTestSubscription();
            PaymentLogic paymentLogic = new PaymentLogic();

            Assert.IsTrue(paymentLogic.GetAllPaymentsByStudent(GetLastStudentInDB()).Count == 1);
        }
Пример #3
0
        public void GetAllPaymentsByStudentOnlyActivityPayment()
        {
            AddActivityPayment();
            PaymentLogic paymentLogic = new PaymentLogic();

            Assert.IsTrue(paymentLogic.GetAllPaymentsByStudent(GetLastStudentInDB()).Count == 1);
        }
Пример #4
0
        public void GetAllPaymentsOnlySubscriptions()
        {
            AddTestSubscription();
            PaymentLogic paymentLogic = new PaymentLogic();

            Assert.IsTrue(paymentLogic.GetAllPayments().Count == 1);
        }
Пример #5
0
 public FormPay(RouteLogic routeLogic, PaymentLogic paymentLogic, ReserveLogic reserveLogic)
 {
     _routeLogic   = routeLogic;
     _paymentLogic = paymentLogic;
     _reserveLogic = reserveLogic;
     InitializeComponent();
 }
Пример #6
0
 public PaymentBaseController(IConfiguration configuration, IHostingEnvironment hostingEnvironment, ILoggerFactory loggerFactory)
 {
     _configuration      = configuration;
     _hostingEnvironment = hostingEnvironment;
     _loggerFactory      = loggerFactory;
     _payment            = new PaymentLogic(configuration, hostingEnvironment, _loggerFactory);
 }
Пример #7
0
        static void Main(string[] args)
        {
            PaymentLogic calc = new PaymentLogic();

            calc.CalculatePayments();
            Console.ReadKey();
        }
Пример #8
0
        public void GetAllPaymentsByStudentEmpty()
        {
            AddTestSubscription();
            PaymentLogic paymentLogic = new PaymentLogic();
            Student      newStudent   = new Student();

            Assert.IsTrue(paymentLogic.GetAllPaymentsByStudent(newStudent).Count == 0);
        }
Пример #9
0
 public MainController(RequestLogic request, WorkLogic work, RequestLogic main, PaymentLogic payment, CostLogic cost)
 {
     _request = request;
     _work    = work;
     _main    = main;
     _payment = payment;
     _cost    = cost;
 }
Пример #10
0
 protected BaseController()
 {
     Logger = LogManager.GetLogger(GetType());
     Database = new OpaContext();
     PersonHelper = new PersonLogic(Database);
     UserHelper = new UserLogic(Database, PersonHelper);
     PaymentHelper = new PaymentLogic(Database, PersonHelper);
     ContactHelper = new ContactLogic(Database);
     FinancialHelper = new FinancialLogic(Database);
 }
Пример #11
0
        public void LoadConsultPaymentsByStudent(object selected, ListBox listBox)
        {
            Student      selectedStudent = selected as Student;
            PaymentLogic logic           = new PaymentLogic();

            foreach (var item in logic.GetAllPaymentsByStudent(selectedStudent))
            {
                listBox.Items.Add(item);
            }
        }
Пример #12
0
        public void CreatePremium(PolicyRenewalModel renewal)
        {
            ImisPayment payment      = new ImisPayment(_configuration, _hostingEnvironment, _loggerFactory);
            var         paymentLogic = new PaymentLogic(_configuration, _hostingEnvironment, _loggerFactory);

            if (_configuration.GetValue <bool>("PaymentGateWay:CreatePremiumOnPaymentReceived"))
            {
                int paymentId = payment.GetPaymentId(renewal.ControlNumber);
                _ = paymentLogic.CreatePremium(paymentId);
            }
        }
Пример #13
0
        public void TestRemainingPrice()
        {
            //Arrange
            decimal price = 30;
            decimal value = 10.50m;

            //Act
            decimal expectedResult = 19.50m;
            decimal result         = new PaymentLogic().RemainingPrice(value, price);

            //Assert
            Assert.AreEqual(expectedResult, result);
        }
Пример #14
0
 public PaymentModel SavePGTransaction(PaymentModel objPaymentModel)
 {
     try
     {
         PaymentLogic objPaymentLogic = new PaymentLogic();
         objPaymentModel = objPaymentLogic.SavePGTransaction(objPaymentModel);
     }
     catch (Exception ex)
     {
         log4net.GlobalContext.Properties["ErrorCode"] = objPaymentModel.Error.ErrorCode = Codes.GetErrorCode();
         Logger.Error(ex);
         objPaymentModel.Error.ErrorMessage = "Something went wrong. Please contact the admin, your reference code : " + objPaymentModel.Error.ErrorCode;
     }
     return(objPaymentModel);
 }
Пример #15
0
        public void CreatePremium(EnrolFamilyModel model)
        {
            ImisPayment  payment      = new ImisPayment(_configuration, _hostingEnvironment, _loggerFactory);
            PaymentLogic paymentLogic = new PaymentLogic(_configuration, _hostingEnvironment, _loggerFactory);

            if (_configuration.GetValue <bool>("PaymentGateWay:CreatePremiumOnPaymentReceived"))
            {
                foreach (var family in model.Family)
                {
                    foreach (var policy in family.Policies)
                    {
                        int paymentId = payment.GetPaymentId(policy.ControlNumber);
                        _ = paymentLogic.CreatePremium(paymentId);
                    }
                }
            }
        }
Пример #16
0
        public ActionResult CheckValue()
        {
            string valuestring = Request["value"];

            decimal value = decimal.Parse(valuestring);

            CinemaViewModel model = (CinemaViewModel)TempData["model"];

            if (model == null)
            {
                model = new CinemaViewModel();
            }

            if (model.LoggedInCashRegister == false)
            {
                return(RedirectToAction("GiftCardPayment", "Payment",
                                        new { error = "Log in om deze pagina te bezoeken." }));
            }

            decimal price = model.GetTotalPriceForAllTickets();

            if (value > price)
            {
                decimal remainingvalue = new PaymentLogic().RemainingValue(value, price);

                if (remainingvalue > 5)
                {
                    ViewBag.todo = "Het resterende bedrag op de bon is €" + remainingvalue + ". Gelieve dit bedrag op de bon te noteren voor toekomstig gebruik.";
                }
                else
                {
                    ViewBag.todo = "Het resterende bedrag op de bon is €" + remainingvalue + ". Gelieve dit bedrag contant terug te geven en de bon weg te gooien.";
                }
            }

            else
            {
                decimal remainingprice = new PaymentLogic().RemainingPrice(value, price);

                ViewBag.todo = "Het resterende bedrag na inlevering van de bon is €" + remainingprice + ". Gelieve dit bedrag contant af te handelen.";
            }

            TempData["model"] = model;
            return(View("GiftCardPayment", model));
        }
Пример #17
0
        public void TestFindCard()
        {
            //Arrange
            int code = 12345;
            List <TenRidesCard> cards = new List <TenRidesCard>
            {
                new TenRidesCard {
                    CardCode = 12345, Rides = 10
                }
            };

            //Act
            TenRidesCard expResult = cards[0];
            TenRidesCard result    = new PaymentLogic().FindCard(code, cards);

            //Assert
            Assert.AreEqual(expResult, result);
        }
Пример #18
0
 public PaymentModel SaveProposalPaymentInfo(PaymentModel objPaymentModel)
 {
     try
     {
         PaymentLogic objPaymentLogic = new PaymentLogic();
         return(objPaymentLogic.SaveProposalPaymentInfo(objPaymentModel));
     }
     catch (Exception ex)
     {
         log4net.GlobalContext.Properties["ErrorCode"] = Codes.GetErrorCode();
         Logger.Error(ex);
         if (objPaymentModel.Message == "Success")
         {
             objPaymentModel.Message = "Success";
         }
         return(objPaymentModel);
     }
 }
Пример #19
0
        public Task Execute(IJobExecutionContext context)
        {
            var model = new MatchModel
            {
                internal_identifier = 0,
                audit_user_id       = 0
            };

            try
            {
                var payment  = new PaymentLogic(_configuration, _hostingEnvironment, _loggerFactory);
                var response = payment.MatchPayment(model);
            }
            catch (Exception ex)
            {
                return(Task.FromException(ex));
            }

            return(Task.CompletedTask);
        }
Пример #20
0
        public ActionResult TenRideCardCheck()
        {
            string valuestring = Request["code"];

            int code;

            int.TryParse(valuestring, out code);

            CinemaViewModel model = (CinemaViewModel)TempData["model"];

            if (model == null)
            {
                model = new CinemaViewModel();
            }

            if (model.LoggedInCashRegister == false)
            {
                return(RedirectToAction("TenRideCardPayment", "Payment",
                                        new { error = "Log in om deze pagina te bezoeken." }));
            }

            List <TenRidesCard> cards = TenRideRepo.GetCards().ToList();

            // Check the remaining rides on the card
            TenRidesCard foundCard = new PaymentLogic().FindCard(code, cards);

            if (foundCard == null)
            {
                return(RedirectToAction("TenRideCardPayment", "Payment", new { error = "Er kon geen kaart gevonden worden met deze code" }));
            }

            int rides        = foundCard.Rides;
            int totalTickets = model.GetAllTicketsQuantity();

            if (rides > totalTickets)
            {
                int remaingRides = rides - totalTickets;

                var context         = new EFDbContext();
                var CardToBeChanged = context.TenRidesCards.SingleOrDefault(c => c.CardCode == code);
                CardToBeChanged.Rides = remaingRides;
                context.SaveChanges();

                return(RedirectToAction("TenRideCardPayment", "Payment", new { confirmation = "Betaling succesvol, de kaart heeft nog " + remaingRides + " ritten beschikbaar." }));
            }

            if (rides == totalTickets)
            {
                var context = new EFDbContext();
                context.TenRidesCards.Remove(foundCard);
                context.SaveChanges();

                return(RedirectToAction("TenRideCardPayment", "Payment", new { confirmation = "Betaling succesvol, het aantal ritten op deze kaart zijn nu verbruikt." }));
            }

            else
            {
                var context = new EFDbContext();
                context.TenRidesCards.Remove(foundCard);
                context.SaveChanges();

                int remainingTickets = totalTickets - rides;
                return(RedirectToAction("TenRideCardPayment", "Payment", new { confirmation = "De kaart is volledig verbruikt (" + rides + " ritten). Er dienen nog " + remainingTickets + " kaartjes afgerekend te worden." }));
            }
        }
Пример #21
0
        /// <summary>
        /// The menu using object of PaymentLogic class,
        /// switch to ability to choose the prefered item.
        /// </summary>
        private static void PaymentBusinessLogicMenu()
        {
            PaymentLogic paymLogic = new PaymentLogic();

            Console.Clear();
            Console.WriteLine("Choose an action:");
            Console.WriteLine("1) List all payment");
            Console.WriteLine("2) Update payment");
            Console.WriteLine("3) Create new payment");
            Console.WriteLine("4) Delete payment");
            Console.WriteLine("5) Show payment's commission to the agency");
            Console.WriteLine("6) Show average commissions per payment");
            Console.Write("\r\nSelect an option: ");

            switch (Console.ReadLine())
            {
            case "1":
                Console.WriteLine("Table payment:");
                foreach (Payment item in paymLogic.GetAllPayments().ToList())
                {
                    Console.WriteLine($"pay_id: {item.PayId},    pay_amount: {item.PayAmount},    pay_applicant_id: {item.PayApplId},  pay_result:{item.PayIspayed}");
                }

                Console.ReadLine();

                break;

            case "2":
                Console.WriteLine("Update payment:");
                Console.WriteLine("Write Id of payment:");
                int payId = int.Parse(Console.ReadLine());
                Console.WriteLine("Write new price amount for a visa:");
                int amount = int.Parse(Console.ReadLine());
                paymLogic.ChangePriceAmount(payId, amount);
                Console.WriteLine("Changes done!");
                break;

            case "3":
                try
                {
                    Console.WriteLine("Create new payment:");
                    Console.WriteLine("write new id :");
                    int id = int.Parse(Console.ReadLine());
                    Console.WriteLine("Write existing tourist id:");
                    int tourId = int.Parse(Console.ReadLine());
                    Console.WriteLine("Write existing agency id:");
                    int agenId = int.Parse(Console.ReadLine());
                    Console.WriteLine("Enter amount of money that visa costs: ");
                    int money = int.Parse(Console.ReadLine());
                    Console.WriteLine("Enter if amount is [payed] or [not payed]: ");
                    string payorNot = Console.ReadLine();
                    paymLogic.CreateNewPayment(id, tourId, agenId, money, payorNot);
                    Console.WriteLine("Agency created successfully!");
                }
                catch (Exception ex)
                {
                    string message = string.Empty;
                    Console.ForegroundColor = ConsoleColor.Red;
                    if (ex is FormatException)
                    {
                        message = " Incorrect form";
                    }
                    else
                    {
                        Console.WriteLine(ex.Message);
                    }

                    Console.WriteLine(message);
                }

                break;

            case "4":
                Console.WriteLine("Delete payment by id:");
                Console.WriteLine("Write payment id:");
                int takeId = int.Parse(Console.ReadLine());
                paymLogic.RemoveOldPayment(takeId);
                Console.WriteLine("Payment deleted successfully!");
                break;

            case "5":
                Console.WriteLine("Show payment's commission");
                var commisions = paymLogic.GetPaymentCommissions();
                foreach (var comm in commisions)
                {
                    Console.WriteLine($" Commission: {comm.AmountOfCommission}, IsPayed:{comm.IsPaid} ");
                }

                Console.WriteLine("task output:");

                Task <IList <PaymentCommission> > paymentTask = paymLogic.GetPaymentCommissionAsync();
                paymentTask.Wait();
                if (paymentTask.IsCompletedSuccessfully)
                {
                    foreach (var task in paymentTask.Result)
                    {
                        Console.WriteLine($" Commission: {task.AmountOfCommission}, IsPayed:{task.IsPaid} ");
                    }
                }

                Console.ReadLine();
                break;

            case "6":
                Console.WriteLine("Show average payment's commission of the agencies");
                var comAvg = paymLogic.GetPaymentAverageCommissions();
                foreach (var co in comAvg)
                {
                    Console.WriteLine($" By Companies who: {co.IsPaid}, AvgCommissions:{co.AmountOfCommission} $");
                }

                Console.WriteLine("task output:");

                Task <IList <PaymentCommission> > payAvgComTask = paymLogic.GetPaymentAverageCommissionsAsync();
                payAvgComTask.Wait();
                if (payAvgComTask.IsCompletedSuccessfully)
                {
                    foreach (var task in payAvgComTask.Result)
                    {
                        Console.WriteLine($" By Companies who: {task.IsPaid}, AvgCommissions:{task.AmountOfCommission} $");
                    }
                }

                Console.ReadLine();
                break;
            }
        }
Пример #22
0
 public frmPayment(Invoice invoice)
 {
     InitializeComponent();
     payment      = new PaymentLogic(new UnitOfWork());
     this.invoice = invoice;
 }
Пример #23
0
 public PaymentLogicTests()
 {
     paymentLogic = new PaymentLogic();
 }
Пример #24
0
        public void TestPaymentCommission()
        {
            Mock <IPaymentRepository>   mockPayRepo  = new Mock <IPaymentRepository>(MockBehavior.Loose);
            Mock <IAgencyRepository>    mockAgenRepo = new Mock <IAgencyRepository>(MockBehavior.Loose);
            Mock <IApplicantRepository> mockAppRepo  = new Mock <IApplicantRepository>(MockBehavior.Loose);

            List <Payment> listPay = new List <Payment>()
            {
                new Payment()
                {
                    PayId = 1, PayAgenId = 1, PayApplId = 2, PayAmount = 50, PayIspayed = "payed"
                },
                new Payment()
                {
                    PayId = 2, PayAgenId = 2, PayApplId = 3, PayAmount = 100, PayIspayed = "not payed"
                },
                new Payment()
                {
                    PayId = 3, PayAgenId = 3, PayApplId = 1, PayAmount = 100, PayIspayed = "payed"
                },
                new Payment()
                {
                    PayId = 4, PayAgenId = 7, PayApplId = 4, PayAmount = 60, PayIspayed = "not payed"
                },
                new Payment()
                {
                    PayId = 5, PayAgenId = 5, PayApplId = 5, PayAmount = 130, PayIspayed = "payed"
                },
                new Payment()
                {
                    PayId = 6, PayAgenId = 7, PayApplId = 8, PayAmount = 67, PayIspayed = "payed"
                },
                new Payment()
                {
                    PayId = 7, PayAgenId = 6, PayApplId = 10, PayAmount = 60, PayIspayed = "payed"
                },
                new Payment()
                {
                    PayId = 8, PayAgenId = 4, PayApplId = 6, PayAmount = 40, PayIspayed = "not payed"
                },
                new Payment()
                {
                    PayId = 9, PayAgenId = 5, PayApplId = 7, PayAmount = 10, PayIspayed = "not payed"
                },
                new Payment()
                {
                    PayId = 10, PayAgenId = 5, PayApplId = 9, PayAmount = 41, PayIspayed = "payed"
                },
            };
            List <Agency> listAgency = new List <Agency>()
            {
                new Agency()
                {
                    AgenId = 1, AgenName = "PegasTouristic"
                },
                new Agency()
                {
                    AgenId = 2, AgenName = "AmediaTour"
                },
                new Agency()
                {
                    AgenId = 3, AgenName = "StarTravel"
                },
                new Agency()
                {
                    AgenId = 7, AgenName = "PortalAsia"
                },
                new Agency()
                {
                    AgenId = 5, AgenName = "TravelAround"
                },
                new Agency()
                {
                    AgenId = 6, AgenName = "AhmadTravel"
                },
                new Agency()
                {
                    AgenId = 4, AgenName = "CCUnated"
                },
            };
            List <Applicant> listApplicant = new List <Applicant>()
            {
                new Applicant()
                {
                    ApplId = 2
                },
                new Applicant()
                {
                    ApplId = 3
                },
                new Applicant()
                {
                    ApplId = 1
                },
                new Applicant()
                {
                    ApplId = 4
                },
                new Applicant()
                {
                    ApplId = 5
                },
                new Applicant()
                {
                    ApplId = 8
                },
                new Applicant()
                {
                    ApplId = 10
                },
                new Applicant()
                {
                    ApplId = 6
                },
                new Applicant()
                {
                    ApplId = 7
                },
                new Applicant()
                {
                    ApplId = 9
                },
            };

            List <PaymentCommission> expectedExten = new List <PaymentCommission>()
            {
                new PaymentCommission()
                {
                    AmountOfCommission = 6, IsPaid = "payed"
                },
                new PaymentCommission()
                {
                    AmountOfCommission = 2, IsPaid = "not payed"
                },
            };

            mockPayRepo.Setup(repo => repo.GetAll()).Returns(listPay.AsQueryable);
            mockAppRepo.Setup(repo => repo.GetAll()).Returns(listApplicant.AsQueryable);
            mockAgenRepo.Setup(repo => repo.GetAll()).Returns(listAgency.AsQueryable);
            PaymentLogic logic = new PaymentLogic(mockAppRepo.Object, mockAgenRepo.Object, mockPayRepo.Object);

            var result = logic.GetPaymentCommissions();

            Assert.That(result, Is.EqualTo(expectedExten));
            mockPayRepo.Verify(repo => repo.GetAll(), Times.Once);
        }
Пример #25
0
        private void SendSMS(ImisPayment payment)
        {
            var paymentLogic = new PaymentLogic(_configuration, _hostingEnvironment, _loggerFactory);

            paymentLogic.ControlNumberAssignedSms(payment);
        }
Пример #26
0
 public FormThirdReq(EmployeeLogic employeeLogic, PaymentLogic paymentLogic)
 {
     InitializeComponent();
     this.employeeLogic = employeeLogic;
     this.paymentLogic  = paymentLogic;
 }
Пример #27
0
 public PaymentsController(PaymentLogic paymentLogic, LessonLogic lessonLogic)
 {
     _paymentLogic = paymentLogic;
     _lessonLogic  = lessonLogic;
 }
 public PaymentController(PaymentLogic payment)
 {
     _payment = payment;
 }
Пример #29
0
 public FormPayments(PaymentLogic logic)
 {
     InitializeComponent();
     this.logic = logic;
 }