Skip to content

Commit

Permalink
feat(InvestmentTransactions): deprecate investment.transactions field…
Browse files Browse the repository at this point in the history
… and add new endpoint to get InvestmentTransactions. (#21)
  • Loading branch information
NicolasMontone authored May 9, 2023
1 parent d42e17d commit 95286e4
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
1 change: 1 addition & 0 deletions Pluggy.SDK/Model/Investment.cs
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ public class Investment
[JsonProperty("institution")]
public InvestmentInstitution Institution { get; set; }

[Obsolete("Use method client.FetchInvestmentTransactions(investmentId, TransactionParameters) instead, this field is null unless the application was created before 2023-03-21", false)]
[JsonProperty("transactions")]
public List<InvestmentTransaction> Transactions { get; set; }

Expand Down
12 changes: 12 additions & 0 deletions Pluggy.SDK/PluggyAPI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ public class PluggyAPI
protected static readonly string URL_ITEMS_MFA = "/items/{id}/mfa";
protected static readonly string URL_CONNECT_TOKEN = "/connect_token";
protected static readonly string URL_INCOME_REPORT = "/income-reports";
protected static readonly string URL_INVESTMENT_TRANSACTIONS = "/investments/{id}/transactions";

public static readonly int STATUS_POLL_INTERVAL = 3000;

Expand Down Expand Up @@ -382,6 +383,17 @@ public async Task<PageResults<IncomeReport>> FetchIncomeReports(Guid itemId)
return await httpService.GetAsync<PageResults<IncomeReport>>(URL_INCOME_REPORT, null, queryStrings);
}

/// <summary>
/// Fetch the list of investment transactions
/// </summary>
/// <param name="id">Investment Id</param>
/// <returns>InvestmentTrasnsactions results list</returns>
public async Task<PageResults<InvestmentTransaction>> FetchInvestmentTransactions(Guid id, TransactionParameters pageParams = null)
{
var queryStrings = pageParams != null ? pageParams.ToQueryStrings() : new Dictionary<string, string>();
return await httpService.GetAsync<PageResults<InvestmentTransaction>>(URL_INVESTMENT_TRANSACTIONS, HTTP.Utils.GetSegment(id.ToString()), queryStrings);
}

/// <summary>
/// Creates a "ConnectToken" that provides an "AccessToken" for client-side communication.
/// </summary>
Expand Down

0 comments on commit 95286e4

Please sign in to comment.