agileware / au.com.agileware.civiquickbooks

A CiviCRM extension which integrates CiviCRM with QuickBooks Online
https://agileware.com.au
Other
6 stars 9 forks source link

Contribution status update is not pushed to quickbooks #50

Open samuelsov opened 11 months ago

samuelsov commented 11 months ago

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 ?

agileware-justin commented 11 months ago

Problem: the contribution status is not pushed in Quickbooks

Can you elaborate on this workflow and your expectations.

samuelsov commented 11 months ago

When we do a payment by credit card, it is pushed in Quickbooks as an invoice + a payment so the invoice is marked as paid.

When we do a payment by check (pending), it is pushed in Quickbooks as an invoice (no payment).

So my expectation is that adding a payment to a pending contribution in CiviCRM should add a payment in Quickbooks.

I think it would require a call to CRM_Civiquickbooks_Invoice::pushPayments when a payment is added in CiviCRM.

Does that make sense ?

darrick commented 11 months ago

@samuelsov What is pushed depends upon the contribution statuses in the accountsync settings. I think by default it's only "Completed". So, check the account_sync_push_contribution_status setting.

Then check the civicrm_account_invoice table to see if that setting is working. I.e. if Pending isn't in the list then when you create a contribution by check see if the contribution ends up in that table (it shouldn't). But check the contribution you created is in state pending. In my system when I create a contribution by check it's status is completed.

And you're supposed to be able to set the accountsync settings via the quickbooks settings form. But it's currently broken. I'm here because I'm working on a PR for that.

I also added some code for passing the $QBOPayment->DepositToAccountRef and $QBOPayment->PaymentMethodRef into Quickbooks. That may be what you are looking for. As, I recall when I took Credit Cards they ended up in my CC processor account but also the Same happened when I took checks. Which I needed in the Undeposited Funds account on QB. https://github.com/agileware/au.com.agileware.civiquickbooks/compare/master...darrick:au.com.agileware.civiquickbooks:v2.9.4#

samuelsov commented 11 months ago

@darrick Thank you but I don't think it's a setting issue:

I'll check the code regarding pushing DepositToAccountRef and PaymentMethodRef. Not sure this is the crux of the problem though as the pushing of the payment doesn't seems to be triggered in the first hand.

I will do some more testing to see if there is a specific reason payment is not pushed but my feeling is that this use case is simply not implemented yet.

danielb-dd commented 9 months ago

@samuelsov Did you manage to solve this issue? I am having a similar issue with pending and cancelled statuses not being synced from and to civi

agileware-fj commented 6 months ago

This is not a matter so much that there's an issue with pushing updates through, but that the system is designed to only push new invoices to Quickbooks Online, and receive updates back from it, i.e. changes to existing invoices should be performed directly in QBO:

  1. Create Contribution in CiviCRM
  2. Invoice is created in QBO
  3. Mark Invoice as paid, or voided, in QBO
  4. Contribution is marked accordingly in CiviCRM

Swapping steps 3 & 4 is not supported.

This followed the model that CiviXero set at the time we created this and is the model our clients prefer.

If anyone wants to create a PR to add this as a feature, we'd be happy to review on the proviso that the functionality was opt-in.