2024-08-22 11:35:23 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Console\Commands\Intuit;
|
|
|
|
|
|
|
|
use Illuminate\Console\Command;
|
2024-08-23 05:27:34 +00:00
|
|
|
use Intuit\Traits\ProviderTokenTrait;
|
2024-08-22 11:35:23 +00:00
|
|
|
|
|
|
|
use App\Jobs\AccountingInvoiceSync as Job;
|
|
|
|
|
|
|
|
class InvoiceSync extends Command
|
|
|
|
{
|
2024-08-23 05:27:34 +00:00
|
|
|
use ProviderTokenTrait;
|
2024-08-22 11:35:23 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* The name and signature of the console command.
|
|
|
|
*
|
|
|
|
* @var string
|
|
|
|
*/
|
|
|
|
protected $signature = 'intuit:invoice:sync'
|
|
|
|
.' {user? : User Email}';
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The console command description.
|
|
|
|
*
|
|
|
|
* @var string
|
|
|
|
*/
|
|
|
|
protected $description = 'Synchronise invoices with accounting system';
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Execute the console command.
|
|
|
|
*
|
|
|
|
* @return int
|
2024-08-23 05:27:34 +00:00
|
|
|
* @throws \Intuit\Exceptions\NotTokenException
|
2024-08-22 11:35:23 +00:00
|
|
|
*/
|
|
|
|
public function handle()
|
|
|
|
{
|
2024-08-23 05:27:34 +00:00
|
|
|
Job::dispatchSync($this->providerToken($this->argument('user')));
|
2024-08-22 11:35:23 +00:00
|
|
|
|
|
|
|
return self::SUCCESS;
|
|
|
|
}
|
|
|
|
}
|