GithubHelp home page GithubHelp logo

agileware / au.com.agileware.civiquickbooks Goto Github PK

View Code? Open in Web Editor NEW
6.0 6.0 9.0 5.01 MB

A CiviCRM extension which integrates CiviCRM with QuickBooks Online

Home Page: https://agileware.com.au

License: Other

PHP 94.92% Smarty 3.82% JavaScript 1.26%
quickbooks-online civicrm-extension quickbooks-developer civicrm civicrm-api accounting-software accounting

au.com.agileware.civiquickbooks's Introduction

README

CiviCRM Extension which integrates CiviCRM with QuickBooks Online. CiviCRM Contacts and Contributions are pushed to your QuickBooks Online account, QuickBooks Invoices are pulled into CiviCRM, updating the Contribution status. Synchronise all things!

Integration of the two systems saves you time by not having to do repetitive data entry in your accounting system and CiviCRM. This extension does the work for you!

QuickBooks Online provides different Tax APIs for US and non-US countries. This extension has been developed and tested with:

  1. QuickBooks Online, Australia (AU)
  2. QuickBooks Online, United States (USA)
  3. QuickBooks Online, United Kingdom (UK)
  4. QuickBooks Online, Canada (CA)

CiviQuickBooks will only synchronise contacts to Quickbooks Online from your CiviCRM when a Contribution is added to them, either through online payments or administrator action.

CiviQuickBooks version 2 implements the OAuth 2.0 protocol for QuickBooks Online - if you are upgrading from a previous version you will need to generate new keys. See the Configuration section below.

Installation

  1. Ensure the CiviContribute component is enabled
  2. Download the latest version of this extension
  3. Unzip in the CiviCRM extension directory, as defined in System Settings / Directories.
  4. Download the CiviCRM extension, Account Sync.
  5. In CiviCRM, go to System Settings / Extensions and enable both extensions, Account Sync and QuickBooks Online Integration.
  6. QuickBooks will now be available in the Administer menu.
  7. Click on the QuickBooks menu to display the QuickBooks Online Settings page.
  8. Update the CiviQuickBooks Online configuration as detailed below.

Configuration

