1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-15 23:52:33 +01:00
invoiceninja/app/Jobs/Client/CheckVat.php

65 lines
1.4 KiB
PHP
Raw Normal View History

2023-05-25 08:41:29 +02:00
<?php
/**
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
* @copyright Copyright (c) 2023. Invoice Ninja LLC (https://invoiceninja.com)
*
* @license https://www.elastic.co/licensing/elastic-license
*/
namespace App\Jobs\Client;
2023-10-26 04:57:44 +02:00
use App\Libraries\MultiDB;
2023-05-25 08:41:29 +02:00
use App\Models\Client;
use App\Models\Company;
use App\Services\Tax\TaxService;
2023-10-26 04:57:44 +02:00
use App\Utils\Traits\MakesHash;
use Illuminate\Bus\Queueable;
2023-05-25 08:41:29 +02:00
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
2023-10-26 04:57:44 +02:00
use Illuminate\Queue\InteractsWithQueue;
2023-05-25 08:41:29 +02:00
use Illuminate\Queue\Middleware\WithoutOverlapping;
2023-10-26 04:57:44 +02:00
use Illuminate\Queue\SerializesModels;
2023-05-25 08:41:29 +02:00
class CheckVat implements ShouldQueue
{
use Dispatchable;
use InteractsWithQueue;
use Queueable;
use SerializesModels;
use MakesHash;
public $tries = 1;
/**
* Create a new job instance.
*
* @param Client $client
* @param Company $company
*/
public function __construct(public Client $client, protected Company $company)
{
}
/**
* Execute the job.
*
*/
public function handle()
{
MultiDB::setDb($this->company->db);
$tax_service = new TaxService($this->client);
$tax_service->validateVat();
}
public function middleware()
{
return [new WithoutOverlapping($this->client->id)];
}
}