예제 #1
0
        public async Task <Expense> CreateExpenseWhen(BankTransferAdded notification)
        {
            var expenseRecipient =
                await _expenseRecipientRepository.FindByIban(notification.Iban);

            var expense = _expenseFactory.CreateFrom(ExpenseType.BankTransfer, notification.Value, notification.PaymentDate, expenseRecipient?.ExpenseRecipientId, expenseRecipient?.ExpenseCategoryId, notification.Iban, notification.RecipientName, notification.Details, notification.BankTransferId);

            return(expense);
        }
예제 #2
0
        public async Task <SavingsTransaction> CreateSavingsTransactionWhen(BankTransferAdded notification)
        {
            var isSavingsAccount =
                await _savingsAccountRepository.IsSavingsAccount(notification.Iban);

            if (isSavingsAccount)
            {
                var savingsTransaction = _savingsTransactionFactory.CreateFrom(SavingsTransactionType.BankTransfer, notification.Value, notification.PaymentDate, notification.RecipientName, notification.Details, notification.BankTransferId);
                return(savingsTransaction);
            }

            return(null);
        }