1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-11 13:42:49 +01:00
invoiceninja/app/Services/Bank/BankService.php
2023-08-06 17:35:19 +10:00

44 lines
1.1 KiB
PHP

<?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\Services\Bank;
use App\Models\BankTransaction;
use App\Models\Invoice;
class BankService
{
public function __construct(public BankTransaction $bank_transaction)
{
}
public function matchInvoiceNumber()
{
if (strlen($this->bank_transaction->description) > 1) {
$i = Invoice::query()->where('company_id', $this->bank_transaction->company_id)
->whereIn('status_id', [1,2,3])
->where('is_deleted', 0)
->where('number', 'LIKE', '%'.$this->bank_transaction->description.'%')
->first();
return $i ?: false;
}
return false;
}
public function processRules()
{
(new ProcessBankRules($this->bank_transaction))->run();
}
}