Created
February 14, 2017 13:20
-
-
Save dineplan/8e2e20b8bccb20c7fb5026a4d5ed71ea to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public void GetName(){ | |
try | |
{ | |
var myQb = MyQb(); | |
if (myQb != null) | |
{ | |
TimeSpan retryInterval = new TimeSpan(0, 0, 0, 1);// To give a time interval of 1 second | |
QbTokenDto token = JsonConvert.DeserializeObject<QbTokenDto>(myQb.Settings); | |
OAuthRequestValidator oauthValidator = new OAuthRequestValidator(token.Token, token.TokenSecret, ConsumerKey, ConsumerSecret); | |
ServiceContext context = new ServiceContext(AppToken, token.Realm, IntuitServicesType.QBO, oauthValidator); | |
context.IppConfiguration.MinorVersion.Qbo = "5"; | |
context.IppConfiguration.BaseUrl.Qbo = "https://sandbox-quickbooks.api.intuit.com/"; | |
context.IppConfiguration.Message.Request.SerializationFormat = SerializationFormat.Json; | |
context.IppConfiguration.Message.Response.SerializationFormat = SerializationFormat.Json; | |
context.IppConfiguration.Message.Request.CompressionFormat = CompressionFormat.GZip; | |
context.IppConfiguration.Message.Response.CompressionFormat = CompressionFormat.GZip; | |
context.IppConfiguration.RetryPolicy = new Intuit.Ipp.Retry.IntuitRetryPolicy(5, retryInterval); | |
DataService service = new DataService(context); | |
Customer customer = new Customer() | |
{ | |
Id = "59" | |
}; | |
Customer resC = service.FindById(customer) as Customer; | |
var mess = resC.DisplayName; | |
} | |
} | |
catch (IdsException exception) | |
{ | |
var mess = exception.Message; | |
throw; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment