2026-02-13 21:32:49 -06:00
|
|
|
namespace FiscalOS.API.Institutions.GetAvailable;
|
|
|
|
|
|
|
|
|
|
internal sealed record Response
|
|
|
|
|
{
|
2026-02-24 06:51:55 -06:00
|
|
|
public IEnumerable<AvailableAccountDto> Accounts { get; init; } = [];
|
2026-02-13 21:32:49 -06:00
|
|
|
|
|
|
|
|
[JsonConstructor]
|
|
|
|
|
private Response()
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2026-02-24 06:51:55 -06:00
|
|
|
public static Response From(IEnumerable<AvailableAccountDto> accounts)
|
2026-02-13 21:32:49 -06:00
|
|
|
{
|
|
|
|
|
return new Response
|
|
|
|
|
{
|
|
|
|
|
Accounts = accounts
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2026-02-24 06:51:55 -06:00
|
|
|
internal sealed record AvailableAccountDto
|
2026-02-13 21:32:49 -06:00
|
|
|
{
|
2026-02-24 06:51:55 -06:00
|
|
|
public string ProviderInstitutionId { get; init; } = string.Empty;
|
2026-02-13 21:32:49 -06:00
|
|
|
public string ProviderId { get; init; } = string.Empty;
|
|
|
|
|
public string ProviderName { get; init; } = string.Empty;
|
2026-02-14 06:19:19 -06:00
|
|
|
public decimal CurrentBalance { get; init; }
|
|
|
|
|
public decimal AvailableBalance { get; init; }
|
|
|
|
|
public string CurrencyCode { get; init; } = string.Empty;
|
2026-02-13 21:32:49 -06:00
|
|
|
|
|
|
|
|
[JsonConstructor]
|
2026-02-24 06:51:55 -06:00
|
|
|
private AvailableAccountDto()
|
2026-02-13 21:32:49 -06:00
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2026-02-24 06:51:55 -06:00
|
|
|
public static AvailableAccountDto From(
|
|
|
|
|
PlaidMetadata plaidMetadata,
|
|
|
|
|
Going.Plaid.Entity.Account plaidAccount
|
|
|
|
|
)
|
2026-02-13 21:32:49 -06:00
|
|
|
{
|
2026-02-24 06:51:55 -06:00
|
|
|
return new AvailableAccountDto
|
2026-02-13 21:32:49 -06:00
|
|
|
{
|
2026-02-24 06:51:55 -06:00
|
|
|
ProviderInstitutionId = plaidMetadata.PlaidId,
|
2026-02-13 21:32:49 -06:00
|
|
|
ProviderId = plaidAccount.AccountId,
|
2026-02-14 06:19:19 -06:00
|
|
|
ProviderName = plaidAccount.Name,
|
|
|
|
|
AvailableBalance = plaidAccount.Available,
|
|
|
|
|
CurrentBalance = plaidAccount.Current,
|
|
|
|
|
CurrencyCode = plaidAccount.CurrencyCode,
|
2026-02-13 21:32:49 -06:00
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
}
|