protected function meetsGatewayTypeLimits($gatewayTypeId)
{
if (!$gatewayTypeId) {
return true;
}
$accountGatewaySettings = AccountGatewaySettings::scope(false, $this->invitation->account_id)->where('account_gateway_settings.gateway_type_id', '=', $gatewayTypeId)->first();
if ($accountGatewaySettings) {
$invoice = $this->invoice();
if ($accountGatewaySettings->min_limit !== null && $invoice->balance < $accountGatewaySettings->min_limit) {
return false;
}
if ($accountGatewaySettings->max_limit !== null && $invoice->balance > $accountGatewaySettings->max_limit) {
return false;
}
}
return true;
}