Skip to content

Instantly share code, notes, and snippets.

@dineplan
Created February 14, 2017 13:20
Show Gist options
  • Save dineplan/8e2e20b8bccb20c7fb5026a4d5ed71ea to your computer and use it in GitHub Desktop.
Save dineplan/8e2e20b8bccb20c7fb5026a4d5ed71ea to your computer and use it in GitHub Desktop.
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