Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invoice: Optional payment fields override Quickbooks default handling #603

Open
vanboom opened this issue Jan 15, 2024 · 7 comments
Open

Comments

@vanboom
Copy link
Contributor

vanboom commented Jan 15, 2024

We have noticed that invoices exported to Quickbooks Online do not follow the default settings to allow online credit card payments. When building invoices, we are not setting these fields, but they appear to be sent over in the payload...

<Invoice>
....
<AllowOnlinePayment>false</AllowOnlinePayment>
<AllowOnlineCreditCardPayment>false</AllowOnlineCreditCardPayment>
<AllowOnlineACHPayment>false</AllowOnlineACHPayment>
</Invoice>

It appears that we are commanding Quickbooks optional fields such as AllowOnlineCreditCardPayment which we are never setting on our invoice model. My suggestion would be to not send these optional fields if they are 'nil' to allow Quickbooks default handling to take effect.

@vanboom
Copy link
Contributor Author

vanboom commented Jan 16, 2024

Update -- a monkey patch achieves the desired result by stripping the values from the XML payload, but this would not allow the values to be set. Seems we have a larger issue since ROXML sends the entire payload even when attributes are not set.

class Quickbooks::Model::Invoice

  def to_xml(options={})
    f = Nokogiri::XML.fragment(super(options))
    f.search("Invoice/AllowOnlinePayment").remove
    f.search("Invoice/AllowOnlineCreditCardPayment").remove
    f.search("Invoice/AllowOnlineACHPayment").remove
    return f
  end
end

I have not yet found a way to establish some fields as optional, i.e. do not include them in the payload if they are not set.

@ruckus
Copy link
Owner

ruckus commented Jan 19, 2024

Thanks for the feedback @vanboom .

It looks like that not setting an attribute results in somewhat undefined behavior. But for these boolean-like attributes it does coalesce down to false.

Are you able to literally specify these attributes as needed?

When I need to use these attributes I assume they are default (which does work for me) and when needed I call

invoice.allow_online_credit_card_payment = true

I see your monkeypatch and that would work. But I am curious: why not just set them to false?

@ruckus
Copy link
Owner

ruckus commented Jan 19, 2024

@vanboom Er, or true if needed?

@vanboom
Copy link
Contributor Author

vanboom commented Jan 19, 2024

I see your monkeypatch and that would work. But I am curious: why not just set them to false?

Hi @ruckus, the theory was that by not setting the optional fields, we would allow Quickbooks to apply their own default value per invoice using the customer defaults. i.e. some customers would have ACH payments enabled, while others may have CC payments enabled, while others would have false for all.

After some testing with the monkey patch above in place however, it appears that Quickbooks does not appear to apply the customer defaults to invoices created through the API even when we do not send the optional flags. Quickbooks honors the flags if set to true/false, but does not appear to be applying the customer defaults for API created invoices when the optional flags are not sent. This is concerning and I would consider that an issue with Quickbooks - this may take a while to confirm with them!

@ruckus
Copy link
Owner

ruckus commented Jan 19, 2024

@vanboom I see, thanks for the additional info. So if I am understanding your goal is the Customer.PaymentMethodRef field and it being a credit card or ACH should set the corresponding attribute on the Invoice (allow ACH or allow card).

Setting that attribute in QBO.com for a test customer and then creating an Invoice doesn't seem to toggle those attributes in the QB Invoice form. They appear to be set on/off at a system-wide level.

@vanboom
Copy link
Contributor Author

vanboom commented Jan 26, 2024

@ruckus, I think the settings that are in play are company settings as depicted here:
qbosettings

I am not quite sure yet how the chain of settings is applied in Quickbooks.
We have a configuration where Accept Credit Cards or Accept ACH is enabled at the company settings level, but the invoices that are created through the API do not have the appropriate payment setting enabled.

I noticed that we were commanding the AllowOnlineCreditCardPayment setting to false in the payload and that prompted the posting of this issue.
However, the monkey patch to remove the settings from the invoice payload does not appear to apply the company wide default either. Possibly both the Company and Customer settings need to be enabled for this to happen. I will do some more research today.

@vanboom
Copy link
Contributor Author

vanboom commented Feb 5, 2024

I have reported this issue to Quickbooks -- it certainly appears that they are not applying the company preferences for ACH and CC payments to the API created invoices. Unfortunately, even though there are separate check boxes for ACH and CC payments in the sales forms -> preferences area, the preferences model only includes one attribute for e_transaction_payment_enabled? so we are not able to apply the ACH / CC specific defaults ourselves by reading the preferences data.

So the behavior that prompted this issue is a Quickbooks issue, however, I think it is still worth considering whether or not we should be sending optional attributes as false when they are not explicitly commanded by the user. Thank you for your consideration on this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants