public ExpenseClaim CreateExpenseClaimFrom(ExpenseClaimInput expenseInput)
        {
            var expenseClaimDate = _validator.Validate(expenseInput.Date);

            _logger.LogInformation("Date has been successfully validated");
            var expenseClaim = new ExpenseClaim(expenseInput.CostCentre, expenseInput.Total, expenseInput.PaymentMethod)
            {
                Vendor = expenseInput.Vendor, Date = expenseClaimDate, Description = expenseInput.Description
            };

            _logger.LogInformation("Expense Claim successfully created.");
            return(expenseClaim);
        }
Esempio n. 2
0
        private ExpenseClaimResult BuildExpenseClaimResult(ExpenseClaimInput expenseClaimInput)
        {
            var expenseClaim = _expenseClaimFactory.CreateExpenseClaimFrom(expenseClaimInput);

            _logger.LogInformation("Successfully built expense claim");
            return(new ExpenseClaimResult
            {
                CostCentre = expenseClaim.Expense.CostCentre, Date = expenseClaim.Date,
                Description = expenseClaim.Description, GstAmount = expenseClaim.Expense.GstAmount,
                PaymentMethod = expenseClaim.Expense.PaymentMethod,
                TotalExcludingGst = expenseClaim.Expense.TotalExcludingGst,
                TotalIncludingGst = expenseClaim.Expense.Total, Vendor = expenseClaim.Vendor
            });
        }