Skip to content

Commit

Permalink
[Server] Update dependencies and related code
Browse files Browse the repository at this point in the history
  • Loading branch information
RobinTTY committed May 28, 2024
1 parent 0062675 commit 0c988cd
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,21 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Bogus" Version="34.0.2" />
<PackageReference Include="HotChocolate.AspNetCore" Version="13.6.0-preview.31" />
<PackageReference Include="HotChocolate.Data.EntityFramework" Version="13.6.0-preview.31" />
<PackageReference Include="HotChocolate.Types.Analyzers" Version="13.6.0-preview.31">
<PackageReference Include="Bogus" Version="35.5.1" />
<PackageReference Include="HotChocolate.AspNetCore" Version="13.9.4" />
<PackageReference Include="HotChocolate.Data.EntityFramework" Version="13.9.4" />
<PackageReference Include="HotChocolate.Types.Analyzers" Version="13.9.4">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="8.0.0-rc.2.23480.1">
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="8.0.5">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="8.0.0-rc.2.23480.1" />
<PackageReference Include="RobinTTY.NordigenApiClient" Version="6.0.6" />
<PackageReference Include="Serilog" Version="3.0.1" />
<PackageReference Include="Serilog.Sinks.Console" Version="4.1.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="8.0.5" />
<PackageReference Include="RobinTTY.NordigenApiClient" Version="9.0.0" />
<PackageReference Include="Serilog" Version="3.1.1" />
<PackageReference Include="Serilog.Sinks.Console" Version="5.0.1" />
<PackageReference Include="Serilog.Sinks.File" Version="5.0.0" />
</ItemGroup>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="NPOI" Version="2.6.2" />
<PackageReference Include="Npoi.Mapper" Version="6.1.0" />
<PackageReference Include="NPOI" Version="2.7.0" />
<PackageReference Include="Npoi.Mapper" Version="6.2.1" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -24,47 +24,47 @@ public GoCardlessDataProvider(HttpClient httpClient, NordigenClientCredentials c
_client = new NordigenClient(httpClient, credentials);
}

public async Task<ThirdPartyResponse<BankingInstitution?, BasicError>> GetBankingInstitution(string institutionId)
public async Task<ThirdPartyResponse<BankingInstitution?, BasicResponse>> GetBankingInstitution(string institutionId)
{
var response = await _client.InstitutionsEndpoint.GetInstitution(institutionId);
BankingInstitution? result = null;
if(response.IsSuccess)
result = new BankingInstitution(response.Result.Id, response.Result.Bic, response.Result.Name, response.Result.Logo, response.Result.Countries);
return new ThirdPartyResponse<BankingInstitution?, BasicError>(response.IsSuccess, result, response.Error);
return new ThirdPartyResponse<BankingInstitution?, BasicResponse>(response.IsSuccess, result, response.Error);
}

/// <summary>
/// Gets the banking institutions which are available via this data provider.
/// </summary>
/// <param name="country">Optional country filter to apply to the query.</param>
/// <returns>The available banking <see cref="Institution"/>s.</returns>
public async Task<ThirdPartyResponse<IQueryable<BankingInstitution>, InstitutionsError>> GetBankingInstitutions(string? country = null)
public async Task<ThirdPartyResponse<IQueryable<BankingInstitution>, BasicResponse>> GetBankingInstitutions(string? country = null)
{
var response = await _client.InstitutionsEndpoint.GetInstitutions(country);

if (response.IsSuccess)
{
var institutions =
response.Result.Select(inst => new BankingInstitution(inst.Id, inst.Bic, inst.Name, inst.Logo, inst.Countries));
return new ThirdPartyResponse<IQueryable<BankingInstitution>, InstitutionsError>(true, institutions.AsQueryable(), null);
return new ThirdPartyResponse<IQueryable<BankingInstitution>, BasicResponse>(true, institutions.AsQueryable(), null);
}

return new ThirdPartyResponse<IQueryable<BankingInstitution>, InstitutionsError>(false, null, response.Error);
return new ThirdPartyResponse<IQueryable<BankingInstitution>, BasicResponse>(false, null, response.Error);
}

