Update to get an individual payment from intuit

This commit is contained in:
2023-05-13 22:01:43 +10:00
parent 8ad9e73abb
commit a195e4b55b
3 changed files with 12 additions and 6 deletions

View File

@@ -7,6 +7,7 @@ use Illuminate\Console\Command;
use Illuminate\Support\Facades\Config;
use Intuit\Exceptions\ConnectionIssueException;
use App\Jobs\AccountingPaymentSync as Job;
use App\Models\{ProviderOauth,Site,User};
class AccountingPaymentGet extends Command
@@ -47,12 +48,16 @@ class AccountingPaymentGet extends Command
try {
$api = $to->API();
dump($api->getPaymentQuery($this->argument('id')));
$acc = $api->getPayment($this->argument('id'));
dump($acc);
} catch (ConnectException|ConnectionIssueException $e) {
$this->error($e->getMessage());
return Command::FAILURE;
}
if ($acc)
Job::dispatchSync($to,$acc);
}
}

View File

@@ -12,6 +12,7 @@ use Illuminate\Queue\SerializesModels;
use Illuminate\Support\Facades\Log;
use App\Models\{Account,Invoice,Payment,PaymentItem,ProviderToken};
use Intuit\Models\Payment as PaymentModel;
/**
* Synchronise payments with our payments.
@@ -26,7 +27,7 @@ class AccountingPaymentSync implements ShouldQueue
private const LOGKEY = 'JPS';
private \Intuit\Models\Payment $pmi;
private PaymentModel $pmi;
private ProviderToken $to;
/**
@@ -34,7 +35,7 @@ class AccountingPaymentSync implements ShouldQueue
*
* @return void
*/
public function __construct(ProviderToken $to,\Intuit\Models\Payment $pmi)
public function __construct(ProviderToken $to,PaymentModel $pmi)
{
$this->pmi = $pmi;
$this->to = $to;