GithubHelp home page GithubHelp logo

sampleapp-crud_.net_oauth2's Introduction

Rate your SampleYesNo

SampleApp-CRUD-.Net for Oauth2 apps

CRUD sample for V3 .Net SDK (This sample app has NO UI to show QBO APi calls request or response. It has UI for just the Oauth flow and then please run it in debug mode after enabling logging on Test class to understand how the api calls are made.)

Welcome to the Intuit Developer's .Net Sample App for CRUD operations.

This sample app is meant to provide working examples of how to integrate your app with the Intuit Small Business ecosystem. Specifically, this sample application demonstrates the following:

  • Create, Read, Query, Update, Delete, Void entities.
  • All operations are performed using QuickBooks .Net V3 SDK.

Please note that while these examples work, features not called out above are not intended to be taken and used in production business applications. In other words, this is not a seed project to be taken cart blanche and deployed to your production environment.

For example, certain concerns are not addressed at all in our samples (e.g. security, privacy, scalability). In our sample apps, we strive to strike a balance between clarity, maintainability, and performance where we can. However, clarity is ultimately the most important quality in a sample app.

Therefore there are certain instances where we might forgo a more complicated implementation (e.g. caching a frequently used value, robust error handling, more generic domain model structure) in favor of code that is easier to read. In that light, we welcome any feedback that makes our samples apps easier to learn from.

Table of Contents

Requirements

In order to successfully run this sample app you need a few things:

  1. .Net Framework 4.6.1
  2. A developer.intuit.com account
  3. An app on developer.intuit.com created after Jul 17th, 2017 as only those accounts have Ouath2 apps and the associated client id, client secret and redirect url mapping to what you have in the web.config of this app (http://localhost:49372/Default.aspx)
  4. One sandbox company, connect the company with your app and generate the OAuth tokens.
  5. Update QuickBooks .Net SDK using Nuget (https://www.nuget.org/packages/IppDotNetSdkForQuickBooksApiV3/) to the latest version.

First Use Instructions

  1. Clone the GitHub repo to your computer
  2. Update Nuget Package for .Net to the latest version.
  3. Fill in the web.config file values (cient id, client secret, redirect url, app environment and log folder) by copying over from the keys section for your app. tab->Set time duration in seconds for 180 days and get the access token and secret for your app and company by right clicking on the page and doing a view source.
  4. Build and run.

Running the code

This app is directed to provide individual sample code for CRUD operations for various QBO entities. Set Default.aspx as start page and run.

Notes:

  1. The sample code has been implemented for US locale company, certain fields may not be applicable for other locales or minor version. Care should be taken to handle such scenarios separately.
  2. Before running AttachableUpload sample, update the path of the pdf that you wish to upload to point to your local directory.
  3. This app uses new OAuth2Client. If you want to refer the other way to use standalone OAuth2 clients, download v1.0 from Release tab

Sample for printing report on UI is available here- https://gist.github.com/IntuitDeveloperRelations/10672073

sampleapp-crud_.net_oauth2's People

Contributors

diana-derose avatar nbhambhani avatar nimisha84 avatar rkasaraneni20 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

sampleapp-crud_.net_oauth2's Issues

Invoice Line Items creating without Quantity or Price

I am using the code in this solution as an example, but for some reason the Invoice it creates does not contain any Quantity or Price despite me specifying it.

Here is my code:

` var customerCrud = new CustomerCRUD();

			// Initialize Service
			QBOServiceInitializer serviceInitializer = new QBOServiceInitializer(dictionary["accesstoken"], dictionary["refreshtoken"], dictionary["realmid"]);
			var serviceContext = serviceInitializer.InitializeQBOServiceContextUsingoAuth();
			serviceContext.IppConfiguration.BaseUrl.Qbo = AppController.qbobaseurl;

			var customer = new Customer();
			customer = customerCrud.CustomerFindByEmail("[email protected]", serviceContext);

			if (customer != null)
			{
				// Create Invoice for Customer
				Customer customer2 = customer; // Helper.FindOrAdd<Customer>(serviceContext, customer);
				TaxCode taxCode = Helper.FindOrAdd<TaxCode>(serviceContext, new TaxCode());
				Account account = Helper.FindOrAddAccount(serviceContext, AccountTypeEnum.AccountsReceivable, AccountClassificationEnum.Liability);

				Invoice invoice = new Invoice();
				invoice.Deposit = new Decimal(0.00);
				invoice.DepositSpecified = true;

				invoice.PaymentType = PaymentTypeEnum.CreditCard;

				invoice.CustomerRef = new ReferenceType()
				{
					name = customer.DisplayName,
					Value = customer.Id
				};

				invoice.DueDate = DateTime.UtcNow.Date;
				invoice.DueDateSpecified = true;


				invoice.TotalAmt = new Decimal(10.00);
				invoice.TotalAmtSpecified = true;

				invoice.ApplyTaxAfterDiscount = false;
				invoice.ApplyTaxAfterDiscountSpecified = true;

				invoice.PrintStatus = PrintStatusEnum.NotSet;
				invoice.PrintStatusSpecified = true;
				invoice.EmailStatus = EmailStatusEnum.NotSet;
				invoice.EmailStatusSpecified = true;

				EmailAddress billEmail = new EmailAddress();
				billEmail.Address = @"[email protected]";
				billEmail.Default = true;
				billEmail.DefaultSpecified = true;
				billEmail.Tag = "Tag";
				invoice.BillEmail = billEmail;

				EmailAddress billEmailcc = new EmailAddress();
				billEmailcc.Address = @"[email protected]";
				billEmailcc.Default = true;
				billEmailcc.DefaultSpecified = true;
				billEmailcc.Tag = "Tag";
				invoice.BillEmailCc = billEmailcc;

				EmailAddress billEmailbcc = new EmailAddress();
				billEmailbcc.Address = @"[email protected]";
				billEmailbcc.Default = true;
				billEmailbcc.DefaultSpecified = true;
				billEmailbcc.Tag = "Tag";
				invoice.BillEmailBcc = billEmailbcc;


				invoice.Balance = new Decimal(10.00);
				invoice.BalanceSpecified = true;
				invoice.TxnDate = DateTime.UtcNow.Date;
				invoice.TxnDateSpecified = true;

				List<Line> lineList = new List<Line>();
				Line line = new Line();
				line.Description = "Line Item 1";
				line.Amount = new Decimal(100.00);
				line.AmountSpecified = true;

				line.DetailType = LineDetailTypeEnum.SalesItemLineDetail;
				line.DetailTypeSpecified = true;

				SalesItemLineDetail salesLineItem = new SalesItemLineDetail()
				{
					ItemRef = new ReferenceType()
					{
						name = "Weekly_Meals"//,
											 //Value = ""
					},
					Qty = 1,
					QtySpecified = true,
					ServiceDate = DateTime.Now.Date,
					ServiceDateSpecified = true,
					TaxInclusiveAmt = Convert.ToDecimal(100.00)
				};

				// Set Price
				//salesLineItem.AnyIntuitObject = orderItem.Price;
				//salesLineItem.ItemElementName = ItemChoiceType.UnitPrice;

				line.AnyIntuitObject = salesLineItem;


				lineList.Add(line);
				invoice.Line = lineList.ToArray();
				invoice.TxnTaxDetail = new TxnTaxDetail()
				{
					TotalTax = Convert.ToDecimal(10),
					TotalTaxSpecified = true
				};

				Invoice added = Helper.Add<Invoice>(serviceContext, invoice);`

Any help provided would be much appreciated.

Thanks,
Pete

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.