oportunidades 4
tests / ci (push) Canceled after 0s

This commit is contained in:
2026-10-10 07:03:59 +02:00
parent e662230df7
commit 6ddafc95ba
179 changed files with 22750 additions and 933 deletions
@@ -2,6 +2,7 @@
namespace App\Http\Requests;
use App\Services\CountryCatalogue;
use App\Services\ExistingBusinessDrafts;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Support\Facades\DB;
@@ -30,7 +31,8 @@ class StoreInterestRequestRequest extends FormRequest
'investorType' => ['required', 'string', Rule::in([
'individual', 'empresa', 'fundo', 'entidade_publica', 'outro',
])],
'country' => ['required', 'string', 'max:100'],
'country' => ['required', 'string', 'max:100', ...($knownKey ? [] : [app(CountryCatalogue::class)->legacyCountryRule()])],
'declared_origin_country_code' => ['nullable', app(CountryCatalogue::class)->rule()],
'sectorInterest' => ['required', 'string', 'max:150'],
// A known receipt can replay after withdrawal; the service verifies the payload hash.
'opportunityReference' => ['nullable', 'string', 'max:80', ...($knownKey ? [] : [
@@ -4,6 +4,7 @@ declare(strict_types=1);
namespace App\Http\Requests;
use App\Services\CountryCatalogue;
use App\Services\InvestmentGeography;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Validation\Validator;
@@ -28,7 +29,7 @@ class StoreLandAssistanceCaseRequest extends FormRequest
{
return [
'version' => [$this->isMethod('post') && ! $this->routeIs('land-assistance.support') ? 'nullable' : 'required', 'integer', 'min:1'],
'payload' => ['required', 'array:support_kind,request_description,project_reference,applicant_category,full_name,contact_person,email,phone,preferred_contact,country,nationality,representative_name,representative_role,representation_basis,nuit,constitution_or_residency_note,area_status,parcels,purpose,activity,known_occupants,occupant_description,known_improvements,improvements_description,prior_right_status,prior_right_description,conflict_status,conflict_description,official_process,attachments_to_follow,exploration_plan,consultation,additional_information,truth_declaration,contact_consent'],
'payload' => ['required', 'array:support_kind,request_description,project_reference,applicant_category,full_name,contact_person,email,phone,preferred_contact,country,declared_origin_country_code,nationality,representative_name,representative_role,representation_basis,nuit,constitution_or_residency_note,area_status,parcels,purpose,activity,known_occupants,occupant_description,known_improvements,improvements_description,prior_right_status,prior_right_description,conflict_status,conflict_description,official_process,attachments_to_follow,exploration_plan,consultation,additional_information,truth_declaration,contact_consent'],
'payload.support_kind' => ['nullable', 'in:investment,home,family_exploitation,recognition,regularization,delimitation,change_of_use,transfer,existing_process,conflict_guidance,other'],
'payload.request_description' => ['nullable', 'string', 'max:4000'],
'payload.project_reference' => ['nullable', 'string', 'max:160'],
@@ -38,7 +39,8 @@ class StoreLandAssistanceCaseRequest extends FormRequest
'payload.email' => ['nullable', 'email:rfc', 'max:150'],
'payload.phone' => ['nullable', 'string', 'max:30'],
'payload.preferred_contact' => ['nullable', 'in:email,phone,any'],
'payload.country' => ['nullable', 'string', 'max:100'],
'payload.country' => ['nullable', 'string', 'max:100', app(CountryCatalogue::class)->legacyCountryRule()],
'payload.declared_origin_country_code' => ['nullable', 'string', app(CountryCatalogue::class)->rule()],
'payload.nationality' => ['nullable', 'string', 'max:120'],
'payload.representative_name' => ['nullable', 'string', 'max:200'],
'payload.representative_role' => ['nullable', 'string', 'max:120'],
@@ -132,7 +134,9 @@ class StoreLandAssistanceCaseRequest extends FormRequest
continue;
}
$record = $geography->publicReferences()->where('id', $id)->first(['id', 'parent_id', 'location_type']);
if ($gap || ! $record || $record->location_type !== $expectedType || ($expectedType === 'province' ? $record->parent_id !== null : (string) $record->parent_id !== $parent)) {
// The populated workbook hierarchy has country -> province. The public
// selector deliberately starts at province; it is not a root in storage.
if ($gap || ! $record || $record->location_type !== $expectedType || ($expectedType !== 'province' && (string) $record->parent_id !== $parent)) {
$validator->errors()->add("payload.parcels.$index.$field", 'A hierarquia territorial declarada é incoerente ou não está publicada.');
$gap = true;
}
@@ -2,6 +2,7 @@
namespace App\Http\Requests;
use App\Services\CountryCatalogue;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Support\Facades\DB;
use Illuminate\Validation\Validator;
@@ -62,6 +63,7 @@ class StoreSimulationFormDraftRequest extends FormRequest
$rules = [
// Anonymous clients must send an empty snapshot; `required` rejects
// an empty array before the privacy policy can enforce that shape.
'context' => ['nullable', 'uuid'],
'personal_snapshot' => ['present', 'array:'.implode(',', $personal)],
'economic_snapshot' => ['required', 'array:'.implode(',', $economic)],
'economic_snapshot.purpose' => ['required', 'in:simulate_only,own_investment,seek_investor,seek_partner,present_opportunity,request_facilitation'],
@@ -169,6 +171,10 @@ class StoreSimulationFormDraftRequest extends FormRequest
'contact_province', 'contact_district', 'preferred_channel'] as $field) {
$rules['personal_snapshot.'.$field] = ['nullable', 'string', 'max:3000'];
}
foreach (['tax_residency_country', 'fiscal_residency_country', 'contact_country'] as $field) {
$rules['personal_snapshot.'.$field][] = app(CountryCatalogue::class)->legacyCountryRule();
}
$rules['economic_snapshot.funds_origin_countries.*'][] = app(CountryCatalogue::class)->legacyCountryRule();
return $rules;
}