public ConnectResponse AuthenticateUser(Credentials credentials, string type, string mfa, ConnectOptions connectOptions) { var institutions = new InstitutionCategory(new Institutions()); var request = new RestRequest("/connect", Method.POST); request.Parameters.Add(new Parameter { Name = "client_id", Value = _clientId }); request.Parameters.Add(new Parameter { Name = "secret", Value = _secret }); request.Parameters.Add(new Parameter { Name = "username", Value = credentials.UserName }); request.Parameters.Add(new Parameter { Name = "password", Value = credentials.Password }); foreach (var inst in institutions.PinInstitutions()) { if (type.Equals(inst)) { request.Parameters.Add(new Parameter { Name = "pin", Value = credentials.Pin }); } } request.Parameters.Add(new Parameter { Name = "type", Value = type }); request.AddBody(connectOptions); var response = Client.Execute(request); if ((int)response.StatusCode == (int)HttpStatusCodes.MfaRequired) { return(MfaConnectStep(mfa, type, connectOptions)); } if ((int)response.StatusCode == (int)HttpStatusCodes.Success) { return(new ConnectResponse(response)); } throw new Exception("Neither MFA or Non MFA response"); }
public ActionResult InstitutionCategoryClass(InstitutionCategory ic) { if (InstitutionCategoryRepo.GetAll().Find(a => a.InstitutionCategoryClass == ic.InstitutionCategoryClass && a.InstitutionCategoryTypeID == ic.InstitutionCategoryTypeID) == null) { InstitutionCategoryRepo.Insert(ic); } return(RedirectToAction("InstitutionCategoryClass", new { InstitutionCategoryTypeID = ic.InstitutionCategoryTypeID })); }