Example #1
0
        static void GetMinAndMaxDateOfTransactions(ObpRestClient client)
        {
            var accounts = client.GetAccounts();

            foreach (var account in accounts)
            {
                var accountBalance = client.GetAccountByIdCore(account.BankId, account.Id);
                Console.WriteLine("your account " + accountBalance.Label + " of type " + accountBalance.Type + " has " + accountBalance.Balance.Amount + " " + accountBalance.Balance.Currency);

                var result = client.GetTransactionsForAccountCore(account.BankId, account.Id);

                if (result != null && result.Transactions.Length > 0)
                {
                    var transactions = result.Transactions;
                    Console.WriteLine("stats for this account : Bank -" + account.BankId + " - account id: " + account.Id);

                    GetMinAndMaxTransactionsDates(transactions);

                    SumAllIncomesAndExpenses(transactions);

                    GetIncomesAndExpenseByMonth(transactions);

                    //GetReccuringIncomesAndExpenses(transactions);

                    Console.WriteLine("");
                }
                else
                {
                    Console.WriteLine("this account is empty : Bank -" + account.BankId + " - account id: " + account.Id);
                }
            }
        }
Example #2
0
 private static void Test(
     ObpRestClient client,
     string bankId,
     string accountId,
     string viewId,
     string transactionRequestType,
     string description,
     string currency)
 {
     Test("GetAccountByIdCore", () => client.GetAccountByIdCore(bankId, accountId));
     Test("GetAccountsAtBank", () => client.GetAccountsAtBank(bankId));
     Test("GetAccountByIdFull", () => client.GetAccountByIdFull(bankId, accountId, viewId));
     Test("GetAccounts", client.GetAccounts);
     Test(
         "GetTransactionById",
         () => client.GetTransactionById(bankId, accountId, viewId, "f64ae303-5be6-45e1-9bba-9a7dbbf11ccf"));
     Test("GetTransactionsForAccountCore", () => client.GetTransactionsForAccountCore(bankId, accountId));
     Test("GetTransactionsForAccountFull", () => client.GetTransactionsForAccountFull(bankId, accountId, viewId));
     Test("GetAccountsAtAllBanksPublic", client.GetAccountsAtAllBanksPublic);
     Test("GetTransactionTypesOfferedByBankResponse", () => client.GetTransactionTypesOfferedByBankResponse(bankId));
     Test(
         "GetTransactionRequestTypesForAccount",
         () => client.GetTransactionRequestTypesForAccount(bankId, accountId, viewId));
     Test("GetTransactionRequests", () => client.GetTransactionRequests(bankId, accountId, viewId));
     Test("GetRoles", client.GetRoles);
     Test(
         "CreateTransactionRequest",
         () =>
         client.CreateTransactionRequest(
             bankId,
             accountId,
             viewId,
             transactionRequestType,
             new CreateTransactionRequestRequest
     {
         To =
             new TransactionRequestAccount
         {
             AccountId = accountId,
             BankId    = bankId
         },
         Description = description,
         Value       =
             new AmountOfMoney
         {
             Amount   = 1000m,
             Currency = currency
         }
     }));
 }
Example #3
0
        private static void Test(
            ObpRestClient client,
            string bankId,
            string accountId,
            string viewId,
            string transactionRequestType,
            string description,
            string currency)
        {
            Test("GetAccountByIdCore", () => client.GetAccountByIdCore(bankId, accountId));
            //Test("GetAccountsAtBank", () => client.GetAccountsAtBank(bankId));
            Test("GetAccountByIdFull", () => client.GetAccountByIdFull(bankId, accountId, viewId));
            Test("GetAccounts", client.GetAccounts);
            //Test("GetTransactionById",() => client.GetTransactionById(bankId, accountId, viewId, "f64ae303-5be6-45e1-9bba-9a7dbbf11ccf"));
            Test("GetTransactionsForAccountCore", () => client.GetTransactionsForAccountCore(bankId, accountId));
            Test("GetTransactionsForAccountFull", () => client.GetTransactionsForAccountFull(bankId, accountId, viewId));
            Test("GetAccountsAtAllBanksPublic", client.GetAccountsAtAllBanksPublic);
            Test("GetTransactionTypesOfferedByBankResponse", () => client.GetTransactionTypesOfferedByBankResponse(bankId));
            Test(
                "GetTransactionRequestTypesForAccount",
                () => client.GetTransactionRequestTypesForAccount(bankId, accountId, viewId));
            Test("GetTransactionRequests", () => client.GetTransactionRequests(bankId, accountId, viewId));
            Test("GetRoles", client.GetRoles);

            /*Test(
             *      "CreateTransactionRequest",
             *      () =>
             *      client.CreateTransactionRequest(
             *              bankId,
             *              accountId,
             *              viewId,
             *              transactionRequestType,
             *              new CreateTransactionRequestRequest
             *              {
             *                      To =
             *                                      new TransactionRequestAccount
             *                                      {
             *                                              AccountId = accountId,
             *                                              BankId = bankId
             *                                      },
             *                      Description = description,
             *                      Value =
             *                                      new AmountOfMoney
             *                                      {
             *                                              Amount = 1000m,
             *                                              Currency = currency
             *                                      }
             *              }));*/
        }
Example #4
0
        private static bool TxExists(string description, ObpRestClient client, DateTime laatsteKeerBinnengekomen)
        {
            var transactions = client.GetTransactionsForAccountFull(bankId, accountId, viewId);

            foreach (var transaction in transactions.Transactions)
            {
                if (transaction.Details.Value.Amount > 0 &&
                    transaction.Details.Description.Contains(description) &&
                    transaction.Details.Completed > laatsteKeerBinnengekomen)
                {
                    Console.WriteLine(JsonConvert.SerializeObject(transaction, Formatting.Indented));
                    return(true);
                }
            }
            return(false);
        }
Example #5
0
        static void Main(string[] args)
        {
            Console.BufferHeight = short.MaxValue - 1;

            var url    = "https://psd2-api.openbankproject.com/";
            var client = new ObpRestClient(url);

            client.Login("*****@*****.**", "<password>", "<consumerKey>");


            if (TxExists(description, client, new DateTime(2017, 01, 19)))
            {
                Console.WriteLine("TRIGGER: Tx exists");
            }

            Test(client, bankId, accountId, viewId, transactionRequestType, description, currency);

            Console.ReadLine();
        }
Example #6
0
        static void Main(string[] args)
        {
            //Console.BufferHeight = short.MaxValue - 1;

            var client = new ObpRestClient(HttpsApisandboxOpenbankprojectCom);

            var users = GetUsers();

            foreach (var user in users)
            {
                client.Login(user.email, user.password, consumerKey);
                Console.WriteLine("");
                Console.WriteLine("==============================");
                Console.WriteLine("stats for :" + user.email);

                GetMinAndMaxDateOfTransactions(client);
            }
            //Test(client, bankId, accountId, viewId, transactionRequestType, description, currency);

            Console.ReadLine();
        }