osb/app/Console/Commands/Intuit/PaymentSync.php

44 lines
825 B
PHP
Raw Normal View History

2023-05-13 11:20:56 +00:00
<?php
namespace App\Console\Commands\Intuit;
2023-05-13 11:20:56 +00:00
use Illuminate\Console\Command;
use Intuit\Traits\ProviderTokenTrait;
2023-05-13 11:20:56 +00:00
use App\Jobs\AccountingPaymentSync as Job;
class PaymentSync extends Command
2023-05-13 11:20:56 +00:00
{
use ProviderTokenTrait;
2023-05-13 11:20:56 +00:00
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'intuit:payment:sync'
.' {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
* @throws \Intuit\Exceptions\NotTokenException
2023-05-13 11:20:56 +00:00
*/
public function handle()
{
$to = $this->providerToken($this->argument('user'));
2023-05-13 11:20:56 +00:00
foreach ($to->API()->getPayments() as $acc)
2023-05-13 11:20:56 +00:00
Job::dispatchSync($to,$acc);
return self::SUCCESS;
2023-05-13 11:20:56 +00:00
}
}