public void Pay(decimal amount, string customerId, string orderId, string paymentMethod)
        {
            switch (paymentMethod)
            {
            case "check":
                var checkTransaction = PaymentTransaction.With(paymentMethod, amount, orderId);
                _transactionRepo.Save(checkTransaction);
                break;

            case "card":
                _paymentProvider.AuthorisePayment(amount, orderId, paymentMethod, customerId);

                var cardTransaction = PaymentTransaction.With(paymentMethod, amount, orderId);
                _transactionRepo.Save(cardTransaction);
                break;

            case "direct-debit":
                _paymentProvider.AuthorisePayment(amount, orderId, paymentMethod, customerId);

                var directDebitTransaction = PaymentTransaction.With(paymentMethod, amount, orderId);
                _transactionRepo.Save(directDebitTransaction);
                break;
            }

            var orderConfirmationEmail = _emailGateway.NewEmailFor(orderId, customerId, paymentMethod);

            _emailGateway.Send(orderConfirmationEmail);
        }
示例#2
0
        public void save_deposit()
        {
            _repo.Save(new Deposit(100, "2012/03/12"));

            _transactions = _repo.Statement();

            Assert.That(_transactions.Count(), Is.Not.Zero);
        }
示例#3
0
 public void Deposit(decimal amount, string date)
 {
     _transactionRepo.Save(new Deposit(amount, date));
 }