Fixes for qb imports without direction access to QB API

This commit is contained in:
David Bomba
2026-01-25 14:45:16 +11:00
parent 68c7ba44cd
commit 4ff61e696f
2 changed files with 20 additions and 16 deletions

View File

@@ -4,6 +4,7 @@ namespace App\Import\Providers;
use App\Models\Company;
use App\Models\Invoice;
use App\Import\Providers\BaseImport;
use Illuminate\Support\Facades\Cache;
use App\Services\Quickbooks\QuickbooksService;
use App\Services\Quickbooks\Transformers\ClientTransformer;

View File

@@ -62,25 +62,28 @@ class QuickbooksService
private function init(): self
{
$config = [
'ClientID' => config('services.quickbooks.client_id'),
'ClientSecret' => config('services.quickbooks.client_secret'),
'auth_mode' => 'oauth2',
'scope' => "com.intuit.quickbooks.accounting",
'RedirectURI' => $this->testMode ? 'https://grok.romulus.com.au/quickbooks/authorized' : 'https://invoicing.co/quickbooks/authorized',
'baseUrl' => $this->testMode ? CoreConstants::SANDBOX_DEVELOPMENT : CoreConstants::QBO_BASEURL,
];
if(config('services.quickbooks.client_id'))
{
$config = [
'ClientID' => config('services.quickbooks.client_id'),
'ClientSecret' => config('services.quickbooks.client_secret'),
'auth_mode' => 'oauth2',
'scope' => "com.intuit.quickbooks.accounting",
'RedirectURI' => $this->testMode ? 'https://grok.romulus.com.au/quickbooks/authorized' : 'https://invoicing.co/quickbooks/authorized',
'baseUrl' => $this->testMode ? CoreConstants::SANDBOX_DEVELOPMENT : CoreConstants::QBO_BASEURL,
];
$merged = array_merge($config, $this->ninjaAccessToken());
$merged = array_merge($config, $this->ninjaAccessToken());
$this->sdk = DataService::Configure($merged);
$this->sdk->enableLog();
$this->sdk->setMinorVersion("75");
$this->sdk->throwExceptionOnError(true);
$this->checkToken();
$this->sdk = DataService::Configure($merged);
$this->sdk->enableLog();
$this->sdk->setMinorVersion("75");
$this->sdk->throwExceptionOnError(true);
$this->checkToken();
}
$this->invoice = new QbInvoice($this);
$this->quote = new QbQuote($this);