internal ErrorModel DeleteAccount(string id) { ErrorModel errorModel = new ErrorModel(); //Demo purposes only. The OAuth tokens returned by the SAML assertion are valid for 1 hour and do not need to be requested before each API call. SamlRequestValidator validator = new SamlRequestValidator(AggCatAppSettings.Certificate, AggCatAppSettings.ConsumerKey, AggCatAppSettings.ConsumerSecret, AggCatAppSettings.SamlIdentityProviderId, AggCatAppSettings.CustomerId); ServiceContext ctx = new ServiceContext(validator); AggregationCategorizationService svc = new AggregationCategorizationService(ctx); try { long longId = Convert.ToInt64(id); svc.DeleteAccount(longId); errorModel.Error = null; errorModel.Success = true; } catch (AggregationCategorizationException ex) { errorModel.Error = ex.ToString(); errorModel.Success = false; } return(errorModel); }
public InstitutionModel GetDefaultInstitutions() { InstitutionModel model = new InstitutionModel(); //Demo purposes only. The OAuth tokens returned by the SAML assertion are valid for 1 hour and do not need to be requested before each API call. SamlRequestValidator validator = new SamlRequestValidator(AggCatAppSettings.Certificate, AggCatAppSettings.ConsumerKey, AggCatAppSettings.ConsumerSecret, AggCatAppSettings.SamlIdentityProviderId, AggCatAppSettings.CustomerId); ServiceContext ctx = new ServiceContext(validator); AggregationCategorizationService svc = new AggregationCategorizationService(ctx); try { List <Institution> institutions = svc.GetInstitutions().institution.ToList <Institution>(); model.Institutions = institutions; model.Error = null; model.Success = true; } catch (AggregationCategorizationException ex) { model.Institutions = null; model.Error = ex.ToString(); model.Success = false; } return(model); }
internal InstitutionModel GetInstitutionDetails(InstitutionModel institutionModel) { try { //Demo purposes only. The OAuth tokens returned by the SAML assertion are valid for 1 hour and do not need to be requested before each API call. SamlRequestValidator validator = new SamlRequestValidator(AggCatAppSettings.Certificate, AggCatAppSettings.ConsumerKey, AggCatAppSettings.ConsumerSecret, AggCatAppSettings.SamlIdentityProviderId, AggCatAppSettings.CustomerId); ServiceContext ctx = new ServiceContext(validator); AggregationCategorizationService svc = new AggregationCategorizationService(ctx); institutionModel.InstitutionDetail = svc.GetInstitutionDetails(institutionModel.InstitutionId); institutionModel.Success = true; institutionModel.Error = null; } catch (AggregationCategorizationException ex) { institutionModel.InstitutionDetail = null; institutionModel.Success = false; institutionModel.Error = ex.ToString(); } return institutionModel; }
public InstitutionModel GetDefaultInstitutions() { InstitutionModel model = new InstitutionModel(); //Demo purposes only. The OAuth tokens returned by the SAML assertion are valid for 1 hour and do not need to be requested before each API call. SamlRequestValidator validator = new SamlRequestValidator(AggCatAppSettings.Certificate, AggCatAppSettings.ConsumerKey, AggCatAppSettings.ConsumerSecret, AggCatAppSettings.SamlIdentityProviderId, AggCatAppSettings.CustomerId); ServiceContext ctx = new ServiceContext(validator); AggregationCategorizationService svc = new AggregationCategorizationService(ctx); try { List<Institution> institutions = svc.GetInstitutions().institution.ToList<Institution>(); model.Institutions = institutions; model.Error = null; model.Success = true; } catch (AggregationCategorizationException ex) { model.Institutions = null; model.Error = ex.ToString(); model.Success = false; } return model; }
internal AccountModel GetCustomerAccountTransactions(AccountModel accountModel) { try { //Demo purposes only. The OAuth tokens returned by the SAML assertion are valid for 1 hour and do not need to be requested before each API call. SamlRequestValidator validator = new SamlRequestValidator(AggCatAppSettings.Certificate, AggCatAppSettings.ConsumerKey, AggCatAppSettings.ConsumerSecret, AggCatAppSettings.SamlIdentityProviderId, AggCatAppSettings.CustomerId); ServiceContext ctx = new ServiceContext(validator); AggregationCategorizationService svc = new AggregationCategorizationService(ctx); accountModel.Transactions = svc.GetAccountTransactions(accountModel.AccountId, new DateTime(2011, 01, 01)).AnyIntuitObjects.ToList(); accountModel.Success = true; accountModel.Error = null; } catch (AggregationCategorizationException ex) { accountModel.Transactions = null; accountModel.Success = false; accountModel.Error = ex.ToString(); } return(accountModel); }
protected void institutions_SelectedIndexChanged(object sender, EventArgs e) { try { if (institutions.SelectedValue == "PleaseSelect") { InstitutionDetails.Visible = false; } else { InstitutionDetails.Visible = true; AggregationCategorizationService svc = Services.AggCatService.GetService(Cache, HttpContext.Current.User.Identity.Name); InstitutionDetail insutitutionDetail = svc.GetInstitutionDetails(institutions.SelectedIndex); InstitutionId.Text = insutitutionDetail.institutionId.ToString(); InsitutionName.Text = insutitutionDetail.institutionName; Website.Text = insutitutionDetail.homeUrl; PhoneNumer.Text = insutitutionDetail.phoneNumber; Address.Text = AggCatService.AggCatInstitutions.GetFormattedInstitutionAddress(insutitutionDetail); Email.Text = insutitutionDetail.emailAddress; } } catch (Exception ex) { Master.ErrorMessage = "Error occurred while calling GetInsitutions: " + ex.Message; } }
internal InstitutionModel GetInstitutionDetails(InstitutionModel institutionModel) { try { //Demo purposes only. The OAuth tokens returned by the SAML assertion are valid for 1 hour and do not need to be requested before each API call. SamlRequestValidator validator = new SamlRequestValidator(AggCatAppSettings.Certificate, AggCatAppSettings.ConsumerKey, AggCatAppSettings.ConsumerSecret, AggCatAppSettings.SamlIdentityProviderId, AggCatAppSettings.CustomerId); ServiceContext ctx = new ServiceContext(validator); AggregationCategorizationService svc = new AggregationCategorizationService(ctx); institutionModel.InstitutionDetail = svc.GetInstitutionDetails(institutionModel.InstitutionId); institutionModel.Success = true; institutionModel.Error = null; } catch (AggregationCategorizationException ex) { institutionModel.InstitutionDetail = null; institutionModel.Success = false; institutionModel.Error = ex.ToString(); } return(institutionModel); }
protected void FillAccountsList() { AggregationCategorizationService svc = Services.AggCatService.GetService(Cache, HttpContext.Current.User.Identity.Name); AccountList accounts = svc.GetCustomerAccounts(); AccountsGridView.DataSource = accounts.AnyIntuitObjects; AccountsGridView.DataBind(); }
protected void ShowTransactions(String startDate, String endDate) { try { AggregationCategorizationService svc = Services.AggCatService.GetService(Cache, HttpContext.Current.User.Identity.Name); TransactionList transactionList = svc.GetAccountTransactions(long.Parse(Request.QueryString["Account"]), Convert.ToDateTime(startDate), Convert.ToDateTime(endDate)); AccountsGridView.DataSource = transactionList.AnyIntuitObjects; AccountsGridView.DataBind(); } catch (Exception ex) { Master.ErrorMessage = "Error occurred while calling GetAccountTransactions: " + ex.Message; } }
protected void Page_Load(object sender, EventArgs e) { //if (!IsPostBack) //{ try { if (Request.QueryString["InstitutionID"] == null) { Response.Redirect("SelectInstitution.aspx"); } AggregationCategorizationService svc = Services.AggCatService.GetService(Cache, HttpContext.Current.User.Identity.Name); InstitutionDetail institutionDetail = svc.GetInstitutionDetails(long.Parse(Request.QueryString["InstitutionID"])); Control[][] institutionLoginControls = new Control[institutionDetail.keys.Length][]; foreach (InstitutionDetailKey institutionKey in institutionDetail.keys) { TextBox value = new TextBox(); if (institutionKey.mask) { value.TextMode = TextBoxMode.Password; } value.Attributes.Add("KeyName", institutionKey.name); value.Width = 200; Label name = new Label { Text = institutionKey.name + ": ", AssociatedControlID = value.ID }; Literal lineBreak = new Literal { Text = "<br/><br/>" }; institutionLoginControls[institutionKey.displayOrder - 1] = new Control[] { name, value, lineBreak }; } for (int i = 0; i < institutionLoginControls.Length; i++) { LoginControls.Controls.Add(institutionLoginControls[i][0]); LoginControls.Controls.Add(institutionLoginControls[i][1]); LoginControls.Controls.Add(institutionLoginControls[i][2]); } } catch (Exception ex) { Master.ErrorMessage = "Error occurred while calling GetInsitutionDetails: " + ex.Message; } //} }
internal DiscoverAddModel DiscoverAndAddResponse(DiscoverAddModel model) { try { //Demo purposes only. The OAuth tokens returned by the SAML assertion are valid for 1 hour and do not need to be requested before each API call. SamlRequestValidator validator = new SamlRequestValidator(AggCatAppSettings.Certificate, AggCatAppSettings.ConsumerKey, AggCatAppSettings.ConsumerSecret, AggCatAppSettings.SamlIdentityProviderId, AggCatAppSettings.CustomerId); ServiceContext ctx = new ServiceContext(validator); AggregationCategorizationService svc = new AggregationCategorizationService(ctx); ChallengeResponses challengeResponses = new ChallengeResponses(); if (model.Challenges.challenge[0].AnyIntuitObjects.Count() == 2) { if (model.UseSame) { challengeResponses.response = new string[] { model.Challenges.challenge[0].AnyIntuitObjects[1].ToString() }; } } else { challengeResponses.response = new string[] { model.Answer }; } AccountList accountList = svc.DiscoverAndAddAccountsResponse(challengeResponses, model.ChallengeSession); model.AccountList = accountList; model.Success = true; model.Error = null; } catch (AggregationCategorizationException ex) { model.AccountList = null; model.Success = false; model.Error = ex.ToString(); } return(model); }
protected void AccountsGridView_RowCommand(object sender, GridViewCommandEventArgs e) { try { int row = Convert.ToInt32(e.CommandArgument); long accountId = long.Parse(AccountsGridView.DataKeys[row].Value.ToString()); if (e.CommandName == "ViewTransactions") { Response.Redirect("ViewTransactions.aspx?Account=" + accountId); } if (e.CommandName == "DeleteAccount") { AggregationCategorizationService svc = Services.AggCatService.GetService(Cache, HttpContext.Current.User.Identity.Name); svc.DeleteAccount(accountId); FillAccountsList(); } } catch (Exception ex) { Master.ErrorMessage = "Error occurred while calling " + e.CommandName + ": " + ex.Message; } }
protected void Login_Click(object sender, EventArgs e) { try { if (Request.QueryString["InstitutionID"] == null) { Response.Redirect("SelectInstitution.aspx"); } AggregationCategorizationService svc = Services.AggCatService.GetService(Cache, HttpContext.Current.User.Identity.Name); InstitutionDetail insutitutionDetail = svc.GetInstitutionDetails(long.Parse(Request.QueryString["InstitutionID"])); InstitutionLogin instLogin = new InstitutionLogin(); Credentials creds = new Credentials(); List <Credential> credentials = new List <Credential>(); foreach (Control control in LoginControls.Controls) { if (control as TextBox != null) { Credential cred = new Credential(); TextBox loginValue = (TextBox)control; cred.name = loginValue.Attributes["KeyName"]; cred.value = loginValue.Text; credentials.Add(cred); } } creds.credential = credentials.ToArray(); instLogin.AnyIntuitObject = creds; Challenges challenges = null; ChallengeSession challengeSession = null; AccountList accountList = svc.DiscoverAndAddAccounts(long.Parse(Request.QueryString["InstitutionID"].ToString()), instLogin, out challenges, out challengeSession); Response.Redirect("MyAccounts.aspx?Success"); } catch (Exception ex) { Master.ErrorMessage = "Error occurred while calling logging into the instituion: " + ex.Message; } }
internal AccountModel GetCustomerAccounts() { AccountModel model = new AccountModel(); //Demo purposes only. The OAuth tokens returned by the SAML assertion are valid for 1 hour and do not need to be requested before each API call. SamlRequestValidator validator = new SamlRequestValidator(AggCatAppSettings.Certificate, AggCatAppSettings.ConsumerKey, AggCatAppSettings.ConsumerSecret, AggCatAppSettings.SamlIdentityProviderId, AggCatAppSettings.CustomerId); ServiceContext ctx = new ServiceContext(validator); AggregationCategorizationService svc = new AggregationCategorizationService(ctx); try { AccountList accountList = svc.GetCustomerAccounts(); if (accountList != null && accountList.AnyIntuitObjects != null) { model.Accounts = accountList.AnyIntuitObjects.ToList(); } else { accountList = null; } model.Error = null; model.Success = true; } catch (AggregationCategorizationException ex) { model.Accounts = null; model.Error = ex.ToString(); model.Success = false; } return(model); }
internal AccountModel GetCustomerAccounts() { AccountModel model = new AccountModel(); //Demo purposes only. The OAuth tokens returned by the SAML assertion are valid for 1 hour and do not need to be requested before each API call. SamlRequestValidator validator = new SamlRequestValidator(AggCatAppSettings.Certificate, AggCatAppSettings.ConsumerKey, AggCatAppSettings.ConsumerSecret, AggCatAppSettings.SamlIdentityProviderId, AggCatAppSettings.CustomerId); ServiceContext ctx = new ServiceContext(validator); AggregationCategorizationService svc = new AggregationCategorizationService(ctx); try { AccountList accountList = svc.GetCustomerAccounts(); if (accountList != null && accountList.AnyIntuitObjects != null) { model.Accounts = accountList.AnyIntuitObjects.ToList(); } else { accountList = null; } model.Error = null; model.Success = true; } catch (AggregationCategorizationException ex) { model.Accounts = null; model.Error = ex.ToString(); model.Success = false; } return model; }
internal DiscoverAddModel DiscoverAndAdd(InstitutionModel institutionModel) { DiscoverAddModel discoverAddModel = new DiscoverAddModel(); try { //Demo purposes only. The OAuth tokens returned by the SAML assertion are valid for 1 hour and do not need to be requested before each API call. SamlRequestValidator validator = new SamlRequestValidator(AggCatAppSettings.Certificate, AggCatAppSettings.ConsumerKey, AggCatAppSettings.ConsumerSecret, AggCatAppSettings.SamlIdentityProviderId, AggCatAppSettings.CustomerId); ServiceContext ctx = new ServiceContext(validator); AggregationCategorizationService svc = new AggregationCategorizationService(ctx); InstitutionLogin instLogin = new InstitutionLogin(); Credentials creds = new Credentials(); List <Credential> credentials = new List <Credential>(); Credential cred = new Credential(); cred.name = institutionModel.InstitutionDetail.keys.FirstOrDefault(k => k.displayOrder == 1).name; cred.value = institutionModel.Value1; credentials.Add(cred); cred = new Credential(); cred.name = institutionModel.InstitutionDetail.keys.FirstOrDefault(k => k.displayOrder == 2).name; cred.value = institutionModel.Value2; credentials.Add(cred); IEnumerable <InstitutionDetailKey> idk = institutionModel.InstitutionDetail.keys.Where(k => k.displayOrder != 1 && k.displayOrder != 2); foreach (InstitutionDetailKey item in idk) { cred = new Credential(); cred.name = item.name; cred.value = item.val; credentials.Add(cred); } creds.credential = credentials.ToArray(); instLogin.AnyIntuitObject = creds; Challenges challenges = null; ChallengeSession challengeSession = null; AccountList accountList = svc.DiscoverAndAddAccounts(institutionModel.InstitutionDetail.institutionId, instLogin, out challenges, out challengeSession); discoverAddModel.AccountList = accountList; discoverAddModel.Challenges = challenges; discoverAddModel.ChallengeSession = challengeSession; discoverAddModel.Success = true; discoverAddModel.Error = null; if (accountList == null && challenges != null) { discoverAddModel.MFA = true; } } catch (AggregationCategorizationException ex) { discoverAddModel.AccountList = null; discoverAddModel.Challenges = null; discoverAddModel.ChallengeSession = null; discoverAddModel.Success = false; discoverAddModel.Error = ex.ToString(); } return(discoverAddModel); }
internal ErrorModel DeleteAccount(string id) { ErrorModel errorModel = new ErrorModel(); //Demo purposes only. The OAuth tokens returned by the SAML assertion are valid for 1 hour and do not need to be requested before each API call. SamlRequestValidator validator = new SamlRequestValidator(AggCatAppSettings.Certificate, AggCatAppSettings.ConsumerKey, AggCatAppSettings.ConsumerSecret, AggCatAppSettings.SamlIdentityProviderId, AggCatAppSettings.CustomerId); ServiceContext ctx = new ServiceContext(validator); AggregationCategorizationService svc = new AggregationCategorizationService(ctx); try { long longId = Convert.ToInt64(id); svc.DeleteAccount(longId); errorModel.Error = null; errorModel.Success = true; } catch (AggregationCategorizationException ex) { errorModel.Error = ex.ToString(); errorModel.Success = false; } return errorModel; }
internal DiscoverAddModel DiscoverAndAddResponse(DiscoverAddModel model) { try { //Demo purposes only. The OAuth tokens returned by the SAML assertion are valid for 1 hour and do not need to be requested before each API call. SamlRequestValidator validator = new SamlRequestValidator(AggCatAppSettings.Certificate, AggCatAppSettings.ConsumerKey, AggCatAppSettings.ConsumerSecret, AggCatAppSettings.SamlIdentityProviderId, AggCatAppSettings.CustomerId); ServiceContext ctx = new ServiceContext(validator); AggregationCategorizationService svc = new AggregationCategorizationService(ctx); ChallengeResponses challengeResponses = new ChallengeResponses(); if (model.Challenges.challenge[0].AnyIntuitObjects.Count() == 2) { if (model.UseSame) { challengeResponses.response = new string[] { model.Challenges.challenge[0].AnyIntuitObjects[1].ToString() }; } } else { challengeResponses.response = new string[] { model.Answer }; } AccountList accountList = svc.DiscoverAndAddAccountsResponse(challengeResponses, model.ChallengeSession); model.AccountList = accountList; model.Success = true; model.Error = null; } catch (AggregationCategorizationException ex) { model.AccountList = null; model.Success = false; model.Error = ex.ToString(); } return model; }
internal DiscoverAddModel DiscoverAndAdd(InstitutionModel institutionModel) { DiscoverAddModel discoverAddModel = new DiscoverAddModel(); try { //Demo purposes only. The OAuth tokens returned by the SAML assertion are valid for 1 hour and do not need to be requested before each API call. SamlRequestValidator validator = new SamlRequestValidator(AggCatAppSettings.Certificate, AggCatAppSettings.ConsumerKey, AggCatAppSettings.ConsumerSecret, AggCatAppSettings.SamlIdentityProviderId, AggCatAppSettings.CustomerId); ServiceContext ctx = new ServiceContext(validator); AggregationCategorizationService svc = new AggregationCategorizationService(ctx); InstitutionLogin instLogin = new InstitutionLogin(); Credentials creds = new Credentials(); List<Credential> credentials = new List<Credential>(); Credential cred = new Credential(); cred.name = institutionModel.InstitutionDetail.keys.FirstOrDefault(k => k.displayOrder == 1).name; cred.value = institutionModel.Value1; credentials.Add(cred); cred = new Credential(); cred.name = institutionModel.InstitutionDetail.keys.FirstOrDefault(k => k.displayOrder == 2).name; cred.value = institutionModel.Value2; credentials.Add(cred); IEnumerable<InstitutionDetailKey> idk = institutionModel.InstitutionDetail.keys.Where(k => k.displayOrder != 1 && k.displayOrder != 2); foreach (InstitutionDetailKey item in idk) { cred = new Credential(); cred.name = item.name; cred.value = item.val; credentials.Add(cred); } creds.credential = credentials.ToArray(); instLogin.AnyIntuitObject = creds; Challenges challenges = null; ChallengeSession challengeSession = null; AccountList accountList = svc.DiscoverAndAddAccounts(institutionModel.InstitutionDetail.institutionId, instLogin, out challenges, out challengeSession); discoverAddModel.AccountList = accountList; discoverAddModel.Challenges = challenges; discoverAddModel.ChallengeSession = challengeSession; discoverAddModel.Success = true; discoverAddModel.Error = null; if (accountList == null && challenges != null) { discoverAddModel.MFA = true; } } catch (AggregationCategorizationException ex) { discoverAddModel.AccountList = null; discoverAddModel.Challenges = null; discoverAddModel.ChallengeSession = null; discoverAddModel.Success = false; discoverAddModel.Error = ex.ToString(); } return discoverAddModel; }
internal AccountModel GetCustomerAccountTransactions(AccountModel accountModel) { try { //Demo purposes only. The OAuth tokens returned by the SAML assertion are valid for 1 hour and do not need to be requested before each API call. SamlRequestValidator validator = new SamlRequestValidator(AggCatAppSettings.Certificate, AggCatAppSettings.ConsumerKey, AggCatAppSettings.ConsumerSecret, AggCatAppSettings.SamlIdentityProviderId, AggCatAppSettings.CustomerId); ServiceContext ctx = new ServiceContext(validator); AggregationCategorizationService svc = new AggregationCategorizationService(ctx); accountModel.Transactions = svc.GetAccountTransactions(accountModel.AccountId, new DateTime(2011, 01, 01)).AnyIntuitObjects.ToList(); accountModel.Success = true; accountModel.Error = null; } catch (AggregationCategorizationException ex) { accountModel.Transactions = null; accountModel.Success = false; accountModel.Error = ex.ToString(); } return accountModel; }