diff --git a/app/Import/Providers/Csv.php b/app/Import/Providers/Csv.php index ca100364f29f..ecc1f15dce7e 100644 --- a/app/Import/Providers/Csv.php +++ b/app/Import/Providers/Csv.php @@ -46,6 +46,7 @@ use App\Repositories\PaymentRepository; use App\Repositories\ProductRepository; use App\Repositories\QuoteRepository; use App\Repositories\VendorRepository; +use App\Services\Bank\BankMatchingService; use App\Utils\Traits\MakesHash; use Illuminate\Support\Facades\Validator; use Symfony\Component\HttpFoundation\ParameterBag; @@ -107,6 +108,8 @@ class Csv extends BaseImport implements ImportInterface $bank_transaction_count = $this->ingest($data, $entity_type); $this->entity_count['bank_transactions'] = $bank_transaction_count; + BankMatchingService::dispatchSync($this->company->id, $this->company->db); + } public function client() diff --git a/app/Services/Bank/BankMatchingService.php b/app/Services/Bank/BankMatchingService.php index bd95296d4fa0..4cdb3415c6af 100644 --- a/app/Services/Bank/BankMatchingService.php +++ b/app/Services/Bank/BankMatchingService.php @@ -33,21 +33,13 @@ class BankMatchingService implements ShouldQueue { use Dispatchable, InteractsWithQueue, Queueable, SerializesModels, GeneratesCounter; - private $company_id; - private Company $company; - private $db; - private $invoices; public $deleteWhenMissingModels = true; - public function __construct($company_id, $db) - { - $this->company_id = $company_id; - $this->db = $db; - } + public function __construct(private int $company_id, private string $db){} public function handle() { @@ -77,6 +69,6 @@ class BankMatchingService implements ShouldQueue public function middleware() { - return [new WithoutOverlapping($this->company->company_key)]; + return [new WithoutOverlapping($this->company_id)]; } } diff --git a/app/Services/Bank/BankService.php b/app/Services/Bank/BankService.php index 5ff37a1ab6b1..3cb00fdb282c 100644 --- a/app/Services/Bank/BankService.php +++ b/app/Services/Bank/BankService.php @@ -13,7 +13,7 @@ namespace App\Services\Bank; use App\Models\BankTransaction; use App\Models\Invoice; -use App\Services\Bank\ProcessBankRule; +use App\Services\Bank\ProcessBankRules; class BankService {