diff --git a/src/RobinTTY.NordigenApiClient.Tests/Endpoints/AccountsEndpointTests.cs b/src/RobinTTY.NordigenApiClient.Tests/Endpoints/AccountsEndpointTests.cs index af10424..ce2d5c9 100644 --- a/src/RobinTTY.NordigenApiClient.Tests/Endpoints/AccountsEndpointTests.cs +++ b/src/RobinTTY.NordigenApiClient.Tests/Endpoints/AccountsEndpointTests.cs @@ -96,7 +96,7 @@ public async Task GetTransactions() matchesAll &= t.TransactionAmount.Currency == "EUR"; return matchesAll; })); - Assert.That(transactions.PendingTransactions, Has.Count.EqualTo(1)); + Assert.That(transactions.PendingTransactions, Has.Count.GreaterThanOrEqualTo(1)); }); } diff --git a/src/RobinTTY.NordigenApiClient.Tests/Serialization/TransactionTests.cs b/src/RobinTTY.NordigenApiClient.Tests/Serialization/TransactionTests.cs index a62d28e..291e11f 100644 --- a/src/RobinTTY.NordigenApiClient.Tests/Serialization/TransactionTests.cs +++ b/src/RobinTTY.NordigenApiClient.Tests/Serialization/TransactionTests.cs @@ -16,7 +16,8 @@ internal class TransactionTests public void DeserializeTransaction() { const string json = - "{ \"transactionId\": \"AB123456789\", \"entryReference\": \"123456789\", \"bookingDate\": \"2023-03-20\", \"bookingDateTime\": \"2023-03-20T00:00:00+00:00\", \"transactionAmount\": { \"amount\": \"-33.06\", \"currency\": \"GBP\" }, \"currencyExchange\": { \"sourceCurrency\": \"USD\", \"exchangeRate\": \"1.20961887\", \"unitCurrency\": \"GBP\", \"targetCurrency\": \"GBP\" }, \"remittanceInformationUnstructured\": \"my reference here\", \"additionalInformation\": \"123456789\", \"proprietaryBankTransactionCode\": \"OTHER_PURCHASE\", \"merchantCategoryCode\": \"5045\", \"internalTransactionId\": \"abcdef\" }"; + "{ \"transactionId\": \"AB123456789\", \"entryReference\": \"123456789\", \"bookingDate\": \"2023-03-20\", \"bookingDateTime\": \"2023-03-20T00:00:00+00:00\", \"transactionAmount\": { \"amount\": \"-33.06\", \"currency\": \"GBP\" }, \"currencyExchange\":[{\"sourceCurrency\":\"USD\",\"exchangeRate\":\"1.20961887\",\"unitCurrency\":\"USD\",\"targetCurrency\":\"GBP\"}], \"remittanceInformationUnstructured\": \"my reference here\", \"additionalInformation\": \"123456789\", \"proprietaryBankTransactionCode\": \"OTHER_PURCHASE\", \"merchantCategoryCode\": \"5045\", \"internalTransactionId\": \"abcdef\" }"; + // We need the culture specific decimal converter here, since it it accepting strings var options = new JsonSerializerOptions { @@ -26,11 +27,11 @@ public void DeserializeTransaction() Assert.Multiple(() => { Assert.That(transaction!.CurrencyExchange, Is.Not.Null); - Assert.That(transaction.CurrencyExchange!.ExchangeRate, Is.EqualTo(1.20961887)); - Assert.That(transaction.CurrencyExchange!.SourceCurrency, Is.EqualTo("USD")); - Assert.That(transaction.CurrencyExchange!.TargetCurrency, Is.EqualTo("GBP")); - Assert.That(transaction.CurrencyExchange!.UnitCurrency, Is.EqualTo("GBP")); - Assert.That(transaction.CurrencyExchange!.QuotationDate, Is.Null); + Assert.That(transaction.CurrencyExchange!.First().ExchangeRate, Is.EqualTo(1.20961887)); + Assert.That(transaction.CurrencyExchange!.First().SourceCurrency, Is.EqualTo("USD")); + Assert.That(transaction.CurrencyExchange!.First().TargetCurrency, Is.EqualTo("GBP")); + Assert.That(transaction.CurrencyExchange!.First().UnitCurrency, Is.EqualTo("USD")); + Assert.That(transaction.CurrencyExchange!.First().QuotationDate, Is.Null); }); } diff --git a/src/RobinTTY.NordigenApiClient/Models/Responses/Transaction.cs b/src/RobinTTY.NordigenApiClient/Models/Responses/Transaction.cs index 46d03c0..907afbe 100644 --- a/src/RobinTTY.NordigenApiClient/Models/Responses/Transaction.cs +++ b/src/RobinTTY.NordigenApiClient/Models/Responses/Transaction.cs @@ -218,7 +218,7 @@ public class Transaction /// Array of the report exchange rate. /// [JsonPropertyName("currencyExchange")] - public CurrencyExchange? CurrencyExchange { get; } + public IEnumerable? CurrencyExchange { get; } /// /// The identification of the transaction as used for reference by the financial institution. @@ -343,7 +343,7 @@ public Transaction(string? transactionId, string? debtorName, MinimalBankAccount DateTime? valueDateTime, string? remittanceInformationStructured, IEnumerable? remittanceInformationStructuredArray, string? additionalInformation, string? additionalInformationStructured, Balance? balanceAfterTransaction, string? checkId, - CurrencyExchange? currencyExchange, string? entryReference, string? internalTransactionId, + IEnumerable? currencyExchange, string? entryReference, string? internalTransactionId, string? merchantCategoryCode, DateTime? bookingDateTime) { TransactionId = transactionId; diff --git a/src/RobinTTY.NordigenApiClient/RobinTTY.NordigenApiClient.csproj b/src/RobinTTY.NordigenApiClient/RobinTTY.NordigenApiClient.csproj index 3442670..337fa1d 100644 --- a/src/RobinTTY.NordigenApiClient/RobinTTY.NordigenApiClient.csproj +++ b/src/RobinTTY.NordigenApiClient/RobinTTY.NordigenApiClient.csproj @@ -16,7 +16,7 @@ Nordigen; API; client $([System.IO.File]::ReadAllText("$(MSBuildProjectDirectory)/release-notes.txt")) MIT - 6.1.1 + 6.1.2 true snupkg diff --git a/src/RobinTTY.NordigenApiClient/release-notes.txt b/src/RobinTTY.NordigenApiClient/release-notes.txt index 714d0f7..6cbe22b 100644 --- a/src/RobinTTY.NordigenApiClient/release-notes.txt +++ b/src/RobinTTY.NordigenApiClient/release-notes.txt @@ -1,2 +1 @@ -Improved package size and documentation. -Fixed balance type enum conversion and test. +Fixed CurrencyExchange deserialization.