fix: validate dossier scope and accurate directory MFA status

This commit is contained in:
2026-10-29 22:42:22 +02:00
parent 4f72751b8b
commit fb9a363e9e
7 changed files with 135 additions and 5 deletions
+1 -1
View File
@@ -53,10 +53,10 @@ final class InvestmentConsumerScope
public function context(array $context, ?string $key): array
{
$choices = $context['opportunity_choices'] ?? [];
$key = $this->key($context, $key);
if (! $choices) {
return $context;
}
$key = $key ?: (count($choices) === 1 ? $choices[0]['opportunity']['key'] : null);
$choice = $key ? collect(StructuredData::collectionItems($choices))->firstWhere('opportunity.key', $key) : null;
abort_if($key && ! $choice, 422, 'Escolha uma oportunidade deste dossier.');
$specific = ['project_summary', 'sector_id', 'sector', 'province_id', 'district_id', 'admin_post_id', 'locality_id', 'province', 'district', 'location', 'special_zone_id', 'investment_regime'];