'test-meet-key']); $this->owner = User::factory()->create(['public_id' => 'usr_verify_badge']); } public function test_service_api_verifies_confirmed_badge(): void { $event = QrCode::create([ 'user_id' => $this->owner->id, 'short_code' => 'evt-verify-1', 'type' => QrCode::TYPE_EVENT, 'label' => 'Verify badge event', 'payload' => [ 'content' => [ 'title' => 'Verify badge event', 'format' => 'virtual', 'virtual_sessions' => [], ], 'style' => [], ], 'is_active' => true, ]); QrEventRegistration::create([ 'qr_code_id' => $event->id, 'user_id' => $this->owner->id, 'reference' => 'QRE-TESTVERIFY001', 'badge_code' => 'BADGE999', 'tier_name' => 'General', 'amount_minor' => 0, 'currency' => 'GHS', 'attendee_name' => 'Ada Lovelace', 'attendee_email' => 'ada@example.com', 'status' => QrEventRegistration::STATUS_CONFIRMED, ]); $this->withToken('test-meet-key') ->postJson('/api/service/v1/events/'.$event->id.'/verify-registration', [ 'owner_ref' => $this->owner->public_id, 'badge_code' => 'badge999', ]) ->assertOk() ->assertJsonPath('registration.attendee_name', 'Ada Lovelace') ->assertJsonPath('registration.badge_code', 'BADGE999'); } public function test_service_api_returns_not_found_for_unknown_badge(): void { $event = QrCode::create([ 'user_id' => $this->owner->id, 'short_code' => 'evt-verify-2', 'type' => QrCode::TYPE_EVENT, 'label' => 'Missing badge event', 'payload' => [ 'content' => [ 'title' => 'Missing badge event', 'format' => 'virtual', ], 'style' => [], ], 'is_active' => true, ]); $this->withToken('test-meet-key') ->postJson('/api/service/v1/events/'.$event->id.'/verify-registration', [ 'owner_ref' => $this->owner->public_id, 'badge_code' => 'NOPE123', ]) ->assertNotFound(); } }