2024-07-14 03:49:00 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Console\Commands\Intuit;
|
|
|
|
|
|
|
|
use Illuminate\Console\Command;
|
2024-08-12 13:31:59 +00:00
|
|
|
use Intuit\Exceptions\NotTokenException;
|
|
|
|
use Intuit\Traits\ProviderTokenTrait;
|
2024-07-14 03:49:00 +00:00
|
|
|
|
2024-08-12 13:31:59 +00:00
|
|
|
use App\Jobs\AccountingAccountSync;
|
2024-07-14 03:49:00 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Synchronise Customers with Accounts
|
|
|
|
*/
|
|
|
|
class AccountSync extends Command
|
|
|
|
{
|
2024-08-12 13:31:59 +00:00
|
|
|
use ProviderTokenTrait;
|
2024-07-14 03:49:00 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* The name and signature of the console command.
|
|
|
|
*
|
|
|
|
* @var string
|
|
|
|
*/
|
|
|
|
protected $signature = 'intuit:account:sync'
|
|
|
|
.' {user? : User Email}';
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The console command description.
|
|
|
|
*
|
|
|
|
* @var string
|
|
|
|
*/
|
|
|
|
protected $description = 'Synchronise accounts with quickbooks';
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Execute the console command.
|
|
|
|
*
|
|
|
|
* @return int
|
2024-08-12 13:31:59 +00:00
|
|
|
* @throws NotTokenException
|
2024-07-14 03:49:00 +00:00
|
|
|
*/
|
|
|
|
public function handle()
|
|
|
|
{
|
2024-08-12 13:31:59 +00:00
|
|
|
AccountingAccountSync::dispatchSync($this->providerToken($this->argument('user')));
|
2024-07-14 03:49:00 +00:00
|
|
|
|
|
|
|
return self::SUCCESS;
|
|
|
|
}
|
|
|
|
}
|