Quickbooks::IntuitRequestException solved-ish #619
dougjq
started this conversation in
Show and tell
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I'm very appreciative of this gem and the effort it took to make it! I found it challenging to mock calls to Intuit for thorough testing. The error message is not unlike what Intuit itself provides, which makes this gem accurate:
Quickbooks::IntuitRequestException: : <?xml version="1.0"?>
This error is not very instructive on first glance. I wanted to share what I learned for future travelers. The default expected response format is xml. The xml must have a namespace "xmlns" defined. Here is an example xml response for a Deposit object. (Replace "Deposit" with the object of interest.)
`
<IntuitResponse xmlns="http://schema.intuit.com/finance/v3\" time="2025-01-02T18:47:23.761-08:00">
<Deposit domain="QBO" sparse="false">...
`
So Quickbooks::IntuitRequestException in the context of mocking a response means your response is missing something expected like the namespace or the response object. If it's badly missing, all you'll see in the error is as shown above: empty xml generated from trying to parse an invalid response for unnamespaced xml or a malformed object.
Sorry if that's not clear. I was able to make progress and understand this for myself with RubyMine and breakpointing inside the gem, running an actual Sandbox call to get an actual Intuit response, and then copy-pasting that actual response for my mocked response. At long last, I will have 100% coverage for my Quickbooks service. I hope you will too!
Beta Was this translation helpful? Give feedback.
All reactions