Skip to content

Commit

Permalink
fix: update TransactionId to be an optional property on pending trans…
Browse files Browse the repository at this point in the history
…actions
  • Loading branch information
itisNathaniel authored and VMelnalksnis committed Feb 26, 2023
1 parent 33096ff commit 96dd28d
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ namespace VMelnalksnis.NordigenDotNet.Accounts;
/// <summary>A transaction that has been booked - posted to an account on the account servicer's books.</summary>
public record BookedTransaction : Transaction
{
/// <summary>Gets or sets a unique transaction id created by the <see cref="Institution"/>.</summary>
public string TransactionId { get; set; } = null!;

/// <summary>Gets or sets the date when an entry is posted to an account on the account servicer's books.</summary>
public LocalDate BookingDate { get; set; }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,13 @@
// Licensed under the Apache License 2.0.
// See LICENSE file in the project root for full license information.

using VMelnalksnis.NordigenDotNet.Institutions;

namespace VMelnalksnis.NordigenDotNet.Accounts;

/// <summary>A transaction that is still pending.</summary>
public record PendingTransaction : Transaction;
public record PendingTransaction : Transaction
{
/// <summary>Gets or sets a unique transaction id created by the <see cref="Institution"/>.</summary>
public string? TransactionId { get; set; } = null!;
}
5 changes: 0 additions & 5 deletions source/VMelnalksnis.NordigenDotNet/Accounts/Transaction.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,11 @@

using NodaTime;

using VMelnalksnis.NordigenDotNet.Institutions;

namespace VMelnalksnis.NordigenDotNet.Accounts;

/// <summary>Common information for all transactions.</summary>
public abstract record Transaction
{
/// <summary>Gets or sets a unique transaction id created by the <see cref="Institution"/>.</summary>
public string TransactionId { get; set; } = null!;

/// <summary>Gets or sets the amount transferred in this transaction.</summary>
public AmountInCurrency TransactionAmount { get; set; } = null!;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ public async Task GetTransactions_ShouldReturnExpected()
pendingTransaction.TransactionAmount.Amount.Should().Be(10m);
pendingTransaction.UnstructuredInformation.Should().Be("Reserved PAYMENT Emperor's Burgers");
pendingTransaction.ValueDate.Should().Be(currentDate - Period.FromDays(2));
pendingTransaction.TransactionId.Should().BeNull();

var date = currentDate - Period.FromDays(1);
var transactionId = $"{date:yyyyMMdd}01927908-1";
Expand Down

0 comments on commit 96dd28d

Please sign in to comment.