2023-05-13 11:20:56 +00:00
|
|
|
<?php
|
|
|
|
|
2024-07-14 03:49:00 +00:00
|
|
|
namespace App\Console\Commands\Intuit;
|
2023-05-13 11:20:56 +00:00
|
|
|
|
|
|
|
use Illuminate\Console\Command;
|
2024-08-23 05:27:34 +00:00
|
|
|
use Intuit\Traits\ProviderTokenTrait;
|
2023-05-13 11:20:56 +00:00
|
|
|
|
|
|
|
use App\Jobs\AccountingPaymentSync as Job;
|
|
|
|
|
2024-07-14 03:49:00 +00:00
|
|
|
class PaymentSync extends Command
|
2023-05-13 11:20:56 +00:00
|
|
|
{
|
2024-08-23 05:27:34 +00:00
|
|
|
use ProviderTokenTrait;
|
2024-07-14 03:49:00 +00:00
|
|
|
|
2023-05-13 11:20:56 +00:00
|
|
|
/**
|
|
|
|
* The name and signature of the console command.
|
|
|
|
*
|
|
|
|
* @var string
|
|
|
|
*/
|
2024-08-23 05:27:34 +00:00
|
|
|
protected $signature = 'intuit:payment:sync'
|
2024-07-14 03:49:00 +00:00
|
|
|
.' {user? : User Email}';
|
2023-05-13 11:20:56 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* The console command description.
|
|
|
|
*
|
|
|
|
* @var string
|
|
|
|
*/
|
|
|
|
protected $description = 'Synchronise payments with accounting system';
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Execute the console command.
|
|
|
|
*
|
|
|
|
* @return int
|
2024-08-23 05:27:34 +00:00
|
|
|
* @throws \Intuit\Exceptions\NotTokenException
|
2023-05-13 11:20:56 +00:00
|
|
|
*/
|
|
|
|
public function handle()
|
|
|
|
{
|
2024-08-23 05:27:34 +00:00
|
|
|
$to = $this->providerToken($this->argument('user'));
|
2023-05-13 11:20:56 +00:00
|
|
|
|
2024-08-23 05:27:34 +00:00
|
|
|
foreach ($to->API()->getPayments() as $acc)
|
2023-05-13 11:20:56 +00:00
|
|
|
Job::dispatchSync($to,$acc);
|
2024-07-14 03:49:00 +00:00
|
|
|
|
|
|
|
return self::SUCCESS;
|
2023-05-13 11:20:56 +00:00
|
|
|
}
|
|
|
|
}
|