Ejemplo n.º 1
0
        public static void ProcessPayment(Card fromAccount, Payment payment, decimal valueToPay)
        {
            if (fromAccount == null || valueToPay < 0)
            {
                throw new Exception("Error while processing payment");
            }

            payment.FromAccount = fromAccount;
            payment.TotalAmount = valueToPay;
            payment.PaymentDate = DateTime.Now;

            //Doing transaction.
            PaymentDAL.Instance.PerformTransaction(payment);
        }
Ejemplo n.º 2
0
        public static void ProcessPayment(Card fromAccount, Card toAccount, decimal valueToPay, string personalNumber)
        {
            if (fromAccount == null || toAccount == null || valueToPay < 0)
            {
                throw new Exception("Error while processing payment");
            }

            Payment payment = new Payment();
            payment.Currency = fromAccount.Currency;
            payment.FromAccount = fromAccount;
            payment.PaymentDate = DateTime.Now;
            payment.ToAccount = toAccount;
            payment.TotalAmount = Math.Round(valueToPay, 5);
            payment.PersonalInformation = personalNumber;

            //Doing transaction.
            PaymentDAL.Instance.PerformTransaction(payment);
        }