public async void Task_GetById_Return_OkResult()
        {
            //Arrange
            var Id = 1;

            //Act
            var result = await _controller.GetPayments(Id);

            //Assert
            Assert.IsType <OkObjectResult>(result);
        }
        public async Task TestGetPaymentsEmpty()
        {
            var payments = new[]
            {
                GetPayment(UnknownMerchantId),
            };

            PaymentDb.Payments.AddRange(payments);
            await PaymentDb.SaveChangesAsync();

            var response = await Subject.GetPayments();

            var paymentsResponse = response.Value.ToArray();

            Assert.AreEqual(0, paymentsResponse.Length);
        }
Пример #3
0
        private void Schedules_Load(object sender, EventArgs e)
        {
            BeneficairyList = BeneficiaryController.GetBeneficiarys(user.RsaID);
            PaymentListF    = PaymentsController.GetPayments(user.RsaID);
            foreach (Payment item in PaymentListF)
            {
                //DateTime payDate = DateTime.ParseExact(item.PayDate, "dd/MM/yyyy", System.Globalization.CultureInfo.InvariantCulture);

                //if (payDate > DateTime.Now || item.Recurring == true)
                //{
                PaymentList.Add(item);
                //}
            }
            if (CryptoController.GetUserCrypto(user.RsaID) != null)
            {
                userCrypto = CryptoController.GetUserCrypto(user.RsaID);
            }
            else
            {
                userCrypto = new Crypto("", "", 0, "", user.RsaID);
            }


            UserPaymentAccountList = PaymentsAccountController.SearchUserPaymentAcount(user.RsaID);
            UserCardList           = CardController.RetrveCards(user.RsaID);
            FillPaymentsDatagrid(PaymentList);
            BeneficairyList = BeneficiaryController.GetBeneficiarys(user.RsaID);
            FillBeneficiaryDatagrid(BeneficairyList);
            popUcb();
        }
Пример #4
0
        public void BeAbleToReturnAllPaymentsInRepository()
        {
            IHttpActionResult actionResult = CONTROLLER.GetPayments();
            OkNegotiatedContentResult <IEnumerable <Payment> > contentResult = (OkNegotiatedContentResult <IEnumerable <Payment> >)actionResult;

            CollectionAssert.AreEquivalent((ICollection)contentResult.Content, (ICollection)ALL_PAYMENTS);
        }
Пример #5
0
        private void Payments_Load(object sender, EventArgs e)
        {
            if (CryptoController.GetUserCrypto(user.RsaID) == null)
            {
                userCrypto = new Crypto("", "", 0, "", user.RsaID);
            }
            else
            {
                userCrypto = CryptoController.GetUserCrypto(user.RsaID);
            }
            history   = HistoryController.getHistory(user.RsaID);
            scheduals = PaymentsController.GetPayments(user.RsaID);

            foreach (Payment item in history)
            {
                ALLPAY.Add(item);
            }
            foreach (Payment item in scheduals)
            {
                ALLPAY.Add(item);
            }

            BeneficairyList        = BeneficiaryController.GetBeneficiarys(user.RsaID);
            UserPaymentAccountList = PaymentsAccountController.SearchUserPaymentAcount(user.RsaID);
            UserCardList           = CardController.RetrveCards(user.RsaID);
            FillBeneficiaryDatagrid(BeneficairyList);

            popUcb();
        }
Пример #6
0
        public PaymentsPage()
        {
            InitializeComponent();

            controller = new PaymentsController();

            controller.Control();

            LinkedList <Payment> payments;

            if (controller.HasPayments())
            {
                payments = controller.GetPayments();
                LinkedList <string> members = controller.GetMembers();

                foreach (string member in members)
                {
                    comboBox.Items.Add(member);
                }

                comboBox.SelectedItem = comboBox.Items[0];
            }

            comboBox_paid.Items.Add("Yes");
            comboBox_paid.Items.Add("No");

            if (comboBox.Items.Count == 0)
            {
                textBox_description.Enabled = false;
                comboBox_paid.Enabled       = false;
                button_change.Enabled       = false;
            }
            else
            {
                comboBox.SelectedIndex = 0;

                payments = controller.GetPayments();

                textBox_amount.Text      = payments.First.Value.Amount.ToString();
                datetime_due_date.Value  = payments.First.Value.DueDate;
                textBox_description.Text = payments.First.Value.Description;
                comboBox_paid.Text       = payments.First.Value.IsPaid ? "Yes" : "No";

                payment = payments.First.Value;
            }
        }
Пример #7
0
        public void GetPayments_ShouldReturnAllPayments()
        {
            var context = serviceProvider.GetRequiredService <DataContext>();

            var controller = new PaymentsController(context);

            context.Payment.Add(payment1);
            context.Payment.Add(payment2);
            context.SaveChanges();

            var payments = controller.GetPayments().Result.Value.ToList();

            Assert.Equal(payment1, payments[0]);
            Assert.Equal(payment2, payments[1]);
        }
