Esempio n. 1
0
        public void Run(string[] args)
        {
            var environmentType = ShareLib.DetermineEnvironmentType(args);

            ShareLib.PrintHeader();

            var bunq = new BunqLib(environmentType);

            var amount      = ShareLib.GetAmountFromArgsOrStdIn(args);
            var recipient   = ShareLib.GetRecipientFromArgsOrStdIn(args);
            var description = ShareLib.GetDescriptionFromArgsOrStdIn(args);

            Console.Out.WriteLine();
            Console.Out.WriteLine($"  | Requesting:   € {amount}");
            Console.Out.WriteLine($"  | From:         {recipient}");
            Console.Out.WriteLine($"  | Description:  {description}");
            Console.Out.WriteLine();
            Console.Out.WriteLine("    ...");
            Console.Out.WriteLine();

            RequestInquiry.Create(new Amount(amount, "EUR"), new Pointer("EMAIL", recipient), description, true);

            Console.Out.WriteLine();
            Console.Out.WriteLine("  | Request sent");
            Console.Out.WriteLine();
            Console.Out.WriteLine("  | Check your changed overview");
            Console.Out.WriteLine();
            Console.Out.WriteLine();

            bunq.UpdateContext();
        }
Esempio n. 2
0
        public void Run(string[] args)
        {
            var environmentType = ShareLib.DetermineEnvironmentType(args);

            ShareLib.PrintHeader();

            var bunq = new BunqLib(environmentType);

            var accountId = ShareLib.GetAccountIdFromArgsOrStdIn(args);
            var name      = ShareLib.GetNameFromArgsOrStdIn(args);

            Console.Out.WriteLine();
            Console.Out.WriteLine($"  | Updating Name:      {name}");
            Console.Out.WriteLine($"  | of Account:         {accountId}");
            Console.Out.WriteLine();
            Console.Out.WriteLine("    ...");
            Console.Out.WriteLine();

            MonetaryAccountBank.Update(int.Parse(accountId), name);

            Console.Out.WriteLine();
            Console.Out.WriteLine("  | Account updated");
            Console.Out.WriteLine();
            Console.Out.WriteLine("  | Check your changed overview");
            Console.Out.WriteLine();
            Console.Out.WriteLine();

            bunq.UpdateContext();
        }
Esempio n. 3
0
        public void Run(string[] args)
        {
            var environmentType = ShareLib.DetermineEnvironmentType(args);

            ShareLib.PrintHeader();

            var bunq = new BunqLib(environmentType);

            ShareLib.PrintUser(BunqContext.UserContext.UserId, bunq.GetCurrentUserDisplayName());

            var allMonetaryAccountBankActive = bunq.GetAllMonetaryAccountBankActive(1);

            ShareLib.PrintAllMonetaryAccountBank(allMonetaryAccountBankActive);

            var allPayment = bunq.GetAllPayment(1);

            ShareLib.PrintAllPayment(allPayment);

            var allRequest = bunq.GetAllRequest(1);

            ShareLib.PrintAllRequest(allRequest);

            var allCard = bunq.GetAllCard(1);

            ShareLib.PrintAllCard(allCard, allMonetaryAccountBankActive);

            if (environmentType.Equals(ApiEnvironmentType.SANDBOX))
            {
                var allUserAlias = bunq.GetAllUserAlias();
                ShareLib.PrintAllUserAlias(allUserAlias);
            }

            bunq.UpdateContext();
        }
