1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-14 15:13:29 +01:00
invoiceninja/app/Services/Bank/BankService.php
2023-02-16 12:36:09 +11: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::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();
}
}