Intuit commands updates
This commit is contained in:
@@ -3,16 +3,17 @@
|
||||
namespace App\Console\Commands\Intuit;
|
||||
|
||||
use Illuminate\Console\Command;
|
||||
use Intuit\Exceptions\NotTokenException;
|
||||
use Intuit\Traits\ProviderTokenTrait;
|
||||
|
||||
use App\Models\{ProviderOauth,User};
|
||||
use App\Jobs\AccountingAccountSync as Job;
|
||||
use App\Jobs\AccountingAccountSync;
|
||||
|
||||
/**
|
||||
* Synchronise Customers with Accounts
|
||||
*/
|
||||
class AccountSync extends Command
|
||||
{
|
||||
private const provider = 'intuit';
|
||||
use ProviderTokenTrait;
|
||||
|
||||
/**
|
||||
* The name and signature of the console command.
|
||||
@@ -33,16 +34,11 @@ class AccountSync extends Command
|
||||
* Execute the console command.
|
||||
*
|
||||
* @return int
|
||||
* @throws NotTokenException
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
$uo = User::where('email',$this->argument('user') ?: config('osb.admin'))->singleOrFail();
|
||||
|
||||
$so = ProviderOauth::where('name',self::provider)->singleOrFail();
|
||||
if (! ($to=$so->token($uo)))
|
||||
abort(500,sprintf('Unknown Tokens for [%s]',$uo->email));
|
||||
|
||||
Job::dispatchSync($to);
|
||||
AccountingAccountSync::dispatchSync($this->providerToken($this->argument('user')));
|
||||
|
||||
return self::SUCCESS;
|
||||
}
|
||||
|
Reference in New Issue
Block a user