static async Task <BunqApi> SetupSession(HttpClient httpClient, string apiKey, string privateKeyPem, string serverPublicKey, string installationToken) { var bunqApi = new BunqApi(httpClient, apiKey, privateKeyPem, serverPublicKey, installationToken); await bunqApi.SetupSession(); return(bunqApi); }
static async Task ListPayments(BunqApi bunqApi, long monetaryAccountId) { var payments = await bunqApi.ListPayments(monetaryAccountId); foreach (var payment in payments) { Console.WriteLine($"{payment.id} "); } }
static async Task <MonetaryAccountBank> ListMonetaryAccountBanks(BunqApi bunqApi) { var accounts = await bunqApi.ListMonetaryAccountBanks(); foreach (var account in accounts) { Console.WriteLine($"{account.id} {account.balance.currency} {account.balance.value} {account.status}"); } return(accounts.FirstOrDefault(x => x.status == "ACTIVE")); }
static async Task SendSomeMoney(BunqApi bunqApi, long monetaryAccountId, string value, string iban, string name) { var amount = new Amount { currency = "EUR", value = value }; var counterparty = new Pointer { value = iban, type = "IBAN", name = name }; await bunqApi.Payment(amount, counterparty, "sent you some", monetaryAccountId); }
static async Task GetSomeMoney(BunqApi bunqApi, long monetaryAccountId) { var amount = new Amount { currency = "EUR", value = "500.00" }; // not more than 500 var counterparty = new Pointer { value = "*****@*****.**", type = "EMAIL" }; await bunqApi.RequireInquiry(amount, counterparty, "get me some", monetaryAccountId); await Task.Delay(1000); // give server some time to process }
static async Task SetupDevice(HttpClient httpClient, string apiKey, string privateKeyPem, string serverPublicKey, string installationToken) { var bunqApi = new BunqApi(httpClient, apiKey, privateKeyPem, serverPublicKey, installationToken); await bunqApi.SetupDevice(); }