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