Esempio n. 4
0
        public void Run(string[] args)
        {
            var environmentType = ShareLib.DetermineEnvironmentType(args);

            ShareLib.PrintHeader();

            var bunq = new BunqLib(environmentType);

            var cardId    = ShareLib.GetCardIdFromArgsOrStdIn(args);
            var accountId = ShareLib.GetAccountIdFromArgsOrStdIn(args);

            Console.Out.WriteLine();
            Console.Out.WriteLine($"  | Link Card:    {cardId}");
            Console.Out.WriteLine($"  | To Account:   {accountId}");
            Console.Out.WriteLine();
            Console.Out.WriteLine("    ...");
            Console.Out.WriteLine();

            Card.Update(int.Parse(cardId), monetaryAccountCurrentId: int.Parse(accountId));

            Console.Out.WriteLine();
            Console.Out.WriteLine("  | Account switched");
            Console.Out.WriteLine();
            Console.Out.WriteLine("  | Check your changed overview");
            Console.Out.WriteLine();
            Console.Out.WriteLine();

            bunq.UpdateContext();
        }
        public void Run(string[] args)
        {
            var environmentType = ShareLib.DetermineEnvironmentType(args);

            ShareLib.PrintHeader();

            var bunq = new BunqLib(environmentType);

            var callbackUrl = ShareLib.GetCallbackUrlFromArgsOrStdIn(args);

            Console.Out.WriteLine();
            Console.Out.WriteLine($"  | Adding Callback URL:    {callbackUrl}");
            Console.Out.WriteLine();
            Console.Out.WriteLine("    ...");
            Console.Out.WriteLine();

            if (BunqContext.UserContext.isOnlyUserCompanySet())
            {
                UserCompany.Update(
                    notificationFilters: UpdateAllNotificationFilter(
                        BunqContext.UserContext.UserCompany.NotificationFilters,
                        callbackUrl
                        )
                    );
            }
            else if (BunqContext.UserContext.IsOnlyUserPersonSet())
            {
                UserPerson.Update(
                    notificationFilters: UpdateAllNotificationFilter(
                        BunqContext.UserContext.UserPerson.NotificationFilters,
                        callbackUrl
                        )
                    );
            }
            else
            {
                throw new BunqException("Unexpected user type found.");
            }

            Console.Out.WriteLine();
            Console.Out.WriteLine("  | Callback URL added");
            Console.Out.WriteLine();
            Console.Out.WriteLine("  | Check your changed overview");
            Console.Out.WriteLine();
            Console.Out.WriteLine();

            bunq.UpdateContext();
        }
        public void Run(string[] args)
        {
            Dictionary <string, string> allOption = AssertMandatoryOptions(args);

            ApiContext apiContext = ApiContext.CreateForPsd2(
                ShareLib.DetermineEnvironmentType(args),
                SecurityUtils.GetCertificateFromFile(allOption[OPTION_CREDENTIALS], allOption[OPTION_PASSPHRASE]),
                new X509CertificateCollection()
            {
                SecurityUtils.GetCertificateFromFile(allOption[OPTION_CERTIFICATE_CHAIN])
            },
                API_DEVICE_DESCRIPTION,
                new List <string>()
                );

            apiContext.Save(FILE_CONTEXT);
        }
Esempio n. 7
0
        public void Run(string[] args)
        {
            Dictionary <string, string> allOption = AssertMandatoryOptions(args);

            ApiContext apiContext = ApiContext.Restore(allOption[OPTION_CONTEXT]);

            BunqContext.LoadApiContext(apiContext);

            OauthAccessToken accessToken = OauthAccessToken.Create(
                OauthGrantType.AUTHORIZATION_CODE,
                allOption[OPTION_AUTH_CODE],
                allOption[OPTION_REDIRECT],
                CreateOauthClientFromFile(allOption[OPTION_CLIENT_CONFIGURATION])
                );

            apiContext = CreateApiContextByOauthToken(
                accessToken,
                ShareLib.DetermineEnvironmentType(args)
                );
            BunqContext.LoadApiContext(apiContext);

            (new UserOverview()).Run(new String[] {});
        }
Esempio n. 8
0
        public void Run(string[] args)
        {
            var environmentType = ShareLib.DetermineEnvironmentType(args);

            ShareLib.PrintHeader();

            var bunq = new BunqLib(environmentType);

            var callbackUrl = ShareLib.GetCallbackUrlFromArgsOrStdIn(args);

            Console.Out.WriteLine();
            Console.Out.WriteLine($"  | Adding Callback URL:    {callbackUrl}");
            Console.Out.WriteLine();
            Console.Out.WriteLine("    ...");
            Console.Out.WriteLine();

            var allNotificationFilter    = NotificationFilterUrlUserInternal.List().Value;
            var allNotificationFilterUrl = new List <NotificationFilterUrl>();

            foreach (var notificationFilterUser in allNotificationFilter)
            {
                allNotificationFilterUrl.AddRange(notificationFilterUser.NotificationFilters);
            }

            allNotificationFilterUrl = UpdateAllNotificationFilter(allNotificationFilterUrl, callbackUrl);
            NotificationFilterUrlUserInternal.CreateWithListResponse(allNotificationFilterUrl);

            Console.Out.WriteLine();
            Console.Out.WriteLine("  | Callback URL added");
            Console.Out.WriteLine();
            Console.Out.WriteLine("  | Check your changed overview");
            Console.Out.WriteLine();
            Console.Out.WriteLine();

            bunq.UpdateContext();
        }