public void TestSetup() { this._consumerProfile = new ConsumerProfile() { ConsumerKey = "ConsumerKey", ConsumerSecret = "ConsumerSecret" }; this._restProfile = new RestProfile() { AppToken = "AppToken", DataSource = 1, OAuthAccessToken = "OAuthAccessToken", OAuthAccessTokenSecret = "OAuthAccessTokenSecret", RealmId = "RealmId" }; this._quickBooksAuthenticatedUserCredentials = new QuickBooksOnlineAuthenticatedUserCredentials( this._restProfile.RealmId, this._restProfile.OAuthAccessToken, this._restProfile.OAuthAccessTokenSecret, this._restProfile.DataSource); this._quickBooksNonAuthenticatedUserCredentials = new QuickBooksOnlineNonAuthenticatedUserCredentials( this._restProfile.AppToken, this._consumerProfile.ConsumerKey, this._consumerProfile.ConsumerSecret, "http://localhost:27286/home/Callback"); this._quickBooksService = new QuickBooksOnlineService(this._quickBooksAuthenticatedUserCredentials, this._quickBooksNonAuthenticatedUserCredentials); }
public void TestSetup() { this._consumerProfile = this._testDataReader.ConsumerProfile; this._restProfile = this._testDataReader.RestProfile; //this._quickBooksOnlineServiceSdk = new QuickBooksOnlineServiceSdk( this._restProfile, this._consumerProfile ); this._quickBooksAuthenticatedUserCredentials = new QuickBooksOnlineAuthenticatedUserCredentials( this._restProfile.RealmId, this._restProfile.OAuthAccessToken, this._restProfile.OAuthAccessTokenSecret, this._restProfile.DataSource); this._quickBooksNonAuthenticatedUserCredentials = new QuickBooksOnlineNonAuthenticatedUserCredentials( this._restProfile.AppToken, this._consumerProfile.ConsumerKey, this._consumerProfile.ConsumerSecret, "http://localhost:27286/home/Callback"); this._quickBooksService = new QuickBooksOnlineService(this._quickBooksAuthenticatedUserCredentials, this._quickBooksNonAuthenticatedUserCredentials); }
public string CallBack() { if (!this.Request.QueryString.HasKeys()) { return("none"); } var quickBooksAuthenticatedUserCredentials = new QuickBooksOnlineAuthenticatedUserCredentials("", "", ""); var oauthVerifyer = this.Request.QueryString["oauth_verifier"].ToString(); quickBooksAuthenticatedUserCredentials.RealmId = this.Request.QueryString["realmId"].ToString(); var dataSourceStr = this.Request.QueryString["dataSource"].ToString(); var qbDataSource = QuickBooksOnlineNonAuthenticatedUserCredentials.ParseQBDataSource(dataSourceStr); var consumerContext = new OAuthConsumerContext { ConsumerKey = _quickBooksNonAuthenticatedUserCredentials.ConsumerKey, ConsumerSecret = _quickBooksNonAuthenticatedUserCredentials.ConsumerSecret, SignatureMethod = SignatureMethod.HmacSha1 }; IOAuthSession clientSession = new OAuthSession(consumerContext, _quickBooksNonAuthenticatedUserCredentials.GetRequestTokenUrl, _quickBooksNonAuthenticatedUserCredentials.OauthEndPoint, _quickBooksNonAuthenticatedUserCredentials.GetAccessTokenUrl); try { var requestToken = ( IToken )System.Web.HttpContext.Current.Session["requestToken"]; var accessToken = clientSession.ExchangeRequestTokenForAccessToken(requestToken, oauthVerifyer); quickBooksAuthenticatedUserCredentials.OAuthAccessToken = accessToken.Token; quickBooksAuthenticatedUserCredentials.OAuthAccessTokenSecret = accessToken.TokenSecret; } catch { } return("Success." + string.Format("AccessToken: {0}, AccessTokenSecret: {1}, RealmId: {2}", quickBooksAuthenticatedUserCredentials.OAuthAccessToken, quickBooksAuthenticatedUserCredentials.OAuthAccessTokenSecret, quickBooksAuthenticatedUserCredentials.RealmId)); }
public QuickBooksOnlineService(QuickBooksOnlineAuthenticatedUserCredentials quickBooksAuthenticatedUserCredentials, QuickBooksOnlineNonAuthenticatedUserCredentials quickBooksNonAuthenticatedUserCredentials) { this._restProfile = new RestProfile() { AppToken = quickBooksNonAuthenticatedUserCredentials.AppToken, DataSource = quickBooksAuthenticatedUserCredentials.DataSource, OAuthAccessToken = quickBooksAuthenticatedUserCredentials.OAuthAccessToken, OAuthAccessTokenSecret = quickBooksAuthenticatedUserCredentials.OAuthAccessTokenSecret, RealmId = quickBooksAuthenticatedUserCredentials.RealmId, }; this._consumerProfile = new ConsumerProfile() { ConsumerKey = quickBooksNonAuthenticatedUserCredentials.ConsumerKey, ConsumerSecret = quickBooksNonAuthenticatedUserCredentials.ConsumerSecret, }; this._quickBooksOnlineServiceSdk = new QuickBooksOnlineServiceSdk(this._restProfile, this._consumerProfile); }
public QuickBooksOnlineFactory(QuickBooksOnlineNonAuthenticatedUserCredentials quickBooksOnlineNonAuthenticatedUserCredentials) { this._nonAuthenticatedQuickBooksOnlineNonAuthenticatedUserCredentials = quickBooksOnlineNonAuthenticatedUserCredentials; }