private async Task <DigitalAccountTransactionModel> CreateTransactionAsync(DigitalAccountTransactionModel transaction, TransactionTypeEnum type, TransactionOperationEnum operation, int customerRecipientId, int?customerSenderId) { DigitalAccountTransactionModel newTransaction = new DigitalAccountTransactionModel() { Value = transaction.Value, DigitalAccountId = customerRecipientId, DigitalAccountSenderId = customerSenderId, Type = type, Operation = operation, Status = TransactionStatusEnum.Pending }; transaction = await InsertAsync(newTransaction); return(transaction); }
private async Task <DigitalAccountTransactionModel> ProcessCustomerSenderTransactionAsync(DigitalAccountTransactionModel transaction, TransactionOperationEnum operation, DigitalAccountModel digitalAccountSender) { await CheckExceededLimitTransctionAsync(transaction.Value, digitalAccountSender.TransferLimitTransaction); await ValidTransactionIfAccountSenderAndRecipientEqualsAsync(transaction.DigitalAccountSender.Id, transaction.DigitalAccount.Id); await CheckExceededDigitalAccountDailyLimitTransctionAsync(transaction.DigitalAccountSender.Id, transaction.Value, digitalAccountSender); DigitalAccountTransactionModel transactionSender = await CreateTransactionAsync(transaction, TransactionTypeEnum.Output, operation, transaction.DigitalAccountSender.Id, transaction.DigitalAccount.Id); return(transactionSender); }