public async Task <ActionResult> DoLogin() { var callbackURL = Url.Action("Process", "Login", routeValues: null, protocol: Request.Url.Scheme); var userAuthorization = PaymixAuthService.GetClient().PrepareRequestUserAuthorization(scopes: new string[] { "USER_FINANCIAL", "PUBLIC_DATA" }, returnTo: new Uri(callbackURL)); userAuthorization.Send(HttpContext); Response.End(); return(View("~/Views/Home/Index.cshtml")); }
public async Task <ActionResult> ProcessLogin() { var accessToken = Request.Form["AccessToken"]; if (string.IsNullOrEmpty(accessToken)) { var authorizationState = PaymixAuthService.GetClient().ProcessUserAuthorization(Request); if (authorizationState != null) { Session["veloxxa_access_token"] = authorizationState.AccessToken; } } // This example keeps it in the session. You don't have to //Session["veloxxa_access_token"] = userAuthorization return(RedirectToAction("Index", "Home")); }
public async Task <ActionResult> Index() { if (Session["veloxxa_access_token"] != null) { // SAMPLE CALL THAT GETS OPEN EWALLETS var client = new HttpClient(PaymixAuthService.GetClient().CreateAuthorizingHandler(Session["veloxxa_access_token"].ToString())); try { var result = await client.GetStringAsync(new Uri(PaymixAuthService.URL + "Members/Account")); JObject jsonAccount = JObject.Parse(result); var accountlist = (JArray)(jsonAccount["responseBody"]); ViewBag.AccountList = accountlist.ToObject <List <Account> >(); } catch (Exception ex) { } // SAMPLE CALL THAT GETS CUSTOMER KYC DETAILS /* result = await client.GetStringAsync(new Uri(PaymixAuthService.URL + "/Members/Profile")); * var profileData = ((JArray)JObject.Parse(result)["responseBody"])[0]; * ViewBag.Profile = profileData.ToObject<Profile>();*/ // Load Dashboard /*; * * ViewBag.ApiResponse = body; */ } return(View()); }
public async Task <ActionResult> Send(string sendAmount) { if (Session["veloxxa_access_token"] != null) { var amount = Decimal.Parse(sendAmount).ToString("N2"); // SAMPLE CALL THAT SENDS MONEY TO MERCHANT var result = await Service.PaymixResourceService.SendFundsToMerchant("MER_TEST", amount, "EUR", Session["veloxxa_access_token"].ToString() , new HttpClient(PaymixAuthService.GetClient().CreateAuthorizingHandler(Session["veloxxa_access_token"].ToString()))); var profileData = ((JArray)JObject.Parse(result)["responseBody"])[0]; } return(View()); }