public async Task <AccessToken> ExchangeAsync(string code, User user, string redirectUrl) { var token = await FetchTokenAsync($"https://login.questrade.com/oauth2/token?client_id={QuestradeSettings.ConsumerKey}&code={code}&grant_type=authorization_code&redirect_uri={redirectUrl}"); var accessToken = new AccessToken { Value = token.AccessToken, ApiServer = token.ApiServer }; var accounts = await AccountApi.FindAccountsAsync(accessToken); var connection = await ConnectionReader.ReadByUserBrokerageAsync(user.Id, Brokerage.Questrade.Id, accounts.UserId); if (connection == null) { connection = new Connection { User = user, Brokerage = Brokerage.Questrade, BrokerageUserId = accounts.UserId } } ; connection.RefreshToken = token.RefreshToken; await ConnectionWriter.WriteAsync(connection); return(accessToken); }
public void ListAllPages_WhenSuppliedEmailIsValid_ListsPages(WireDataFormat format) { var client = TestContext.CreateClientInvalidCredentials(format); var accountClient = new AccountApi(client.HttpChannel); accountClient.ListAllPages("*****@*****.**"); }
public void RequestPassWordReminder_WhenSuppliedKnownEmail_ReturnsTrue(WireDataFormat format) { var client = TestContext.CreateClientInvalidCredentials(format); var accountClient = new AccountApi(client.HttpChannel); accountClient.RequestPasswordReminder(TestContext.TestUsername); }
public void testCreateAccount() { BlockchainAccount account = AccountApi.createAccount(); account.PublicKey.ShouldNotBe(null); account.Key.ShouldNotBe(null); }
public static void AddCompanies(List <BimCompany> companies) { AccountApi _companiesApi = new AccountApi(GetToken, _options); IRestResponse response = _companiesApi.PostCompanies(companies); HandleAddCompaniesResponse(response); }
public void testLoadAccount() { BlockchainAccount account = AccountApi.loadAccount(publicKey, privateKey); account.Key.ShouldNotBe(null); account.PublicKey.ShouldNotBe(null); }
public static void AddAccountUsers(List <HqUser> users) { AccountApi _usersApi = new AccountApi(GetToken, _options); IRestResponse response = _usersApi.PostUsers(users); HandleAddUsersResponse(response); }
private void loginForm_Load(object sender, EventArgs e) { account = AccountApi.Instance(); api = new ApiAsian(account); userName.Text = "main_bettor"; password.Text = "192shilo291"; }
public AuthorizationService(Configuration apiConfiguration, String authorizationPrefix) { AuthorizationPrefix = authorizationPrefix; ServiceConfiguration = apiConfiguration; ServiceConfiguration.AddApiKeyPrefix("Authorization", "Bearer"); AccountApi = new AccountApi(apiConfiguration); }
private void loginForm_Load(object sender, EventArgs e) { account = AccountApi.Instance(); api = new ApiAsian(account); userName.Text = "victor"; password.Text = "kuznechnaya"; }
public void IsEmailRegistered_WhenSuppliedEmailUnlikelyToExist_ReturnsFalse(WireDataFormat format) { var client = TestContext.CreateClientInvalidCredentials(format); var accountClient = new AccountApi(client.HttpChannel); var exists = accountClient.IsEmailRegistered(Guid.NewGuid().ToString() + "@justgiving.com"); Assert.IsFalse(exists); }
public void RequestRetrieveAccount_ReturnsAccountDetails(WireDataFormat format) { var client = TestContext.CreateClientInvalidCredentials(format); var accountClient = new AccountApi(client.HttpChannel); var account = accountClient.RetrieveAccount(); Assert.AreEqual(TestContext.TestUsername, account.Email); }
public BitmovinApi(IBitmovinApiClientFactory apiClientFactory) { Account = new AccountApi(apiClientFactory); Analytics = new AnalyticsApi(apiClientFactory); Encoding = new EncodingApi(apiClientFactory); General = new GeneralApi(apiClientFactory); Notifications = new NotificationsApi(apiClientFactory); Player = new PlayerApi(apiClientFactory); }
public void IsEmailRegistered_WhenSuppliedKnownEmail_ReturnsTrue(WireDataFormat format) { var client = TestContext.CreateClientInvalidCredentials(format); var accountClient = new AccountApi(client.HttpChannel); var exists = accountClient.IsEmailRegistered(TestContext.TestUsername); Assert.IsTrue(exists); }
public IActionResult LRSetPassword([FromBody] SetPasswordModel setPasswordModel, [FromQuery(Name = "uid")] String uid) { var apiresponse = new AccountApi().SetAccountPasswordByUid(setPasswordModel.Password, uid); if (apiresponse.RestException != null) { return(StatusCode(400, Json(apiresponse.RestException))); } return(Json(apiresponse.Response)); }
public async Task TestGetAccountBalancesAsync() { var accountBalances = await AccountApi.GetAccountBalancesAsync(); Assert.IsNotNull(accountBalances, "accountBalances is null 1"); accountBalances = await AccountApi.GetAccountBalancesAsync(hideZeroBalances : true); Assert.IsNotNull(accountBalances, "accountBalances is null 2"); }
public MainWindow() { InitializeComponent(); this.generalApi = new GeneralApi(this.apiKey, this.secret, this.passPhrase); this.futureApi = new FuturesApi(this.apiKey, this.secret, this.passPhrase); this.accountApi = new AccountApi(this.apiKey, this.secret, this.passPhrase); this.DataContext = new MainViewModel(); }
public IActionResult LRUpdate([FromBody] AccountUserProfileUpdateModel updateModel, [FromQuery(Name = "uid")] String uid) { var apiresponse = new AccountApi().UpdateAccountByUid(updateModel, uid); if (apiresponse.RestException != null) { return(StatusCode(400, Json(apiresponse.RestException))); } return(Json(apiresponse.Response)); }
public void AddAccount(int clientId) { AccountApi account = new AccountApi() { Balance = 740, ClientId = clientId }; dbContext.Accounts.Add(account); dbContext.SaveChanges(); }
public static void ExampleMethod(string siteURL, string username, string password, string tenant = null, string branch = null, string locale = null) { var authApi = new AuthApi(siteURL, requestInterceptor: RequestLogger.LogRequest, responseInterceptor: RequestLogger.LogResponse); try { var configuration = authApi.LogIn(username, password, tenant, branch, locale); Console.WriteLine("Reading Accounts..."); var accountApi = new AccountApi(configuration); var accounts = accountApi.GetList(top: 5); foreach (var account in accounts) { Console.WriteLine("Account Nbr: " + account.AccountCD.Value + ";"); } Console.WriteLine("Reading Sales Order by Keys..."); var salesOrderApi = new SalesOrderApi(configuration); var order = salesOrderApi.GetByKeys(new List <string>() { "SO", "SO005207" }); Console.WriteLine("Order Total: " + order.OrderTotal.Value); var shipmentApi = new ShipmentApi(configuration); var shipment = shipmentApi.GetByKeys(new List <string>() { "002805" }); Console.WriteLine("ConfirmShipment"); shipmentApi.WaitActionCompletion(shipmentApi.InvokeAction(new ConfirmShipment(shipment))); Console.WriteLine("CorrectShipment"); shipmentApi.WaitActionCompletion(shipmentApi.InvokeAction(new CorrectShipment(shipment))); } catch (Exception e) { Console.WriteLine(e.Message); } finally { //we use logout in finally block because we need to always logut, even if the request failed for some reason if (authApi.TryLogout()) { Console.WriteLine("Logged out successfully."); } else { Console.WriteLine("An error occured during loguot."); } } }
public void Register_WhenSuppliedEmailIsUnused_AccountIsCreatedAndEmailAddressReturned(WireDataFormat format) { var client = TestContext.CreateClientInvalidCredentials(format); var accountClient = new AccountApi(client.HttpChannel); var email = Guid.NewGuid() + "@tempuri.org"; var request = CreateValidRegisterAccountRequest(email); var registeredUsersEmail = accountClient.Create(request); Assert.AreEqual(email, registeredUsersEmail); }
private void Click_LoginEvent(object sender, FocusEventArgs e) { var loginName = this.LoginName.Text; var loginPassword = this.LoginPassword.Text; var result = AccountApi.Login(loginName, loginPassword); if (result) { DisplayAlert("登录提示", "登录成功!", "OK"); Navigation.PushAsync(new MainPage()); } }
private void SetupApis() { Error = new ErrorApi { Client = this }; Account = new AccountApi { Client = this }; Application = new ApplicationApi { Client = this }; AvailableNumber = new AvailableNumberApi { Client = this }; Bridge = new BridgeApi { Client = this }; Domain = new DomainApi { Client = this }; Call = new CallApi { Client = this }; Conference = new ConferenceApi { Client = this }; Message = new MessageApi { Client = this }; NumberInfo = new NumberInfoApi { Client = this }; PhoneNumber = new PhoneNumberApi { Client = this }; Recording = new RecordingApi { Client = this }; Transcription = new TranscriptionApi { Client = this }; Media = new MediaApi { Client = this }; Endpoint = new EndpointApi { Client = this }; V2 = new ApiV2 { Message = new Bandwidth.Net.ApiV2.MessageApi { Client = this } }; }
public void Interest_WhenSuppliedValidCredentials_ReturnListOfInterest(WireDataFormat format) { //arrange var client = TestContext.CreateClientInvalidCredentials(format); var accountClient = new AccountApi(client.HttpChannel); //act var result = accountClient.Interest(); //assert Assert.IsNotNull(result); }
public void SetUp() { userManager = Substitute.For <IUserManager>(); signInManager = Substitute.For <ISignInManager>(); var logger = Substitute.For <ILogger <AccountApi> >(); var tokenHelper = Substitute.For <ITokenHelper>(); var applicationUserService = Substitute.For <IApplicationUserService>(); testObj = new AccountApi(signInManager, tokenHelper, logger, applicationUserService) { ControllerContext = { HttpContext = new DefaultHttpContext() }, }; }
private static List <BusinessUnit> GetBusinessUnits() { if (_options == null) { return(null); } AccountApi _businessUnitsApi = new AccountApi(GetToken, _options); List <BusinessUnit> result = new List <BusinessUnit>(); _businessUnitsApi.GetBusinessUnits(out result); return(result); }
private static List <BimCompany> GetCompanies() { if (_options == null) { return(null); } AccountApi _compApi = new AccountApi(GetToken, _options); List <BimCompany> result = new List <BimCompany>(); _compApi.GetCompanies(out result); return(result); }
internal static List <HqUser> GetAccountUsers(string accountId) { if (_options == null) { return(null); } AccountApi _userApi = new AccountApi(GetToken, _options); List <HqUser> result = new List <HqUser>(); _userApi.GetAccountUsers(out result, accountId); return(result); }
private static List <HqUser> GetAccountUsers() { if (_options == null) { return(null); } AccountApi _userApi = new AccountApi(GetToken, _options); List <HqUser> result = new List <HqUser>(); _userApi.GetAccountUsers(out result); return(result); }
private HqUser GetAdminUserFromTargetHub(string email, string accountId) { if (_options == null) { return(null); } AccountApi _userApi = new AccountApi(GetToken, _options); List <HqUser> result = new List <HqUser>(); _userApi.GetAccountUsers(out result, accountId); return(result.Find(x => x.email == email)); }
static void Main(string[] args) { ApiInvoker.UseRefreshTokenStorage(new ApiRefreshTokenStorage()); ApiInvoker.ClientID = "wfOrgWebApp"; ApiInvoker.ClientSecret = "5YV7M1r981yoGhELyB84aC+KiYksxZf1OY3++C1CtRM="; // Example calls to api endpoints. // Each api method throws an ApiException if something went wrong and should be wrapped in try..catch statement. try { // Authenticate with password Console.WriteLine("Authenticate with password..."); var accountApi = new AccountApi(); TokenResponseModel tokenResponse = accountApi.Account_TokenWithPassword("*****@*****.**", "worldfavor47", "wfOrgWebApp", "5YV7M1r981yoGhELyB84aC+KiYksxZf1OY3++C1CtRM="); // Store bearer //// Get public filters (for the user to select) //Console.WriteLine("Get public filters..."); //var filtersApi = new FiltersApi(); //List<Layer> filters = filtersApi.Filters_Get(bearerToken); //// Search organizations by name //Console.WriteLine("Search organizations by name..."); //var organizatiosnApi = new OrganizationsApi(); //List<Organization> orgs = organizatiosnApi.Organizations_GetBySearchString("volvo", bearerToken); // Create influence Console.WriteLine("Create influence..."); var influencseApi = new InfluencesApi(); InfluenceResultModel influenceResult = influencseApi.Influences_CreateFromOrgDomain(new OrgDomainViewModel() { Domain = "www.test.se" }, bearerToken ); Console.WriteLine(JsonConvert.SerializeObject(influenceResult)); influenceResult. ////Influence influence = influencseApi.Influences_Create(new InfluenceViewModel() { // Returns the newly created influence //// FilterId = filters.First().Id, //// OrganizationId = orgs.First().Id, //// OrgInputMethod = 1 // 1 = Search, 2 = GeoLocation, 3 = BarCode, 4 = BankTransaction ////}, bearerToken); // Get influence history (recent influences made by the user) //Console.WriteLine("\nGet influence history..."); //List<Influence> influences = influencseApi.Influences_GetByUser(null, null, null, bearerToken); //foreach (var item in influences) //{ // Console.WriteLine("FILTER: {0} ORG: {1} AT(UTC): {2}", item.Filter.Title, item.Organization.Name, item.CreatedAt); //} // Create influence with organization domain Console.WriteLine("\nDone!"); } catch (ApiException e) { Console.WriteLine("{0}: {1}", e.ApiError.Code, e.ApiError.Message); } Console.ReadKey(); }