Example #1
0
        public async Task Login_fetch_all_return_full_statements()
        {
            var loginResult = await Service.LoginFetchAllAsync("test", BsLogin);

            loginResult.ResponseType.Should().Be(BankStatementResponseType.Downloaded);

            var json = loginResult.ResponseJson;

            json.Length.Should().NotBe(0);
        }
Example #2
0
        public override async Task ExecuteAsync(BankStatementAggregate aggregate, ExtractBankStatement1Command command,
                                                CancellationToken cancellationToken)
        {
            //TODO extract bank statements
            var bankName = "anz";
            var anz      = new BankLogin("anz", "username", Environment.GetEnvironmentVariable("bankstatements-anz-cdm-username"),
                                         "password", Environment.GetEnvironmentVariable("bankstatements-anz-cdm-password"));
            var       test = new BankLogin("bank_of_statements", "username", "12345678", "password", "TestMyMoney");
            BankLogin bank;

            switch (bankName)
            {
            case "anz":
                bank = anz;
                break;

            default:
                // bank = test;
                bank = anz;
                break;
            }

            var result = await _bankStatementService.LoginFetchAllAsync(bankName, bank);

            var requests = result.ToPredictionRequests().ToArray();

            if (requests.Any(x => x == null))
            {
                throw new ApplicationException();
            }
            if (requests.Any(x => string.IsNullOrEmpty(x.Description)))
            {
                throw new ApplicationException();
            }
            try
            {
                await aggregate.ExtractBankStatementAsync(command, requests);
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
                throw;
            }
        }