/// <summary>
/// Gets an existing authentication request (requisitions).
/// </summary>
/// <param name="requisitionId">The institutionId of the requisition to be retrieved.</param>
/// <returns>The <see cref="AuthenticationRequest"/> which matches the institutionId, as far as it exists.</returns>
public async Task<ThirdPartyResponse<AuthenticationRequest?, BasicError?>> GetAuthenticationRequest(string requisitionId)
public async Task<ThirdPartyResponse<AuthenticationRequest?, BasicResponse?>> GetAuthenticationRequest(string requisitionId)
{
var response = await _client.RequisitionsEndpoint.GetRequisition(requisitionId);
// TODO: handle request failure
var requisition = response.Result!;
var result = new AuthenticationRequest(requisition.Id.ToString(), requisition.Accounts.Select(guid => guid.ToString()),
ConvertRequisitionStatus(requisition.Status), requisition.AuthenticationLink);
return new ThirdPartyResponse<AuthenticationRequest?, BasicError?>(response.IsSuccess, result, response.Error);
return new ThirdPartyResponse<AuthenticationRequest?, BasicResponse?>(response.IsSuccess, result, response.Error);
}

// TODO: Cancellation token support
Expand All @@ -73,14 +73,14 @@ public async Task<ThirdPartyResponse<IQueryable<BankingInstitution>, Institution
/// </summary>
/// <param name="requisitionLimit">The maximum number of requisitions to get.</param>
/// <returns>All existing <see cref="Requisition"/>s.</returns>
public async Task<ThirdPartyResponse<IQueryable<AuthenticationRequest>, BasicError?>> GetAuthenticationRequests(int requisitionLimit)
public async Task<ThirdPartyResponse<IQueryable<AuthenticationRequest>, BasicResponse?>> GetAuthenticationRequests(int requisitionLimit)
{
var response = await _client.RequisitionsEndpoint.GetRequisitions(requisitionLimit, 0);
// TODO: handle request failure
var requisitions = response.Result!.Results;
var result = requisitions.Select(req => new AuthenticationRequest(req.Id.ToString(),
req.Accounts.Select(guid => guid.ToString()), ConvertRequisitionStatus(req.Status), req.AuthenticationLink)).AsQueryable();
return new ThirdPartyResponse<IQueryable<AuthenticationRequest>, BasicError?>(response.IsSuccess, result, response.Error);
return new ThirdPartyResponse<IQueryable<AuthenticationRequest>, BasicResponse?>(response.IsSuccess, result, response.Error);

}

Expand All @@ -92,8 +92,7 @@ public async Task<ThirdPartyResponse<IQueryable<BankingInstitution>, Institution
/// <returns>The created <see cref="Requisition"/>.</returns>
public async Task<ThirdPartyResponse<AuthenticationRequest, CreateRequisitionError>> CreateAuthenticationRequest(string institutionId, Uri redirectUri)
{
var requisitionRequest = new CreateRequisitionRequest(redirectUri, institutionId, Guid.NewGuid().ToString(), "EN");
var response = await _client.RequisitionsEndpoint.CreateRequisition(requisitionRequest);
var response = await _client.RequisitionsEndpoint.CreateRequisition(institutionId, redirectUri, reference: Guid.NewGuid().ToString());

if (response.IsSuccess)
{
Expand All @@ -106,10 +105,10 @@ public async Task<ThirdPartyResponse<AuthenticationRequest, CreateRequisitionErr
return new ThirdPartyResponse<AuthenticationRequest, CreateRequisitionError>(response.IsSuccess, null, response.Error);
}

public async Task<ThirdPartyResponse<BasicResponse, BasicError>> DeleteAuthenticationRequest(string authenticationId)
public async Task<ThirdPartyResponse<BasicResponse, BasicResponse>> DeleteAuthenticationRequest(string authenticationId)
{
var response = await _client.RequisitionsEndpoint.DeleteRequisition(authenticationId);
return new ThirdPartyResponse<BasicResponse, BasicError>(response.IsSuccess, response.Result, response.Error);
return new ThirdPartyResponse<BasicResponse, BasicResponse>(response.IsSuccess, response.Result, response.Error);
}

public async Task<ThirdPartyResponse<BankAccount, AccountsError>> GetBankAccount(string accountId)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="RobinTTY.NordigenApiClient" Version="6.0.6" />
<PackageReference Include="RobinTTY.NordigenApiClient" Version="9.0.0" />
</ItemGroup>

<ItemGroup>
Expand Down

0 comments on commit 0c988cd

Please sign in to comment.