Em produção, os pedidos de interesse feitos em /apoio nunca foram vistos: só o caminho da API enfileirava o aviso à equipa. O aviso passa para o InterestSubmission::receive, por onde passam todos os caminhos de entrada, e a submissão de um pedido no Balcão Virtual passa a avisar também a equipa (até aqui só o proponente e um analista já atribuído recebiam aviso interno). - TeamNotifications: fila transaccional comum (só existe aviso se o registo ficou gravado); destinatários de PORTAL_NOTIFICATION_RECIPIENTS, sem dados pessoais nas mensagens. - NotifyDeskRequestSubmitted: protocolo e ligações protegidas de triagem. - DemographicInstallation aceita também o domínio público como a mesma instalação de produção, para o APP_URL poder passar a investemoz.tempo.co.mz. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01MzJmxFy3izprXr5dSq91jm
This commit is contained in:
@@ -70,6 +70,32 @@ class PortalOperationsTest extends TestCase
|
||||
$this->assertDatabaseCount('interest_requests', 2);
|
||||
}
|
||||
|
||||
public function test_public_support_form_notifies_the_team_once_per_new_interest(): void
|
||||
{
|
||||
// Production received interests through /apoio for months without anyone being told.
|
||||
$payload = ['fullName' => 'Pessoa sintética QA', 'email' => 'portal-integration-test@gmail.com',
|
||||
'investorType' => 'individual', 'country' => 'Moçambique', 'sectorInterest' => 'Energia',
|
||||
'message' => 'Pedido exclusivamente sintético na base QA.', 'privacyConsent' => true, 'kind' => 'support'];
|
||||
config(['portal.notifications_enabled' => true, 'portal.notification_recipients' => ['equipa@example.invalid', 'gestao@example.invalid', 'equipa@example.invalid']]);
|
||||
$key = (string) Str::uuid();
|
||||
$this->post('/apoio', [...$payload, 'submission_key' => $key])->assertSessionHasNoErrors()->assertRedirect();
|
||||
$this->assertDatabaseCount('interest_requests', 1);
|
||||
$this->assertDatabaseCount('jobs', 2); // one per distinct recipient
|
||||
$queued = DB::table('jobs')->pluck('payload')->implode(' ');
|
||||
$this->assertStringContainsString('NotifyInterestReceived', $queued);
|
||||
$this->assertStringNotContainsString('portal-integration-test@gmail.com', $queued);
|
||||
|
||||
// Replaying the same submission returns the stored interest and does not notify again.
|
||||
$this->post('/apoio', [...$payload, 'submission_key' => $key])->assertSessionHasNoErrors()->assertRedirect();
|
||||
$this->assertDatabaseCount('interest_requests', 1);
|
||||
$this->assertDatabaseCount('jobs', 2);
|
||||
|
||||
config(['portal.notifications_enabled' => false]);
|
||||
$this->post('/apoio', [...$payload, 'submission_key' => (string) Str::uuid()])->assertSessionHasNoErrors();
|
||||
$this->assertDatabaseCount('interest_requests', 2);
|
||||
$this->assertDatabaseCount('jobs', 2);
|
||||
}
|
||||
|
||||
public function test_job_checks_current_configuration_and_excludes_personal_data(): void
|
||||
{
|
||||
$interest = InterestRequest::create(['reference' => 'IR-TEST', 'full_name' => 'Pessoa confidencial',
|
||||
|
||||
Reference in New Issue
Block a user