Adds code
This commit is contained in:
commit
fbc41da444
15 changed files with 208 additions and 0 deletions
40
FinTSTest/Program.cs
Normal file
40
FinTSTest/Program.cs
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
// See https://aka.ms/new-console-template for more information
|
||||
|
||||
using libfintx.FinTS;
|
||||
using libfintx.FinTS.Data;
|
||||
using libfintx.Swift;
|
||||
|
||||
FinTsClient client = new FinTsClient(
|
||||
new ConnectionDetails()
|
||||
{
|
||||
Url = Environment.GetEnvironmentVariable("FINTS_URL"),
|
||||
UserId = Environment.GetEnvironmentVariable("FINTS_USER"),
|
||||
Pin = Environment.GetEnvironmentVariable("FINTS_PASS"),
|
||||
Blz = int.Parse(Environment.GetEnvironmentVariable("FINTS_BLZ") ?? "0"),
|
||||
CustomerSystemId = Environment.GetEnvironmentVariable("FINTS_CUSTOMER_ID"),
|
||||
Bic = Environment.GetEnvironmentVariable("FINTS_BIC")
|
||||
}
|
||||
);
|
||||
// The initial syncronization is important, otherwise you don't get any data, when using the "CustomerSystemId".
|
||||
await client.Synchronization();
|
||||
|
||||
// Only supports PushTAN
|
||||
TANDialog dialog = new TANDialog(tanDialog => Task.FromResult(""));
|
||||
|
||||
HBCIDialogResult<List<AccountInformation>>? data = await client.Accounts(dialog);
|
||||
|
||||
if (!data.IsSuccess)
|
||||
{
|
||||
Console.WriteLine("Failed to get the account information!");
|
||||
Environment.Exit(1);
|
||||
}
|
||||
|
||||
foreach (AccountInformation accountInformation in data.Data)
|
||||
{
|
||||
client.activeAccount = accountInformation;
|
||||
HBCIDialogResult<AccountBalance> balance = await client.Balance(dialog);
|
||||
// This takes a while... so use some worker or other asynchronous system to gather transactions
|
||||
HBCIDialogResult<List<SwiftStatement>> transactions = await client.Transactions(dialog, DateTime.Today.Subtract(new TimeSpan(1)), DateTime.Now);
|
||||
|
||||
Console.WriteLine($"{accountInformation.AccountType} - {balance.Data.Balance}");
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue