static void Main(string[] args) { string key = "l73dc43920d81245ec9dc9ec4bccce51b8"; Swedbank swedbank = new Swedbank(key); var res0 = swedbank.Consent.Create(new CreateConsentReq()).Result; Console.WriteLine(res0.Content); var consentId = res0.Data.ConsentId; var res1 = swedbank.Consent.GetDetails(consentId).Result; Console.WriteLine(res1.Content); var res2 = swedbank.Consent.StartAuthProcess(consentId).Result; var authId = res2.Data.AuthorisationId; Console.WriteLine(res2.Content); Console.WriteLine(authId); var res3 = swedbank.Consent.GetAuthProcesStatus(consentId, authId).Result; Console.WriteLine(res3.Content); SetStrongAuthMethodReq req0 = new SetStrongAuthMethodReq(); req0.AuthenticationMethodId = "MOBILE_ID"; req0.PsuData = new PsuData() { PersonalId = "199506178855", PhoneNumber = "0737243272" }; var res4 = swedbank.Consent.SetStrongCustomerAuthMethod(consentId, authId, req0).Result; Console.WriteLine(res4.Content); var res5 = swedbank.Consent.GetStatus(consentId).Result; Console.WriteLine(res5.Content); var res6 = swedbank.Consent.GetAuthProcesStatus(consentId, authId).Result; Console.WriteLine(res3.Content); while (true) { } }
public async Task RunAsync() { Console.Write("Personal ID number: "); long idnumber = Convert.ToInt64(Console.ReadLine()); SwedbankLogin client = new SwedbankLogin(BankType.Swedbank); await client.InitializeMobileBankIdLoginAsync(idnumber); bool loggedIn = false; Swedbank loggedInClient = null; while (!loggedIn) { await Task.Delay(TimeSpan.FromSeconds(5)); Console.WriteLine("Waiting for bankid..."); var status = await client.VerifyLoginAsync(); loggedIn = status.LoggedIn; loggedInClient = status.Swedbank; } Console.WriteLine("\nRetrieving list of profiles..."); var profile = await loggedInClient.GetProfileAsync(); var privateProfileId = profile.Banks.First().PrivateProfile.Id; //Assume we have a private profile. await loggedInClient.SetProfileForSessionAsync(privateProfileId); var accounts = await loggedInClient.GetAccountListAsync(); List <SwedbankCore.JsonSchemas.BankAccount> bankAccounts = new List <SwedbankCore.JsonSchemas.BankAccount>(); bankAccounts.AddRange(accounts.TransactionAccounts); bankAccounts.AddRange(accounts.SavingAccounts); bankAccounts.AddRange(accounts.CardAccounts); int i = 1; foreach (SwedbankCore.JsonSchemas.BankAccount ta in bankAccounts) { Console.WriteLine(i + ". " + ta.Name); i++; } Console.Write("Choose account: "); int no = ReadKey(); var selectedAccount = bankAccounts[no - 1]; Console.WriteLine("\nRetrieving account details..."); var transactionList = await loggedInClient.GetAccountTransactionListAsync(selectedAccount.Id); Console.WriteLine("Account Name: " + transactionList.Account.Name); Console.WriteLine("Account Balance: " + transactionList.Account.Balance + transactionList.Account.Currency); await loggedInClient.TerminateAsync(); Console.WriteLine("\nPress any key to exit..."); Console.ReadKey(); }