public async Task StoreEmissionAsync(string period, string user, string reason, AccountWithAmount awa) { await _storeOp.StoreAsync(period, user, reason, new List <AccountWithAmount> { new AccountWithAmount(new Account(Constants.CashAccount, awa.Account.Currency), -awa.Amount), awa }); }
public async Task <JournalRecord> StoreAsync(OperationDescription op, AccountWithAmount rec) { var jr = new JournalRecord { Amount = rec.Amount, Currency = rec.Account.Currency, Id = ObjectId.GenerateNewId().ToString(), Period = op.Period, UserId = rec.Account.UserId, OperationId = op.Id, CreatedOn = DateTime.Now }; await _ms.Journal.InsertOneAsync(jr); _logger.LogInformation( "New Journal Record for {Operation} on {Period} for {Account} with {Amount} of {Currency}", op.Id, op.Period, rec.Account.UserId, rec.Amount, rec.Account.Currency); return(jr); }