mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/exchange-2.0.git
synced 2026-08-22 22:13:59 +00:00
57 lines
1.2 KiB
PHP
57 lines
1.2 KiB
PHP
<?php
|
|
|
|
namespace App\Classes\Modules\Rules\Standards\Rules;
|
|
|
|
use App\Classes\Exceptions\CriteriaNotFulfilledException;
|
|
use App\Classes\General\Abstracts\AbstractRule;
|
|
use App\Classes\Modules\Companies\Services\FetchesCompany;
|
|
|
|
class CanPassEInvoicePromptedRule extends AbstractRule
|
|
{
|
|
|
|
/** @var FetchesCompany */
|
|
private $fetchesCompany;
|
|
|
|
/**
|
|
* CanPassEInvoicePromptedRule constructor.
|
|
* @param FetchesCompany $fetchesCompany
|
|
*/
|
|
public function __construct(FetchesCompany $fetchesCompany)
|
|
{
|
|
$this->fetchesCompany = $fetchesCompany;
|
|
}
|
|
|
|
/**
|
|
* @return bool
|
|
*/
|
|
protected function authorized($object): bool
|
|
{
|
|
return true;
|
|
|
|
}
|
|
|
|
/**
|
|
* @return bool
|
|
*/
|
|
protected function validators($object): bool
|
|
{
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
/**
|
|
* @return bool
|
|
*/
|
|
protected function criteria($object): bool
|
|
{
|
|
//Check if account requires E-Invoice
|
|
$company = $this->fetchesCompany->execute(['id' => $object->companyId]);
|
|
if($company->e_invoice === null){
|
|
throw new CriteriaNotFulfilledException("Please refresh page and click 'Make Payment' first to answer question related to E-Invoice.");
|
|
}
|
|
return true;
|
|
}
|
|
|
|
}
|