public void PayBill(Invoice invoiceContainingTheBill, Bill billToPay, Payment payment) { billToPay.PayBill(payment); CheckIfAgreementIsAccomplished(invoiceContainingTheBill, billToPay); invoiceContainingTheBill.CheckIfInvoiceIsFullPaid(); }
public void WhenPayingABillTheBillPaymentDateIsStored() { Bill bill = new Bill("MMM201300015/001", "An easy to pay bill", 1, DateTime.Now, DateTime.Now.AddYears(10)); CashPaymentMethod cashPayment = new CashPaymentMethod(); DateTime paymentDate = new DateTime(2013, 11, 11); Payment payment = new Payment(bill.Amount, paymentDate, cashPayment); bill.PayBill(payment); Assert.AreEqual(paymentDate, bill.Payment.PaymentDate); }
public void WhenABillIsPaidByBankTransferTheTransferorAndTheTransfereeAccountsAreStored() { Bill bill = new Bill("MMM201300015/001", "An easy to pay bill", 1, DateTime.Now, DateTime.Now.AddYears(10)); BankAccount transferorAccount = new BankAccount(new ClientAccountCodeCCC("20381111401111111111")); BankAccount transfereeAccount = new BankAccount(new ClientAccountCodeCCC("21001111301111111111")); BankTransferPaymentMethod bankTransferPaymentMethod = new BankTransferPaymentMethod(transferorAccount, transfereeAccount); DateTime paymentDate = new DateTime(2013, 11, 11); Payment payment = new Payment(bill.Amount, paymentDate, bankTransferPaymentMethod); bill.PayBill(payment); Assert.AreEqual(transferorAccount, ((BankTransferPaymentMethod)bill.Payment.PaymentMethod).TransferorAccount); Assert.AreEqual(transfereeAccount, ((BankTransferPaymentMethod)bill.Payment.PaymentMethod).TransfereeAccount); }
public void WhenABillIsPaidByDirectDebitTheDebtorAccountAndTheDirectDebitTransactionPaymentIdentificartionAreStored() { Bill bill = new Bill("MMM201300015/001", "An easy to pay bill", 1, DateTime.Now, DateTime.Now.AddYears(10)); int internalReferenceNumber = 2645; BankAccount bankAccount = new BankAccount(new ClientAccountCodeCCC("12345678061234567890")); DateTime directDebitMandateCreationDate = new DateTime(2013, 11, 11); DirectDebitMandate directDebitMandate = new DirectDebitMandate(internalReferenceNumber, directDebitMandateCreationDate, bankAccount, "NoName"); string directDebitTransactionPaymentIdentification = "201311110000123456"; DirectDebitPaymentMethod directDebitTransfermethod = new DirectDebitPaymentMethod(directDebitMandate, directDebitTransactionPaymentIdentification); DateTime paymentDate = new DateTime(2013, 11, 11); Payment payment = new Payment(bill.Amount, paymentDate, directDebitTransfermethod); bill.PayBill(payment); Assert.AreEqual("12345678061234567890", ((DirectDebitPaymentMethod)bill.Payment.PaymentMethod).DirectDebitMandate.BankAccount.CCC.CCC); Assert.AreEqual("201311110000123456", ((DirectDebitPaymentMethod)bill.Payment.PaymentMethod).DDTXPaymentIdentification); }
public void OnlyPaymentsForTheTotalBillAmoutAreAccepted() { Bill bill = new Bill("MMM201300015/001", "An easy to pay bill", 1, DateTime.Now, DateTime.Now.AddYears(10)); CashPaymentMethod cashPaymentMethod = new CashPaymentMethod(); DateTime paymentDate = new DateTime(2013, 11, 11); Payment payment = new Payment((decimal)2, paymentDate, cashPaymentMethod); try { bill.PayBill(payment); } catch (ArgumentException exception) { Assert.AreEqual("Only payments for the bill total amount are accepted", exception.GetMessageWithoutParamName()); throw exception; } }