To use this extension, you need to generate a QuickBooks Online consumer key and secret.

  1. You will need an Intuit Developer Account, sign up at (https://developer.intuit.com/). This account must be added as a user of Admin user type to the QuickBooks Online company being integrated.
  2. Once your developer account is created and linked, Go to the My Apps section and select Create new app.
  3. Use the Select APIs button in the Just start coding card, then select the Accounting API.
  4. From the App dashboard, select the OAuth 2.0 keys
  5. In the Production Keys section, copy the Client ID and Client Secret keys.
  6. Paste these values into the CiviQuickBooks Online Settings page and submit.
  7. Copy the Redirect URI that is present into the Production Keys section of your App in the Intuit Developer site.

CiviQuickBooks Online Settings page is shown below.

Authorise CiviQuickBooks access to your QuickBooks Online account.

  1. Click the Authorize link as shown below the Access Token Expiry Date field.
  2. The QuickBooks Online Authentication page will now be displayed.
  3. Follow the instructions and to complete the authentication process.
  4. After authentication, you will be redirected back to CiviCRM.
  5. Open the QuickBooks Online Settings page.
  6. To confirm QuickBooks Online authentication a date will be shown in the Access Token Expiry Date field. If no date is shown then authentication has failed. Repeat the process.

Map your QuickBooks product/service to CiviCRM Financial account codes

Each QuickBooks Product/Service has a unique name. This is used in the CiviCRM Financial Account codes to correctly code each Invoice in QuickBooks Online.

  1. Open the QuickBooks Company, go to product/service settings page (https://sandbox.qbo.intuit.com/app/items).
  2. Identify each QuickBooks Product/Service that you want to sync with CiviCRM.
  3. Open the CiviCRM Financial Account setting page (civicrm/admin/financial/financialAccount) and update the Acctg Code of corresponding Financial account to be the same as each QuickBooks Product/Service name: Product Name -> Acctg Code
  4. When setting up Contributions in CiviCRM, ensure that the Financial Type for the Contribution is set to use the correct Financial Account as the Income Account.
  5. During sync, the Contribution line item will be set to the corresponding QuickBooks Product/Service.
  6. When a CiviCRM Acctg Code does not match any QuickBooks Product/Service name, which means that no product/service in QuickBooks has the same name, that particular line item will NOT be pushed through the invoice.

Map your QuickBooks tax account name to corresponding CiviCRM financial types Sales Tax Accounts acctg code.

When the extension pushes an invoice to QuickBooks Online, it requires every item to have a specified Tax account.

For AU Companies:

  1. Go to GST > Rates&Settings. There are many tax accounts listed there, with names in column Tax name, copy the tax name you want and paste it into the Acctg code field of corresponding Tax financial account.
  2. Open the CiviCRM Financial Account setting page (civicrm/admin/financial/financialAccount) and update the Acctg Code of corresponding Financial account to be the same as each QuickBooks tax account name.
  3. If a financial type does not contain any GST, a financial account also needs to be created with the corresponding Tax account name in QuickBooks filled out. For example, create a new financial account called NO GST with GST rate as 0, acctg codeas GST free (a tax account name which has GST rate as 0 also). And assign that financial account as corresponding line items Sales Tax account`.
  4. When setting up Contributions in CiviCRM, ensure that the Financial Type for the Contribution/line item is set to use the correct Financial Account as the Sales Tax Account.
  5. During sync, the Contribution line item will be assigned with corresponding Tax account.
  6. When a CiviCRM Acctg Code does not match any QuickBooks Tax account name, which means that the there is no tax account in QuickBooks has the same name, that particular line item will NOT be pushed through the invoice.

For US Companies:

  1. For US companies, each line item or product/service in an invoice can only be marked with NON (for non-taxable) or TAX (taxable), and the entire invoice will have a single tax rate selected as a state tax or a combination tax rate.
  2. Users need to make sure that:
  • In CiviCRM:
    • The financial type of each line item in the contribution is associated with a sales tax financial account
      • All those associated financial accounts need to have TAX or NON as the acctg code field.
      • All those associated financial accounts need to have Tax Rate Name of desired tax rate account in QuickBooks as the account type code field in CiviCRM. e.g. California as the financial type code.
      • Make sure that all the financial types of line items have the same value of account type code in the sales tax financial account. The extension will pick the first line item that is taxable and with a account type code. And use that name to get the ID of tax account from QuickBooks Online.
  • In QuickBooks Online:
    • Make sure there are matched products/services that have the name that is same with the values of the acctg code of all Income financial account of all financial types used in the contributions.
    • Make sure all used tax accounts have been created and have names recored in the account type code of the sales tax financial account of matched financial type.

Are you using a QuickBooks Online Production or Development account?

This extension currently assumes that it will be connected to a QuickBooks Online, Production account. If instead, you wish to connect this to a QuickBooks Online Development account then open the QuickBooks Online Settings page and change the Environment option from Production to Development. When you have finished testing in the Development account, then change the Environment option back to Production.

For more details on the QuickBooks Online environments, see:

Special Notes:

  1. As line items that have no matched QuickBooks product/service name filled out or no matched QuickBooks tax account name filled out will not be pushed in the invoice, an invoice could have less items pushed. If an invoice does not have even one item in it after the filtering, the invoice will not be pushed successfully.
  2. As long as an invoice has at least one item in it after filtering, the information about those non-pushed items will be noted down as customer memo field. The id of the problematic financial type and its acctg code will be listed. In that case, you need to fix the invoice manually.

Funding for this CiviCRM extension

Development and support for this Extension is funded solely by Agileware and CiviCRM community contributions. Agileware does not receive any funding at all for this Extension from the CiviCRM Partner program or CiviCRM LLC. Agileware welcome any funding to help continue paying Agileware staff to continue contributing to the CiviCRM community and Extensions.

❤️ Donate to Agileware to tell us how much you appreciate Agileware's CiviCRM open source work and community contributions.

About the Authors

This CiviCRM extension was developed by the team at Agileware.

Agileware provide a range of CiviCRM services including:

  • CiviCRM migration
  • CiviCRM integration
  • CiviCRM extension development
  • CiviCRM support
  • CiviCRM hosting
  • CiviCRM remote training services

Support your Australian CiviCRM developers, contact Agileware today!

Agileware

au.com.agileware.civiquickbooks's People

Contributors

agileware-dev avatar agileware-fj avatar agileware-justin avatar agilewarealok avatar alifrumin avatar ananelson avatar darrick avatar joemurray avatar mattwire avatar mlutfy avatar netzih avatar samuelsov avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

au.com.agileware.civiquickbooks's Issues

Merging contacts cause synchronization problem

To reproduce:

  1. create 2 contacts with different names (contact1=OrgName and contact2=OrgName inc)
  2. let the Contact push task create both contact in Quickbooks
  3. merge the 2 contacts in CiviCRM, keep contact1 but rename the remaining contact as contact2

This gives an error Matches QBO Contact %1, which is already synced to %2 (%3). Deduplication is required.

What is the best way to fix this from a user point of view ? Should the user delete the client in QBO ?

Trouble authorizing

I have been trying to connect CiviCRM and QuickBooks Online using this extension. I have followed the instructions (I think) but can't get past the authorization. I entered the production keys on the settings page, but when I click AUTHORIZE, I get the error message (from QuickBooks) "We're sorry! We're experiencing some problems. Please try again later."

Any idea what I might be doing wrong? There isn't something I am missing about a redirect URI, is there? Thank you!

Civiquickbooks Contact Push Job errors

Still trying to get this extension working smoothly. Looking at the scheduled jobs, I'm seeing an error beingf reported every trme the job runs:

Finished execution of Civiquickbooks Contact Push Job with result: Failure, Error message: Contact Push aborted due to: Not all contacts were saved:

Failed to push Contact: 2310 (AccountsContact: ) with error: 'Fax' is not a valid option for field phone_type_id

The second line was repeated, identifying four other contact IDs.

Wondering whether this might be because the phone type 'Fax' was not too long ago removed from the defaults in CiviCRM, I wen and added it as a phone type, then re-ran the scheduled job. This time I see:

Finished execution of Civiquickbooks Contact Push Job with result: Failure, Error message: Contact Push aborted due to: Not all contacts were saved:

Failed to push Contact: 2313 (AccountsContact: ) with error: 'Pager' is not a valid option for field phone_type_id

This time with maybe 20 records listed.

OK, I might be on to something. So I add 'Pager' as another phone type in Civi, and re-run the job again:

Finished execution of Civiquickbooks Contact Push Job with result: Failure, Error message: Contact Push aborted due to: Not all contacts were saved:

Failed to push Contact: 2313 (AccountsContact: ) with error: 'Voicemail' is not a valid option for field phone_type_id

Again with about 20 records getting listed. Wondering how long this is going to go on for, I add 'Voicemail' as a phone type, and re-run, again:

Finished execution of Civiquickbooks Contact Push Job with result: Failure, Error message: Contact Push aborted due to: Not all contacts were saved:

Failed to push Contact: 2313 (AccountsContact: ) with error: Authentication failure doing QBO contact push, aborting

Huh? How can my authentication be failing. The previous runs of this scheduled job seemed to be successful enough at authenticating. What's changed?

Note that contact ID 2313 in my Civi database is a deleted record (not yet permanently deleted). I deleted contact 2313 and the linked contribution record, and tried again. A new record ID was presented as the source of failure. Again this a dummy record created to test the membership sign-up process, so again I deleted it and the linked contribution record and tried again. The scheduled job log threw up another record as the cause of failure, and I deleted that. Then another - but this last record was genuine, linked to a real membership record and contribution record - I don't want to delete it.

So I'm now stuck. No idea why the scheduled job is failing. As far as I can see none of the contacts in Civi has been sucecssfully pushed into QBO so far.

We are see an issue with civi HTML checkbox preventing the QB ext settings from loading...

TypeError: strlen(): Argument #1 ($str) must be of type string, array given in HTML_QuickForm_checkbox->toHtml() (line 138 of /home/astronomyhouston/www/drupal9/vendor/civicrm/civicrm-packages/HTML/QuickForm/checkbox.php)#0 /home/astronomyhouston/www/drupal9/vendor/civicrm/civicrm-packages/HTML/QuickForm/Renderer/Array.php(307): HTML_QuickForm_checkbox->toHtml() #1 /home/astronomyhouston/www/drupal9/vendor/civicrm/civicrm-packages/HTML/QuickForm/Renderer/ArraySmarty.php(189): HTML_QuickForm_Renderer_Array->_elementToArray(Object(HTML_QuickForm_checkbox), false, NULL) #2 /home/astronomyhouston/www/drupal9/vendor/civicrm/civicrm-core/CRM/Core/Form/Renderer.php(87): HTML_QuickForm_Renderer_ArraySmarty->_elementToArray(Object(HTML_QuickForm_checkbox), false, NULL) #3 /home/astronomyhouston/www/drupal9/vendor/civicrm/civicrm-packages/HTML/QuickForm/Renderer/Array.php(221): CRM_Core_Form_Renderer->_elementToArray(Object(HTML_QuickForm_checkbox), false, NULL) #4 /home/astronomyhouston/www/drupal9/vendor/civicrm/civicrm-packages/HTML/QuickForm/element.php(415): HTML_QuickForm_Renderer_Array->renderElement(Object(HTML_QuickForm_checkbox), false, NULL) #5 /home/astronomyhouston/www/drupal9/vendor/civicrm/civicrm-packages/HTML/QuickForm.php(1705): HTML_QuickForm_element->accept(Object(CRM_Core_Form_Renderer), false, NULL) #6 /home/astronomyhouston/www/drupal9/vendor/civicrm/civicrm-core/CRM/Core/Form.php(1136): HTML_QuickForm->accept(Object(CRM_Core_Form_Renderer)) #7 /home/astronomyhouston/www/drupal9/vendor/civicrm/civicrm-core/CRM/Core/QuickForm/Action/Display.php(95): CRM_Core_Form->toSmarty() #8 /home/astronomyhouston/www/drupal9/vendor/civicrm/civicrm-core/CRM/Core/QuickForm/Action/Display.php(83): CRM_Core_QuickForm_Action_Display->renderForm(Object(CRM_Civiquickbooks_Form_Settings)) #9 /home/astronomyhouston/www/drupal9/vendor/civicrm/civicrm-packages/HTML/QuickForm/Controller.php(203): CRM_Core_QuickForm_Action_Display->perform(Object(CRM_Civiquickbooks_Form_Settings), 'display') #10 /home/astronomyhouston/www/drupal9/vendor/civicrm/civicrm-packages/HTML/QuickForm/Page.php(103): HTML_QuickForm_Controller->handle(Object(CRM_Civiquickbooks_Form_Settings), 'display') #11 /home/astronomyhouston/www/drupal9/vendor/civicrm/civicrm-core/CRM/Core/Controller.php(355): HTML_QuickForm_Page->handle('display') #12 /home/astronomyhouston/www/drupal9/vendor/civicrm/civicrm-core/CRM/Utils/Wrapper.php(98): CRM_Core_Controller->run() #13 /home/astronomyhouston/www/drupal9/vendor/civicrm/civicrm-core/CRM/Core/Invoke.php(292): CRM_Utils_Wrapper->run('CRM_Civiquickbo...', 'QuickBooks Onli...', Array) #14 /home/astronomyhouston/www/drupal9/vendor/civicrm/civicrm-core/CRM/Core/Invoke.php(69): CRM_Core_Invoke::runItem(Array) #15 /home/astronomyhouston/www/drupal9/vendor/civicrm/civicrm-core/CRM/Core/Invoke.php(36): CRM_Core_Invoke::_invoke(Array) #16 /home/astronomyhouston/www/drupal9/web/modules/contrib/civicrm/src/Civicrm.php(88): CRM_Core_Invoke::invoke(Array) #17 /home/astronomyhouston/www/drupal9/web/modules/contrib/civicrm/src/Controller/CivicrmController.php(80): Drupal\civicrm\Civicrm->invoke(Array) #18 [internal function]: Drupal\civicrm\Controller\CivicrmController->main(Array, '') #19 /home/astronomyhouston/www/drupal9/web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(123): call_user_func_array(Array, Array) #20 /home/astronomyhouston/www/drupal9/web/core/lib/Drupal/Core/Render/Renderer.php(580): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber{closure}() #21 /home/astronomyhouston/www/drupal9/web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(124): Drupal\Core\Render\Renderer->executeInRenderContext(Object(Drupal\Core\Render\RenderContext), Object(Closure)) #22 /home/astronomyhouston/www/drupal9/web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(97): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array) #23 /home/astronomyhouston/www/drupal9/vendor/symfony/http-kernel/HttpKernel.php(169): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber{closure}() #24 /home/astronomyhouston/www/drupal9/vendor/symfony/http-kernel/HttpKernel.php(81): Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object(Symfony\Component\HttpFoundation\Request), 1) #25 /home/astronomyhouston/www/drupal9/web/core/lib/Drupal/Core/StackMiddleware/Session.php(58): Symfony\Component\HttpKernel\HttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #26 /home/astronomyhouston/www/drupal9/web/core/lib/Drupal/Core/StackMiddleware/KernelPreHandle.php(48): Drupal\Core\StackMiddleware\Session->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #27 /home/astronomyhouston/www/drupal9/web/core/modules/page_cache/src/StackMiddleware/PageCache.php(106): Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #28 /home/astronomyhouston/www/drupal9/web/core/modules/page_cache/src/StackMiddleware/PageCache.php(85): Drupal\page_cache\StackMiddleware\PageCache->pass(Object(Symfony\Component\HttpFoundation\Request), 1, true) #29 /home/astronomyhouston/www/drupal9/web/core/lib/Drupal/Core/StackMiddleware/ReverseProxyMiddleware.php(48): Drupal\page_cache\StackMiddleware\PageCache->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #30 /home/astronomyhouston/www/drupal9/web/core/lib/Drupal/Core/StackMiddleware/NegotiationMiddleware.php(51): Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #31 /home/astronomyhouston/www/drupal9/vendor/stack/builder/src/Stack/StackedHttpKernel.php(23): Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #32 /home/astronomyhouston/www/drupal9/web/core/lib/Drupal/Core/DrupalKernel.php(713): Stack\StackedHttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #33 /home/astronomyhouston/www/drupal9/web/index.php(19): Drupal\Core\DrupalKernel->handle(Object(Symfony\Component\HttpFoundation\Request)) #34 {main}

In order to regain access to settings, I need to update the above mentioned line to:

    if (gettype($this) == "string" && 0 == strlen($this->_text ?? '')) {

Fatal error accessing QuickBooks settings on CiviCRM 4.7

While testing on CiviCRM 4.7.latest, I received this fatal error when accessing the main QuickBooks settings:

Exception: "Cannot determine default entity. CRM_Civiquickbooks_Form_Settings should implement getDefaultEntity()."

#0 /var/aegir/platforms/civicrm-4.7/sites/all/modules/civicrm/CRM/Core/Form.php(1293): CRM_Core_Form->getDefaultEntity()
#1 /var/aegir/platforms/civicrm-4.7/vendor/civicrm/au.com.agileware.civiquickbooks/CRM/Civiquickbooks/Form/Settings.php(34): CRM_Core_Form->addSelect("account_sync_push_contribution_status", "Push Contribution Status")
#2 /var/aegir/platforms/civicrm-4.7/sites/all/modules/civicrm/CRM/Core/Form.php(564): CRM_Civiquickbooks_Form_Settings->buildQuickForm()
#3 /var/aegir/platforms/civicrm-4.7/sites/all/modules/civicrm/CRM/Core/QuickForm/Action/Display.php(92): CRM_Core_Form->buildForm()
#4 /var/aegir/platforms/civicrm-4.7/sites/all/modules/civicrm/packages/HTML/QuickForm/Controller.php(203): CRM_Core_QuickForm_Action_Display->perform(Object(CRM_Civiquickbooks_Form_Settings), "display")
#5 /var/aegir/platforms/civicrm-4.7/sites/all/modules/civicrm/packages/HTML/QuickForm/Page.php(103): HTML_QuickForm_Controller->handle(Object(CRM_Civiquickbooks_Form_Settings), "display")
#6 /var/aegir/platforms/civicrm-4.7/sites/all/modules/civicrm/CRM/Core/Controller.php(351): HTML_QuickForm_Page->handle("display")
#7 /var/aegir/platforms/civicrm-4.7/sites/all/modules/civicrm/CRM/Utils/Wrapper.php(113): CRM_Core_Controller->run()
#8 /var/aegir/platforms/civicrm-4.7/sites/all/modules/civicrm/CRM/Core/Invoke.php(282): CRM_Utils_Wrapper->run("CRM_Civiquickbooks_Form_Settings", "QuickBooks Online Settings", (Array:0))
#9 /var/aegir/platforms/civicrm-4.7/sites/all/modules/civicrm/CRM/Core/Invoke.php(84): CRM_Core_Invoke::runItem((Array:13))
#10 /var/aegir/platforms/civicrm-4.7/sites/all/modules/civicrm/CRM/Core/Invoke.php(52): CRM_Core_Invoke::_invoke((Array:3))
#11 /var/aegir/platforms/civicrm-4.7/sites/all/modules/civicrm/drupal/civicrm.module(448): CRM_Core_Invoke::invoke((Array:3))
#12 /var/aegir/platforms/civicrm-4.7/includes/menu.inc(527): civicrm_invoke("quickbooks", "settings")
#13 /var/aegir/platforms/civicrm-4.7/index.php(21): menu_execute_active_handler()
#14 {main}

This setting is from AccountSync, but I could not figure out how getDefaultEntity() is supposed to work.

I worked around it with this unclean hack:

  function buildQuickForm() {
    [...]

    foreach ($settings as $name => $setting) {
      if (isset($setting['quick_form_type'])) {
        $add = 'add' . $setting['quick_form_type'];
        if ($add == 'addElement') {
          $this->$add($setting['html_type'], $name, $setting['title'], CRM_Utils_Array::value('html_attributes', $setting, array ()));
        }
        // ADDED THE 'elseif' BELOW:
        elseif ($add == 'addSelect' && !empty($setting['pseudoconstant']['optionGroupName'])) {
          $options = CRM_Core_OptionGroup::values($setting['pseudoconstant']['optionGroupName'], FALSE, FALSE, TRUE);
          $this->addElement('select', $name, $setting['title'], $options);
        }
        else {
          $this->$add($name, $setting['title']);
        }

        $description[$name] = $setting['description'];
      }
    }

Reverse workflow support?

Does this extension support a read-only-from-quickbooks workflow? i.e. just pulling contacts and contributions from quickbooks and creating them in CiviCRM?

Hardcoded Production Base URL (CIVIQBO-94)

Hi Guys,

I was just working on this and when working with a sandbox account, it didn't worked, saying the product/tax code didn't existed, but it clearly did, so when digging through the code, I found this

https://github.com/agileware/au.com.agileware.civiquickbooks/blob/master/CRM/Quickbooks/APIHelper.php#L89

The baseUrl is hardcoded, is this intentional or there is some other part in the code that recognises and fixes this automagically ?

I was making the call via /civicrm/api , invoice push with a specific contribution ID

Contact pull can cause array index warnings for Primary email address

Warning: Illegal string offset '\''Address'\'' in \{...}/au.com.agileware.civiquickbooks/civiquickbooks.php on line 133
Warning: Illegal string offset '\''Address'\'' in \{...}/au.com.agileware.civiquickbooks/civiquickbooks.php on line 138

Based on code review, looks like this is likely to be coming up when the PrimaryEmailAddr field is returned empty or with data that does not conform to the API definition.

Suspect this is likely to be a result of syncing a contact with no email address.

Agileware ref CIVIQBO-97

CHANGES TO IDENTITY SIGNATURE KEYS (March 1, 2024) - Potentially important change from Intuit

No idea whether this is a global change in how they plan to operate, but this arrived in my inbox just now:

CHANGES TO IDENTITY SIGNATURE KEYS

Hello Intuit Developer,

We wanted to let you know that we’re working on a security enhancement feature to update the key used for signing the ID token issued during the OpenID Connect flow. This feature will be implemented on March 1, 2024. We are contacting you because we would like you to review your OpenID flow to determine if the ID token validation is implemented correctly or if you need to take action.

What is happening?
Our team is making a change to start returning more than one key in the response array returned by the oauth.platform.intuit.com/op/v1/jwks endpoint.

How does this impact me?
In the OpenID Connect flow, after making the call to exchange your auth code for an ID token, your app needs to validate the ID token and verify that the signing authority for responses is from Intuit. The recommended way to check the signature is to scan through the array of keys at oauth.platform.intuit.com/op/v1/jwks for the public key information. The kid value should match the value that was returned in the ID token header.

If you have implemented logic to validate the ID token, ensure you are looping through the array elements and finding the element that matches the kid value from the ID token header.

If your logic doesn’t loop through all the array elements and/or looks for only a specific array element for a match for kid, then your implementation may break due to the changes being implemented.
How can I validate whether I'm impacted?

  1. Validate if you are using Intuit’s OpenID Connect. If you have not implemented OpenID Connect, this change does not impact you.

  2. Validate if you have implemented ID token validation. If you have not implemented ID token validation, this change does not impact you.

  3. Validate your ID token implementation:

    a. If you’re using Intuit’s official Java SDK or PHP SDK to perform ID token validation, this change does not impact you. We still recommend that you test all flows.

    b. If you’re using Intuit’s .NET SDK and a version prior to V14.6.3.6, then you are impacted as the code in the older versions of this SDK did not loop through the array of public keys.

    c. If you’re not using any of the SDKs mentioned above, check your code to see if you are looping through the array of keys or if you are picking the first element. If your code doesn’t loop through all the array elements and/or looks for only a specific array element for a match for kid, then you are impacted.

What do I need to do next?

  1. If you are using our Java SDK, then no action is required.

  2. If you are using our PHP SDK, then no action is required.

  3. If you are using our .Net SDK, then update it to the latest version V14.6.3.6.

  4. If you are not using any of our SDKs and validating the ID token through your custom code, please ensure you are following all the instructions given here, paying special attention to the instruction “Scan through the array of keys at oauth.platform.intuit.com/op/v1/jwks for the public key information. The kid value should match the value that was returned in the ID token header.”

  5. If you are not validating the ID token, then your application will continue to work. However, you must validate the ID token to avoid man-in-the-middle impersonation.

When do I need to take action?
Depending on your usage of our SDK or your custom code, you need to take action (as described above) before March 1, 2024.

If I have more questions, how can I get help?
Please post your questions on our Developer Forums.

Contribution statuses not being updated.

Hi,

I'm using civi 5.57, QuickBooks 2.9.4 and accountsync 1.5

Contributions are being synced to QuickBooks correctly but if we cancel the contribution in civi or void the invoice in civi the status is not being pushed to the other side updating the contribution in civi or the invoice in Quickbooks,

Is anyone else experiencing something similar?

Contribution status update is not pushed to quickbooks

Here is the current workflow:

  1. we have a pending contribution
  2. it get pushed to Quickbooks
  3. later, the payment is received and the status is updated to completed in CiviCRM

Problem: the contribution status is not pushed in Quickbooks

The other way seems to work: if we complete the payment in Quickbooks, the contribution get completed in CiviCRM.

Before I dig any further into this, is there any specific reason why it works only in one way and not the other ?

Trouble authorizing

  1. In Installation instructions step 1 (https://github.com/agileware/au.com.agileware.civiquickbooks/tree/2.6), one finds:

You will need an Intuit Developer Account, sign up at (https://developer.intuit.com/). This
account must be linked to the QuickBooks Online company you wish to integrate with.

It is not clear what it means to "link" an account between Intuit Developer and QuickBooks Online, and how I can check if accounts created in both places with same email are linked.

  1. If the above is not the issue, then I am having separate issue when trying to authorize.

I have configured the callback as follows:
2020-08-18_12-33-03

For reference, here is the value in the Settings page:
2020-08-18_12-43-46

When I click on the Authorize link above I get the following error:
2020-08-18_12-33-28

The browser url, in case this is useful, is https://appcenter.intuit.com/app/connect/oauth2/error?client_id=ABdwI5q6AegPEt9nuJbzGrE1STTTMCL9oEodqdZKQ0cXJBvk5n&scope=com.intuit.quickbooks.accounting&redirect_uri=https%3A%2F%2Fquickbooks.jmaconsulting.biz%2Fcivicrm%2Fquickbooks%2FOAuth&response_type=code&state=%7B%22state_token%22%3A%22LmQNIuFeNJYjLMWpkDngHfws9cQG7GLCe7X1kYyf%22%7D

There are no errors in the Apache log.

Contacts do not sync because connector_id is NULL instead of 0

While testing this extension, I noticed that contacts do not push from CiviCRM to QuickBooks.

Debugging, it seems that by default the 'accountsync' extension creates a table where connector_id DEFAULT NULL.

However, CiviQuickBooks checks for connector_id = 0 when running the Civiquickbooks.ContactPush Job:
https://github.com/agileware/au.com.agileware.civiquickbooks/blob/master/CRM/Civiquickbooks/Contact.php#L172

I don't use the connectors extension and the QB extension does not mention it.

Is the API condition for connector_id=0 (in Contact.php linked above) really necessary? (I'm not familiar with any of this, just poking around)

Can't find Redirect URI

In the Readme for this extension, under the Configuration subheading, it says "copy the Redirect URI that is present...". I'm following the instructions closely, but can see no Redirect URI. clearly I can't go further without this, as the Quickbooks developer site needs this before it will begin to operate.

Maybe I'm missing something obvious? The Readme sort of implies that having entered my client key and secret into the Quickbooks Online Settings form on my site, and hit the Submit button, I will in some way be presented with the Redirect URI, but clearly that's not happening.

Howe do I go about finding this URI?

Make QBO logs dir configurable

When I attempt to authorize, I get this error message:

DirectoryIterator::__construct(/tmp): failed to open dir: Permission denied

This is due to the QBO PHP API attempting to write logs to /tmp/IdsLogs, which is not writable for my installation. It would be great if this log location could be specified in settings.

<requestLog enableRequestResponseLogging="true" requestResponseLoggingDirectory="/tmp/IdsLogs" />

QBO logs dir must end with /

I'll try to work on this... if QBO logging is enabled with a custom path (#11 #15), then the custom path must end in a / otherwise weirdness happens. Probably easiest to just add a trailing "/" to the value if not provided.

Set up complexities resulting from changes with the QB developer account

I'm just trying to get this extension configured on a new site. Getting production keys for the app via the QB developer account is now a relatively complex process it seems, requiring that I answer a lot of questions about "my" app. Hoping that I've answered the questions correctly I'm currently presumably awaiting some sort of review and hopefully at some unspecified point in the future (I see no indication as to whether it will take minutes or months for them to complete their review) then I will be given access to the production credentials.

Of course I may have answered some of the questions wrongly - I'm using educated guesswork here - in which case they may choose to refuse my app, which would be a good deal of time wasted.

It looks like their entire developer account set-up is geared to the needs of larger scale app developers who want to produce an app that can then be marketed through some sort of add-on marketplace. If I learn more I'll attempt to make some notes that might inform an update to the readme.

catching generic Exception object can lead to inaccurate errors

I will probably do a patch for this soon.

Don't do:

 } catch (Exception $e) {
// assume specific type of exception was caught

Instead do:

 } catch (SpecificException $e) {
// assume specific type of exception was caught

If need to catch generic exception also that can happen in 2nd catch.

quickbooks_company_country always defaults to AU

I'm testing 2.9.4 as I've been on 2.9.3. And ran across this. I'm in the US and quickbooks_company_country has been set to AU. Apparently it doesn't affect much. I haven't been handling taxes.

Anyway:
// Now We have got all information we need to connect to this Quickbooks company. // Let's get the company country. $_company_country = $companyInfo->Country;
is all good. $_company_country = "US" for me.

But then following that:

//if getting no response, set country settings as AU company. $_company_country = (isset($_company_country['CompanyInfo'])) ? $_company_country['CompanyInfo']['Country'] : 'AU';

Wipes it out.

https://github.com/agileware/au.com.agileware.civiquickbooks/blame/970863bd40508ae486d1b83d56f86e963970dc46/CRM/Civiquickbooks/Page/OAuthQBO.php#L111

Cronjob parameters

Are there any parameters I can use on the QuickBooks cronjobs? I would like to set one on the pull job to pull only last week ones

Set up with Quickbooks UK

I'm a day into this and struggling to match the Account Type with Quickbooks.
I get this error when doing the Invoice Push scheduled job

Finished execution of Civiquickbooks Invoice Push Job with result: Failure, Error message: Not all records were saved [
"Failed to store 130 with error No valid line items in the Invoice to push. No matching Item found in Quickbooks Online for accounting code 67 (financial type 5)."
]
Financial type 5 is the ID of the financial type in CiviCRM.
So I'm trying to map this to a revenue or income code in Quickbooks Online and failing.
And I don't know whether my error is in Quickbooks Online or CiviCRM.

On the Quickbooks Chart of Account, there are no codes that I can see.
Happy to pay someone a fee to configure this correctly for me.

Also happy to provide a dot-to-dot revision to the readme.md file.

'NOT IN' is not a valid option for field accounts_status_id

On Civicrm 5.60, with civiquickbooks 2.9.3 and account sync 1.5

I kept getting this message trying to push invoices to QB:
Finished execution of Civiquickbooks Invoice Push Job with result: Failure, Error message: Invoice Push aborted due to: 'NOT IN' is not a valid option for field accounts_status_id

I'm guessing this might be an issue with the definitions created Account Sync?

Stale Object Error

Hi.
On an install I am getting Stale Object Errors and i cannot see a way of resolving these.

"error_data": "{"failures":1,"error":["Stale Object Error : You and were working on this at the same time. finished before you did, so your work was not saved."]}",

The API refers to a synctoken - is there any way of forcing this to refresh?

Overwrites other extension menu items

If you install another extension that adds a menu-item to the Administer menu and then install this one it will get overwritten (depending on the load order of the hooks which is normally deterministic per-site but not guaranteed).

In this case, install civirules and quickbooks and the civirules menu entry disappears.

This can be fixed by switching to more current menu hook code per examples:

  1. https://lab.civicrm.org/extensions/dataprocessor/-/blob/master/dataprocessor.php#L285
  2. https://lab.civicrm.org/extensions/stripe/-/blob/master/stripe.php#L215

TLS 1.2 error on authorizing

Getting error Error.
Checking TLS 1.2 version failed. Please make sure your PHP cURL supports TSL 1.2.
My PHP version supports TLS V1.2

CiviCRM version 5.15.0
extension version 2.0
PHP version 7.2.19-1+ubuntu18.04.1
PHP_curl 7.2.20
OPENSSL 1.1.1

When testing curl https://tlstest.paypal.com/ It's coming back "PayPal_Connection_OK" So TLS v1.2 is definitely OK.

(Also should probably fix second TLS from TSL in message).

Classes

Does this support QuickBooks classes?

This extension generating thousands of small text files in my log directory.

I've just become aware that my ConfigAndLg directory contains thousands of text files with names like '89997-Response-1675246516-0.txt'.

Looking at a few of them it appears that they are related to our use of this extension. The files appear to be in pairs, one being a request and the other being a response.

Is this normal behaviour?

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.