public ActionResult ObtainAccessToken() { //create new verification string _squarePaymentSettings.AccessTokenVerificationString = Guid.NewGuid().ToString(); _settingService.SaveSetting(_squarePaymentSettings); //get the URL to directs a Square merchant's web browser var redirectUrl = _squarePaymentManager.GenerateAuthorizeUrl(_squarePaymentSettings.AccessTokenVerificationString); return(Json(new { url = redirectUrl })); }
public IActionResult ObtainAccessToken(ConfigurationModel model) { //whether user has the authority if (!_permissionService.Authorize(StandardPermissionProvider.ManagePaymentMethods)) { return(AccessDeniedView()); } //get the URL to directs a Square merchant's web browser var redirectUrl = _squarePaymentManager.GenerateAuthorizeUrl(); return(Redirect(redirectUrl)); }
public IActionResult ObtainAccessToken(ConfigurationModel model) { if (!_permissionService.Authorize(StandardPermissionProvider.ManagePaymentMethods)) { return(AccessDeniedView()); } //create new verification string _squarePaymentSettings.AccessTokenVerificationString = Guid.NewGuid().ToString(); _settingService.SaveSetting(_squarePaymentSettings); //get the URL to directs a Square merchant's web browser var redirectUrl = _squarePaymentManager.GenerateAuthorizeUrl(); return(Redirect(redirectUrl)); }
public IActionResult ObtainAccessToken(ConfigurationModel model) { if (!_permissionService.Authorize(StandardPermissionProvider.ManagePaymentMethods)) { return(AccessDeniedView()); } //load settings for a chosen store scope var storeId = _storeContext.ActiveStoreScopeConfiguration; var settings = _settingService.LoadSetting <SquarePaymentSettings>(storeId); //create new verification string settings.AccessTokenVerificationString = Guid.NewGuid().ToString(); _settingService.SaveSetting(settings, x => settings.AccessTokenVerificationString, storeId); //get the URL to directs a Square merchant's web browser var redirectUrl = _squarePaymentManager.GenerateAuthorizeUrl(storeId); return(Redirect(redirectUrl)); }