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

Hardcoded Production Base URL (CIVIQBO-94) #14

Closed aniesshsethh closed 2 years ago

aniesshsethh commented 4 years ago

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

agileware-fj commented 4 years ago

Thanks for the report.

Hard-coding the use of the Production baseUrl is intentional, although this should possibly be changed.

There's no code at this stage to recognise the extension is being attached to a sandbox account at authentication time, and on a quick review it looks like there's no setting for it either.

Pull requests to implement this would be welcome.

agileware-fj commented 4 years ago

Just for some extra context: the QuickBooks Online PHP SDK allows two values for "baseUrl" – "Production" or "Sandbox", referring to which QuickBooks Online API endpoint the application should use.

For distribution of this extension, we currently hardcode "Production" under the assumption that people installing the extension wish to use it with their accounting system, and people who wish to extend or otherwise develop on the extension will be able to update the extension code to use "Sandbox".

darrick commented 2 years ago

I think at least having this in the README would help. Took me about an hour to track down. My fault for not checking here first.

QB asks about a billion questions just to get the OAUTH for Production. While they create a sandbox OAUTH right off the bat. Considering what this extension does I think it's helpful as admin to just run through it with the sandbox real quick to make sure it's all setup right. It's a great way to test drive it.

agileware-justin commented 2 years ago

Good point @darrick . The line in question being now, https://github.com/agileware/au.com.agileware.civiquickbooks/blob/2d1019f7929c33de568c4826e45118f69532234e/CRM/Quickbooks/APIHelper.php#L102

Agree there should be an option provided on the QBO Settings page to select either Production or Sandbox. Until that happens, will update the README.

agileware-justin commented 2 years ago

README updated.

agileware-justin commented 2 years ago

Agileware Ref: CIVIQBO-94

agileware-justin commented 2 years ago

Fixed in 2.8.3. Thanks again @darrick for your contribution.