Skip to content

Commit

Permalink
Add default constructor for Transaction.cs
Browse files Browse the repository at this point in the history
  • Loading branch information
RobinTTY committed Oct 31, 2024
1 parent c456f68 commit 3d17715
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,23 +32,36 @@ public class Transaction
/// <summary>
/// The currency the amount is denominated in.
/// </summary>
public string Currency { get; set ; }
public string Currency { get; set; }
/// <summary>
/// The category this transaction belongs to.
/// </summary>
// TODO: Shouldn't this be nullable?
public string Category { get; set; }
/// <summary>
/// Tags associated with the transaction (to associate expenses with certain sub-categories).
/// </summary>
public List<Tag> Tags { get; set; }
/// <summary>
/// User created notes for this transaction.
/// </summary>
// TODO: Shouldn't this be nullable?
public string Notes { get; set; }
/// <summary>
/// Tags associated with the transaction (to associate expenses with certain sub-categories).
/// </summary>
public List<Tag> Tags { get; set; }

// TODO: Information provided by your bank (e.g. SEPA mandate ids)
// how should I best handle this?
public Transaction(){}
// TODO: default values
public Transaction()
{
Id = string.Empty;
AccountId = string.Empty;
ValueDate = null;
Payer = null;
Payee = null;
Amount = decimal.MinValue;
Currency = string.Empty;
Category = string.Empty;
Notes = string.Empty;
Tags = [];
}

/// <summary>
/// Creates a new instance of <see cref="Transaction"/>.
Expand All @@ -61,9 +74,10 @@ public Transaction(){}
/// <param name="amount">The amount being transacted.</param>
/// <param name="currency">The currency the amount is denominated in.</param>
/// <param name="category">The category this transaction belongs to.</param>
/// <param name="tags">Tags associated with the transaction (to associate expenses with certain sub-categories).</param>
/// <param name="notes">User created notes for this transaction.</param>
public Transaction(string id, string accountId, DateTime? valueDate, string payer, string payee, decimal amount, string currency, string category, List<Tag> tags, string notes)
/// <param name="tags">Tags associated with the transaction (to associate expenses with certain sub-categories).</param>
public Transaction(string id, string accountId, DateTime? valueDate, string payer, string payee, decimal amount,
string currency, string category, string notes, List<Tag> tags)
{
Id = id;
ValueDate = valueDate;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ public async Task<ThirdPartyResponse<IEnumerable<Transaction>, AccountsError>> G
transaction.ValueDateTime ?? transaction.ValueDate,
transaction.CreditorName, transaction.DebtorName, transaction.TransactionAmount.Amount,
transaction.TransactionAmount.Currency,
"example-category", new List<Tag>(), "example-notes")
"example-category", "example-notes", [])
);
return new ThirdPartyResponse<IEnumerable<Transaction>, AccountsError>(response.IsSuccess, transactions,
response.Error);
Expand Down

0 comments on commit 3d17715

Please sign in to comment.