public async Task <AuthenticateResponse> Authenticate(AuthenticateRequest model, string ipAddress) { var merchant = await _merchantRepository.FindByUserName(model.Username); if (merchant == null) { return(null); } if (_hashingProvider.Validate(model.Password, merchant.PasswordSalt, merchant.PasswordHash) == false) { return(null); } return(await GenerateToken(ipAddress, merchant)); }