Skip to content

Quickbooks Integration

API

Pull Customers

Customers can be fetched from QB by visiting /indevets/connect and clicking Pull Quickbooks. The QB API has a limit of 1000 records per request. We set the default page size via quickbooks.page-size config set in config/services.php. If that is not set, it will default to fetching 500 records per request.

When customers are pulled / onboarded, we set some flags: is_office, is_parent, is_indie_corp for example. Some of these have not been well defined, and are causing the pull customers script to constantly change some fields (CATS-239). These fields are apparently not being used in many places of the code, so the solution for now is to prevent the extraneous flag changes from occurring.

QBO TOKEN SYNC

problem

The staging server is the defacto holder of QBO tokens (realm, refresh token, access token). When PR environments are built, they inherit the QBO tokens from staging extant at the time of the build. If QBO tokens change later, the PR environments may not work. If a PR environment runs /qbologin, that PR environment will have the ‘latest’ QBO tokens, and the staging environment will not work.

fix

Two new endpoints and a ‘tools’ button were added. /qbotokens and /updateqbotokens

The tools page will now have a button which will request QBO tokens from the staging server, and update the PR environment accordingly.

The /qbotokens/ route path requires some password in the URL, like /qbotokens/foobar

The updateqbotokens() method will grab the value via config(‘QB_TOKEN_PASS’, ‘default_password’)

‘default_password’ is a fallback, but we can override via changing QB_TOKEN_PASS config/env as needed (config/quickbooks.php has a value defined from env() with a different fallback from ‘default_password’

Each environment will check how it’s running - /qbotokens will only function if the environment is ‘staging’, and /updateqbotokens will only run in ‘development’ or ‘local’.