Example #1
0
        public async Task <IActionResult> Details(string id)
        {
            var c = await payments.GetObject(id);

            switch (c)
            {
            case CashObject cash:
                return(View("DetailsCash",
                            PaymentViewModelFactory.Create(cash) as CashViewModel));

            case CheckObject check:
                return(View("DetailsCheck",
                            PaymentViewModelFactory.Create(check) as CheckViewModel));

            case DebitCardObject debit:
                return(View("DetailsDebitCard",
                            PaymentViewModelFactory.Create(debit) as DebitCardViewModel));

            case CreditCardObject credit:
                return(View("DetailsCreditCard",
                            PaymentViewModelFactory.Create(credit) as CreditCardViewModel));
            }

            return(RedirectToAction("Index"));
        }
Example #2
0
        public void CreateWithExtremumDatesTest()
        {
            var o = GetRandom.Object <CashObject>();

            o.DbRecord.ValidFrom = DateTime.MinValue;
            o.DbRecord.ValidTo   = DateTime.MaxValue;
            var v = PaymentViewModelFactory.Create(o);

            Assert.AreEqual(v.ID, o.DbRecord.ID);
            Assert.AreEqual(v.ValidFrom, null);
            Assert.AreEqual(v.ValidTo, null);
        }
Example #3
0
        public void CreateTest()
        {
            var v = PaymentViewModelFactory.Create(null) as CashViewModel;

            Assert.IsNotNull(v);
            Assert.AreEqual(v.ID, u);
            Assert.AreEqual(v.ValidFrom, null);
            Assert.AreEqual(v.ValidTo, null);
            Assert.AreEqual(v.Amount, u);
            Assert.AreEqual(v.Currency, u);
            Assert.AreEqual(v.Memo, u);
            Assert.AreEqual(v.Payee, u);
            Assert.AreEqual(v.PayeeAccountNumber, u);
            Assert.AreEqual(v.Payer, u);
            Assert.AreEqual(v.PayerAccountNumber, u);
        }
Example #4
0
        public void CreateCashTest()
        {
            var o = GetRandom.Object <CashObject>();
            var v = PaymentViewModelFactory.Create(o) as CashViewModel;

            Assert.IsNotNull(v);
            Assert.AreEqual(v.ID, o.DbRecord.ID);
            Assert.AreEqual(v.ValidFrom, o.DbRecord.ValidFrom);
            Assert.AreEqual(v.ValidTo, o.DbRecord.ValidTo);
            Assert.AreEqual(v.Amount, o.DbRecord.Amount);
            Assert.AreEqual(v.Currency, o.DbRecord.Currency);
            Assert.AreEqual(v.Memo, o.DbRecord.Memo);
            Assert.AreEqual(v.Payee, o.DbRecord.Payee);
            Assert.AreEqual(v.PayeeAccountNumber, o.DbRecord.PayeeAccountNumber);
            Assert.AreEqual(v.Payer, o.DbRecord.Payer);
            Assert.AreEqual(v.PayerAccountNumber, o.DbRecord.PayerAccountNumber);
        }
Example #5
0
        public void CreateDebitCardTest()
        {
            var o = GetRandom.Object <DebitCardObject>();
            var v = PaymentViewModelFactory.Create(o) as DebitCardViewModel;

            Assert.IsNotNull(v);
            Assert.AreEqual(v.ID, o.DbRecord.ID);
            Assert.AreEqual(v.ValidFrom, o.DbRecord.ValidFrom);
            Assert.AreEqual(v.ValidTo, o.DbRecord.ValidTo);
            Assert.AreEqual(v.Amount, o.DbRecord.Amount);
            Assert.AreEqual(v.Currency, o.DbRecord.Currency);
            Assert.AreEqual(v.Memo, o.DbRecord.Memo);
            Assert.AreEqual(v.Payee, o.DbRecord.Payee);
            Assert.AreEqual(v.PayeeAccountNumber, o.DbRecord.PayeeAccountNumber);
            Assert.AreEqual(v.Payer, o.DbRecord.Payer);
            Assert.AreEqual(v.PayerAccountNumber, o.DbRecord.PayerAccountNumber);
            Assert.AreEqual(v.CardAssociationName, o.DbRecord.CardAssociationName);
            Assert.AreEqual(v.CardNumber, o.DbRecord.CardNumber);
            Assert.AreEqual(v.DailyWithdrawalLimit, o.DbRecord.DailyWithDrawalLimit);
        }
Example #6
0
        public async Task <IActionResult> EditDebitCard(string id)
        {
            var payment = await payments.GetObject(id);

            return(View(PaymentViewModelFactory.Create(payment) as DebitCardViewModel));
        }