Fix some naming
This commit is contained in:
@@ -4,9 +4,8 @@ namespace FinancialApi.Domain.Entities;
|
||||
|
||||
public enum AccountType
|
||||
{
|
||||
Liability,
|
||||
Debit,
|
||||
Credit,
|
||||
Spend,
|
||||
Borrow,
|
||||
Revenue
|
||||
}
|
||||
|
||||
@@ -17,8 +16,8 @@ public record Account
|
||||
this.Id = Id;
|
||||
this.Balance = Balance;
|
||||
this.Type = Type;
|
||||
|
||||
if (Balance < 0 && Type is AccountType.Liability or AccountType.Debit or AccountType.Revenue)
|
||||
|
||||
if (Balance < 0 && Type is AccountType.Spend or AccountType.Revenue)
|
||||
{
|
||||
throw new InvalidStartingBalanceException("Insufficient funds.");
|
||||
}
|
||||
@@ -33,7 +32,7 @@ public record Account
|
||||
|
||||
var newBalance = entryType == EntryType.Credit ? Balance + amount : Balance - amount;
|
||||
|
||||
if (newBalance < 0 && Type is AccountType.Liability or AccountType.Debit or AccountType.Revenue)
|
||||
if (newBalance < 0 && Type is AccountType.Spend or AccountType.Revenue)
|
||||
{
|
||||
throw new InsufficientFundsException("Insufficient funds.");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user