This file contains 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
// #DotNetDevKitV2 #Customer #QBD | |
//Simple routine to add QBD customer | |
//Documentation: http://goo.gl/XGNz4 | |
var oauthValidator = new OAuthRequestValidator(accessToken, accessTokenSecret, consumerKey,consumerSecret); | |
var context = new ServiceContext(oauthValidator, realmId, IntuitServicesType.QBD); | |
var commonService = new DataServices(context); | |
var cust = new Intuit.Ipp.Data.Qbd.Customer() | |
{ |
This file contains 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
// #DotNetDevKitV2 #Customer #QBD | |
//Retrieve Active QBD Customers with a minimum balance | |
//Documentation: http://goo.gl/jUdxR | |
var oauthValidator = new OAuthRequestValidator(accessToken, accessTokenSecret, consumerKey,consumerSecret); | |
var context = new ServiceContext(oauthValidator, realmId, IntuitServicesType.QBD); | |
var commonService = new DataServices(context); | |
var qbdCustomerQuery = new Intuit.Ipp.Data.Qbd.CustomerQuery | |
{ | |
ActiveOnly = true, |
This file contains 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
//Documentation: http://docs.developer.intuit.com/0025_Intuit_Anywhere/0060_Reference/3002_Reconnect_API | |
public string CallReconnectAPI(DataServices dataServices) | |
{ | |
HttpWebRequest httpWebRequest = WebRequest.Create("https://appcenter.intuit.com/api/v1/Connection/Reconnect") as HttpWebRequest; | |
httpWebRequest.Method = "GET"; | |
httpWebRequest.Headers.Add("Authorization", GetDevDefinedOAuthHeader(dataServices,httpWebRequest, "")); | |
UTF8Encoding encoding = new UTF8Encoding(); | |
HttpWebResponse httpWebResponse = httpWebRequest.GetResponse() as HttpWebResponse; | |
using (Stream data = httpWebResponse.GetResponseStream()) |
This file contains 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
//Add QBO TimeActivity | |
//Documentation: http://goo.gl/DjJyb | |
List<Employee> employees = commonService.FindAll(new Employee(), 1, 1).ToList<Employee>(); | |
List<Customer> customers = commonService.FindAll(new Customer(), 1, 1).ToList<Customer>(); | |
TimeActivity timeActivity = new TimeActivity(); | |
timeActivity.BillableStatus = BillableStatusEnum.Billable; | |
timeActivity.BillableStatusSpecified = true; | |
timeActivity.Hours = "8"; |
This file contains 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
IEnumerable<Customer> customers = GetQboCustomers(dataService, 1, 100, false); | |
public List<Intuit.Ipp.Data.Qbo.Customer> GetQboCustomers(DataServices dataServices, int startPage, int resultsPerPage, bool includeJobs) | |
{ | |
StringBuilder requestXML = new StringBuilder(); | |
StringBuilder responseXML = new StringBuilder(); | |
var requestBody = String.Format("PageNum={0}&ResultsPerPage={1}", startPage, resultsPerPage); | |
if (!includeJobs) { requestBody += "&Filter=IncludeJobs :EQUALS: false"; } |
This file contains 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 string GetQbdPurchaseOrders(DataServices dataServices, int startPage, int chunkSize) | |
{ | |
HttpWebRequest httpWebRequest = WebRequest.Create(dataServices.ServiceContext.BaseUrl + "purchaseorder/v2/" + dataServices.ServiceContext.RealmId) as HttpWebRequest; | |
httpWebRequest.Method = "POST"; | |
httpWebRequest.ContentType = "text/xml"; | |
string requestBody = String.Format("<PurchaseOrderQuery xmlns=\"http://www.intuit.com/sb/cdm/v2\"><StartPage>{0}</StartPage><ChunkSize>{1}</ChunkSize></PurchaseOrderQuery>", startPage, chunkSize); | |
httpWebRequest.Headers.Add("Authorization", GetDevDefinedOAuthHeader(dataServices, httpWebRequest, requestBody.ToString())); | |
UTF8Encoding encoding = new UTF8Encoding(); | |
byte[] content = encoding.GetBytes(requestBody.ToString()); | |
using (var stream = httpWebRequest.GetRequestStream()) |
This file contains 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
//List<Item> items = GetQboItemsWithDateTimeFiler(commonService, 1, 100, new DateTime(2013, 6, 30, 11, 0, 0)); | |
public List<Intuit.Ipp.Data.Qbo.Item> GetQboItemsWithDateTimeFiler(DataServices dataServices, int startPage, int resultsPerPage, DateTime filterCreateTimeAfter) | |
{ | |
var filter = "CreateTime :AFTER: " + filterCreateTimeAfter.ToString("yyyy-MM-dd\"T\"HH:mm:sszzz"); | |
var httpWebRequest = WebRequest.Create(dataServices.ServiceContext.BaseUrl + "items/v2/" + dataServices.ServiceContext.RealmId) as HttpWebRequest; | |
if (httpWebRequest != null) | |
{ |
This file contains 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
int institutionLoginId = 3333; //Returned from DiscoverAndAddAccounts call | |
InstitutionLogin institutionLogin = new InstitutionLogin(); //Instantiate the object but do not specify credentials | |
Challenges challenges = new Challenges(); | |
AggregationCategorizationService aggCategorizationService = Services.CADService.GetService(Cache, HttpContext.Current.User.Identity.Name); | |
aggCategorizationService.UpdateInstitutionLogin(institutionLoginId, institutionLogin, true, out challenges); |
This file contains 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
Intuit.Ipp.Data.Qbo.Invoice invoice = new Intuit.Ipp.Data.Qbo.Invoice(); | |
Intuit.Ipp.Data.Qbo.InvoiceHeader invoiceHeader = new Intuit.Ipp.Data.Qbo.InvoiceHeader(); | |
invoiceHeader.DocNumber = "AUTO_GENERATE"; | |
invoiceHeader.TxnDate = new DateTime(2013, 09, 04); | |
invoiceHeader.TxnDateSpecified = true; | |
invoiceHeader.CustomerId = new Intuit.Ipp.Data.Qbo.IdType() { idDomain = Intuit.Ipp.Data.Qbo.idDomainEnum.QBO, Value = "12" }; | |
invoiceHeader.SubTotalAmt = 100; | |
invoiceHeader.SubTotalAmtSpecified = true; | |
invoiceHeader.TotalAmt = 100; |
This file contains 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
static void CreateQBOInvoice(DataService dataService, ServiceContext context) | |
{ | |
//Find Customer | |
QueryService<Customer> customerQueryService = new QueryService<Customer>(context); | |
Customer customer = customerQueryService.ExecuteIdsQuery("Select * From Customer StartPosition 1 MaxResults 1").FirstOrDefault<Customer>(); | |
//Find Tax Code for Invoice - Searching for a tax code named 'StateSalesTax' in this example | |
QueryService<TaxCode> stateTaxCodeQueryService = new QueryService<TaxCode>(context); | |
TaxCode stateTaxCode = stateTaxCodeQueryService.ExecuteIdsQuery("Select * From TaxCode Where Name='StateSalesTax' StartPosition 1 MaxResults 1").FirstOrDefault<TaxCode>(); |
OlderNewer