quickbooks

The quickbooks package gives you all the tools you need to get the date from QuickbooksPlatform in dart.

Installation

In the dependencies: section of your pubspec.yaml, add the following line:

dependencies:
  quickbooks: <latest_version>

To import it in your dart file, add the following line:

import 'package:quickbooks/quickbooks.dart';

Getting started

To use the different features of this project, you will need:

  1. A Quickbooks developper account: https://developer.intuit.com/app/developer/qbdesktop/docs/get-started/create-an-intuit-developer-account
  2. A quickbooks app: https://developer.intuit.com/app/developer/qbo/docs/get-started/start-developing-your-app

Your Quickbooks app will give you a client_id and a client_secret keys: https://developer.intuit.com/app/developer/qbo/docs/get-started/get-client-id-and-client-secret

You can set these values in the environment variables as QUICKBOOKS_CLIENT_ID and QUICKBOOKS_CLIENT_SECRET or set it directly on the Oauth2 authentification service.

Environment

This package is set to use automatically the environment variables of your system if you didn't specify values to services that uses them.

The environment variables used by this package are:

  • QUICKBOOKS_CLIENT_ID: The id of the app you use.
  • QUICKBOOKS_CLIENT_SECRET: The secret key of the app you use.
  • QUICKBOOKS_REDIRECT_URI: The uri Oauth2 will redirect after connection to send informations.
  • QUICKBOOKS_STATE: The confirmation string used by Oauth2 to confirm a connection is valid.
  • QUICKBOOKS_IS_PRODUCTION: Boolean that specifies if the app is in production or in sandbox mode. Will be automatically set to production if no value is given.

Features

Oauth2 connection

You can use this package to connect to a Quickbooks account via Oauth2 authentification standard.

To perform an authentification, you must:

  1. Generate an authentification url for your quickbooks app. Example:
var service = QuickbooksOauth2Service(
    clientId: QuickbooksEnvironment.clientId,
    clientSecret: QuickbooksEnvironment.clientSecret,
    redirectUrl: QuickbooksEnvironment.redirectUri,
    isProduction: QuickbooksEnvironment.isProduction,
);

String authUrl = await service.getAuthUrl();
  1. Get the authentification code and realm id by receiving it at the redirection url (set in the QUICKBOOKS_REDIRECT_URI environment variable or directly on the service). You must run you own api to do so.
  2. Get the tokens from the authentification code and realm id. Example:
QuickbooksOauth2Tokens tokens =
      await service.getTokens(authorizationCode: code, realmId: realmId);

You now have the tokens you need to query the Quickbooks api.

Data management

This package can manage these types of Quickbooks data:

  • Products
  • Categories
  • Your own company
  • Customers
  • Invoices
  • Payments

Each of these data types have their own service that can get, create, update and delete data. Example:

var service = QuickbooksPaymentService();

var value = await service.getAll(
    accessToken: tokens.accessToken,
    companyId: tokens.companyId!,
    conditions: '<your conditions in MySql>',
);

If you need to get a data that is not covered by the prebuilt services, you can use the QuickbooksQueryService to build your own custom service easily. Example:

var service = QuickbooksQueryService(
    postEndpoint: '<post endpoint of your date>',
    baseQuery: '<base query to get your data in MySql>',
    baseConditions: '<base conditions to get your data in Mysql>', // Is null by default
    isProduction: true //Will be set with the environment variable by default
);

By example, to set a QuickbooksQueryService to get Payments, you need this code:

var service = QuickbooksQueryService(
    postEndpoint: '<post endpoint of your date>',
    baseQuery: '<base query to get your data in MySql>',
    baseConditions: '<base conditions to get your data in Mysql>', // Is null by default
    isProduction: true //Will be set with the environment variable by default
);

Libraries

entities/lines/account_based_expense_line
entities/lines/account_based_expense_line_details
services/base/base.services.export
enums/oauth2/claims.enum
services/configuration.service
entities/lines/description_line_details.entity
entities/lines/description_only_line.entity
enums/invoice/detail_type.enum
entities/lines/discount_line.entity
entities/lines/discount_line_details.entity
entities/entity.export
enums/enums
enums/enums.export
environment/environment.export
enums/invoice/global_tax_calculation_type.enum
entities/lines/group_line.entity
entities/lines/group_line_defails.entity
enums/invoice/invoice.enum.export
entities/lines/item_based_expense_line
entities/lines/item_based_expense_line_details
entities/lines/line.entity
entities/lines/line.entity.export
entities/lines/markup_info.entity
entities/oauth2/oauth2.entity.export
enums/oauth2/oauth2.enum.export
entities/oauth2/oauth2_configuration.entity
services/oauth2_connection.service
entities/oauth2/oauth2_tokens.entity
entities/payment/payment.entity.export
quickbooks
entities/quickbooks_account.entity
services/quickbooks_accounts.service
entities/quickbooks_attachable.entity
entities/quickbooks_category.entity
services/quickbooks_caterogies.service
services/quickbooks_company.service
entities/quickbooks_company_infos.entity
entities/quickbooks_contact_infos_entity
entities/payment/quickbooks_credit_card_payment.entity
entities/payment/quickbooks_credit_charge_info.entity
entities/payment/quickbooks_credit_charge_response.entity
entities/quickbooks_customer
services/quickbooks_customers.service
entities/quickbooks_delivery_info.entity
entities/quickbooks_effective_tax_rate
entities/quickbooks_email_address
environment/quickbooks_environment
entities/quickbooks_invoice.entity
services/quickbooks_invoices.service
entities/quickbooks_linked_txn.entity
entities/quickbooks_memo_ref.entity
entities/quickbooks_name_value.entity
entities/payment/quickbooks_payment.entity
entities/payment/quickbooks_payment_line.entity
entities/payment/quickbooks_payment_line_ex.entity
entities/payment/quickbooks_payment_line_ex_list.entity
services/quickbooks_payments.service
entities/quickbooks_phone_number.entity
entities/quickbooks_physical_address.entity
entities/quickbooks_product.entity
services/quickbooks_products.service
entities/quickbooks_purchase.entity
services/quickbooks_purchases.service
services/base/quickbooks_query.service
entities/quickbooks_tax_rate_entity
services/quickbooks_tax_rates.service
entities/quickbooks_txn_tax_detail
entities/quickbooks_vendor_entity
entities/quickbooks_vendor_payment_bank_detail_entity
services/quickbooks_vendors.service
entities/quickbooks_web_address.entity
enums/oauth2/response_types.enum
entities/lines/sales_item_line.entity
entities/lines/sales_item_line_detail.entity
enums/oauth2/scopes.enum
services/services.export
enums/oauth2/signing_alg.enum
entities/lines/sub_total_line.entity
entities/lines/sub_total_line_details.entity
enums/oauth2/subject_types.enum
entities/lines/tax_line.entity
entities/lines/tax_line_details.entity
enums/oauth2/token_endpoint_auth_methods.enum