Пример #8
0
        public void InsertTestsProviderInfoForTest()
        {
            CONTROLLER = new PaymentsController(ADMIN_USER_USEREMAIL);
            IHttpActionResult actionResult = CONTROLLER.GetPayments();
            OkNegotiatedContentResult <IEnumerable <Payment> > contentResult =
                (OkNegotiatedContentResult <IEnumerable <Payment> >)actionResult;

            ALL_PAYMENTS = contentResult.Content.ToList();
            foreach (Payment payment in ALL_PAYMENTS)
            {
                if (payment.Equals(FIRST_PAYMENT))
                {
                    FIRST_PAYMENT.ID = payment.ID;
                }
                if (payment.Equals(SECOND_PAYMENT))
                {
                    SECOND_PAYMENT.ID = payment.ID;
                }
            }
        }
Пример #9
0
        public void BeAbleToReturnAllPaymentsInRepository()
        {
            List <IField> emptyFields = new List <IField>();
            NumberField   field       = new NumberField("Monto");

            emptyFields.Add(field);
            IField        firstFilledField = field.FillAndClone("100");
            List <IField> firstFullFields  = new List <IField>();

            firstFullFields.Add(firstFilledField);
            IField        secondFilledField = field.FillAndClone("101");
            List <IField> secondFullFields  = new List <IField>();

            secondFullFields.Add(secondFilledField);
            Provider       provider      = new Provider("Antel", 3, emptyFields);
            Receipt        firstReceipt  = new Receipt(provider, firstFullFields, 100);
            Receipt        secondReceipt = new Receipt(provider, secondFullFields, 100);
            List <Receipt> firstList     = new List <Receipt>();
            List <Receipt> secondList    = new List <Receipt>();

            firstList.Add(firstReceipt);
            secondList.Add(secondReceipt);
            var allPayments = new[]
            {
                new Payment(new CashPayMethod(DateTime.Now), 100, firstList),
                new Payment(new DebitPayMethod(DateTime.Now), 100, secondList)
            };
            var mockPaymentService = new Mock <IPaymentService>();

            mockPaymentService.Setup(x => x.GetAllPayments()).Returns(allPayments);
            PaymentsController controller = new PaymentsController(mockPaymentService.Object);

            IHttpActionResult actionResult = controller.GetPayments();
            OkNegotiatedContentResult <IEnumerable <Payment> > contentResult = (OkNegotiatedContentResult <IEnumerable <Payment> >)actionResult;

            Assert.AreSame(contentResult.Content, allPayments);
        }
Пример #10
0
        private void btnFilter_Click(object sender, EventArgs e)
        {
            PaymentList     = PaymentsController.GetPayments(user.RsaID);
            BeneficairyList = BeneficiaryController.GetBeneficiarys(user.RsaID);
            List <string> BeneficiarySearchIDs = new List <string>();
            bool          UsePaymentList       = false;

            List <Payment> SearchList = new List <Payment>();

            //Filter for Beneficiary Name
            if (!txtFBName.Text.Equals(""))
            {
                //Get All ID's of Beneficiaries that fall under search Criteria
                foreach (Beneficiary item in BeneficairyList)
                {
                    if (item.BeneficairyName.IndexOf(txtFBName.Text.Trim(), StringComparison.CurrentCultureIgnoreCase) != -1)
                    {
                        BeneficiarySearchIDs.Add(item.BeneficairyID);
                    }
                }

                //Filter All Payments, based on BeneficiaryID
                foreach (Payment item in PaymentList)
                {
                    if (BeneficiarySearchIDs.Contains(item.BeneficairyID))
                    {
                        SearchList.Add(item);
                    }
                }

                //Changes the Criteria list, depending on this Filter Criteria, only showing payments that meet this criteria, for the next criteria methods.
                PaymentList    = SearchList;
                SearchList     = new List <Payment>();
                UsePaymentList = true;
            }

            //Filter by Payment Method
            if (!cbFPaymentMethod.Text.Equals(""))
            {
                foreach (Payment item in PaymentList)
                {
                    if (item.TypePayment.ToString() == cbFPaymentMethod.Text.ToString())
                    {
                        SearchList.Add(item);
                    }
                }

                PaymentList    = SearchList;
                SearchList     = new List <Payment>();
                UsePaymentList = true;
            }

            //Filter by Date
            if (cxbDate.Checked)
            {
                string   StartDateString = dtpFStart.Value.ToString("dd/MM/yyyy");
                DateTime StartDate       = DateTime.ParseExact(StartDateString, "dd/MM/yyyy", System.Globalization.CultureInfo.InvariantCulture);

                string   EndDateString = dtpFEnd.Value.ToString("dd/MM/yyyy");
                DateTime EndDate       = DateTime.ParseExact(EndDateString, "dd/MM/yyyy", System.Globalization.CultureInfo.InvariantCulture);

                foreach (Payment item in PaymentList)
                {
                    DateTime PaymentDate = DateTime.ParseExact(item.PayDate, "dd/MM/yyyy", System.Globalization.CultureInfo.InvariantCulture);

                    if (PaymentDate > StartDate && PaymentDate < EndDate)
                    {
                        SearchList.Add(item);
                    }
                }

                PaymentList    = SearchList;
                SearchList     = new List <Payment>();
                UsePaymentList = true;
            }



            //Now Populate depending on which list, true means using PaymentList global variable, false means using the searchlist
            if (UsePaymentList)
            {
                FillPaymentsDatagrid(PaymentList);
            }
            else
            {
                FillPaymentsDatagrid(SearchList);
            }
        }