예제 #1
0
        public Invoice CreateInvoice(int customerId, int companyId, double amount)
        {
            if (amount < 0)
            {
                throw new Exception("Invalid amount.");
            }

            var customer = _customerService.FindCustomerById(customerId);

            var company = _companyService.FindCompanyById(companyId);

            var taxes = new List <ITax>
            {
                new IRPJ(),
                new PIS(),
                new COFINS(),
                new CSLL()
            };

            var invoice = new Invoice(customer, company, amount, taxes);

            _invoiceRepository.Save(invoice);

            return(invoice);
        }