feat(core): add balance model
This commit is contained in:
@@ -8,6 +8,9 @@ public sealed class Account : Entity
|
||||
public string Name { get; init; } = string.Empty;
|
||||
public AccountMetadata? Metadata { get; init; }
|
||||
|
||||
private readonly List<Balance> _balances = [];
|
||||
public IEnumerable<Balance> Balances => _balances;
|
||||
|
||||
public static Account From(Guid institutionId, string name, AccountMetadata accountMetadata)
|
||||
{
|
||||
return new()
|
||||
@@ -17,4 +20,11 @@ public sealed class Account : Entity
|
||||
Metadata = accountMetadata,
|
||||
};
|
||||
}
|
||||
|
||||
public void AddBalance(Balance balance)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(balance);
|
||||
|
||||
_balances.Add(balance);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
namespace FiscalOS.Core.Accounts;
|
||||
|
||||
public sealed class Balance : Entity
|
||||
{
|
||||
public Guid AccountId { get; init; }
|
||||
public decimal Current { get; init; }
|
||||
public decimal Available { get; init; }
|
||||
|
||||
private Balance()
|
||||
{
|
||||
}
|
||||
|
||||
public static Balance From(decimal current, decimal available)
|
||||
{
|
||||
return new()
|
||||
{
|
||||
Current = current,
|
||||
Available = available,
|
||||
};
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user