public async Task <ActionResult> EndCall() { Debug.WriteLine($"App-Debug: {(nameof(ResourcesController))} {nameof(EndCall)}"); await _siteConnector.Challenge(_identity, "api/challenge/clear"); return(View("EndCall", new EndCallViewModel())); }
public async Task <ActionResult> AccountPaymentsIn(int id, int tries = 1) { Debug.WriteLine($"App-Debug: {(nameof(AccountsController))} {nameof(AccountPaymentsIn)} {id} {tries}"); var entityType = "Account.Payments"; if (await _siteConnector.Challenge(_identity, $"api/challenge/required/{entityType}/{id}")) { var model = new ChallengeViewModel { MenuType = _menuType, EntityType = entityType, Identifier = $"{id}", Identity = _identity, ReturnTo = $"{_siteConnector.Services[SupportServices.Portal]}views/accounts/{id}/payments/int", Tries = tries, }; MvcApplication.Challenges.Add(model.ChallengeId, model); return(RedirectToAction("Challenge", "Challenge", new { model.ChallengeId })); } await _siteConnector.Challenge(_identity, $"api/challenge/refresh/{entityType}/{id}"); var paymentsView = await _siteConnector.DownloadView(SupportServices.Portal, _identity, $"resources/payments/accounts/{id}/in"); var accountPaymentsViewModel = new AccountPaymentsViewModel { Account = _accountViewModels.Accounts.FirstOrDefault(x => x.AccountId == id), View = paymentsView }; if (NavItem.IsAResourceRequest(Request)) { return(View("_accountPayments", accountPaymentsViewModel)); } var identifiers = new Dictionary <string, string> { { "accountId", $"{id}" } }; var menuNavItems = NavItem.TransformNavItems( MvcApplication.NavItems .Where(x => x.Key.StartsWith($"{_menuType}")) .ToDictionary(x => x.Key, x => x.Value), _siteConnector.Services[SupportServices.Portal], identifiers ).Select(s => s.Value).ToList(); ViewBag.Menu = Menu.ConfigureMenu(menuNavItems, entityType, new List <string> { $"{entityType}", $"{entityType}.In" }, MenuOrientations.Horizontal); return(View("_accountPayments", accountPaymentsViewModel)); }
public async Task <ActionResult> ProcessResponse(FormCollection formProperties) { if (formProperties == null) { throw new ArgumentNullException(nameof(formProperties)); } var challengeId = new Guid(formProperties["ChallengeId"] ?? Guid.Empty.ToString()); if (!MvcApplication.Challenges.ContainsKey(challengeId)) { return(RedirectToAction("Failed", "Challenge")); } var model = MvcApplication.Challenges[challengeId]; var response = formProperties["Response"]; if (string.IsNullOrWhiteSpace(response) || response.StartsWith("f", StringComparison.InvariantCultureIgnoreCase)) { model.Tries += 1; if (model.Tries > model.MaxTries) { var failedUri = $"views/accounts/challenge/failed/{model.ChallengeId}"; var uri = new Uri(_siteConnector.Services[SupportServices.Portal], failedUri).AbsoluteUri; return(Redirect(uri)); } model.Message = $"Please try again"; return(ReturnToChallenge(model)); } await _siteConnector.Challenge(_identity ?? model.Identity, $"api/challenge/passed/{model.EntityType}/{model.Identifier}"); MvcApplication.Challenges.Remove(model.ChallengeId); return(Redirect(model.ReturnTo)); }