You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The DurianPy Badge System relies on TechTix as the authoritative external source of truth for community meetup events. To register badge design blueprints and verify participant or speaker badge issuances, the badge backend requires verified meetup details (name, date, venue) retrieved by entryId. Following Clean Architecture, this integration must be abstracted behind an outbound application port (TechTixGatewayPort) and implemented via an infrastructure HTTP adapter (TechTixHttpGateway), ensuring third-party network concerns do not bleed into domain models and use cases while enabling easy mocking in automated tests.
Important Details
User Story: As a backend service, I want to retrieve verified meetup event details from the TechTix API by entry ID, so that badge designs and issuances can be accurately linked to authoritative event snapshots.
Task: Implement TechTixGatewayPort outbound interface, domain exceptions, and TechTixHttpGateway HTTP adapter calling GET /events/{entryId} with Bearer API key authentication, extracting only the necessary meetup attributes into MeetupDetailDTO while discarding extraneous ticketing payload data.
// Sample Response (404 Not Found)
{
"error": "EventNotFound",
"message": "Event with entryId 9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d does not exist."
}
Scope
In-Scope:
Define abstract outbound port TechTixGatewayPort in src/application/ports/gateways/techtix_gateway_port.py.
Define domain exceptions TechTixGatewayError and TechTixEventNotFoundError in src/domain/exceptions/techtix_exceptions.py.
Export new domain exceptions in src/domain/exceptions/__init__.py.
Implement TechTixHttpGateway in src/infrastructure/gateway/techtix_http_gateway.py using httpx to query GET /events/{entryId} with Authorization: Bearer <TECHTIX_API_KEY>.
Extract only required meetup fields (meetup_id from eventId or {entryId}, name from name, date from startDate, and venue from venue) into MeetupDetailDTO.
Discard all extraneous ticketing, pricing, payment, and external platform metadata (such as ticketTypes, gcashNumber, konfhubApiKey, platformFee, and certificateTemplate) at the gateway boundary.
Add configuration settings TECHTIX_API_BASE_URL and TECHTIX_API_KEY in src/core/settings.py.
Intercept HTTP status codes: translate 404 Not Found to TechTixEventNotFoundError; translate 5xx server errors or network timeouts to TechTixGatewayError.
Mask sensitive API keys and authorization headers using mask_string in logging statements.
Provide FastAPI dependency injection provider in src/presentation/api/dependencies/techtix_dependencies.py.
Write accompanying unit tests using mocked HTTP responses to verify contract handling, selective field mapping, and error translations.
Out-of-Scope:
Parsing, validating, or storing ticketing tiers, pricing, or payment details from the TechTix response.
Managing attendee ticket registrations, webhooks, or event lifecycle operations in TechTix.
Files to Edit
src/domain/exceptions/techtix_exceptions.py: Define TechTixGatewayError and TechTixEventNotFoundError inheriting from DomainError and EntityNotFoundError.
src/domain/exceptions/__init__.py: Re-export TechTixGatewayError and TechTixEventNotFoundError.
src/application/ports/gateways/techtix_gateway_port.py: Define abstract TechTixGatewayPort with get_meetup_details(meetup_id: str) -> MeetupDetailDTO.
src/core/settings.py: Add TECHTIX_API_BASE_URL and TECHTIX_API_KEY configuration fields with environment variable loading.
src/infrastructure/gateway/techtix_http_gateway.py: Implement TechTixHttpGateway with httpx.Client, selective field mapping to MeetupDetailDTO, error translation, and token masking.
TechTixHttpGateway executes GET /events/{entryId} with Authorization: Bearer <TECHTIX_API_KEY>.
Only required meetup fields (meetup_id, name, date, venue) are extracted into MeetupDetailDTO, ignoring all extraneous ticketing, pricing, and payment metadata.
When TechTix API returns HTTP 404 Not Found, the adapter catches it and raises domain TechTixEventNotFoundError.
When TechTix API returns HTTP 5xx or connection times out, the adapter catches it and raises domain TechTixGatewayError.
Outbound HTTP requests attach authorization credentials using TECHTIX_API_KEY loaded from Settings.
Sensitive tokens and authorization headers are masked using mask_string in all log messages.
Private instance members, methods, and constants follow the double underscore (__) naming convention.
Comprehensive accompanying unit tests pass using mocked HTTP transport without requiring live network access.
References
README.md: Layer Responsibilities and Testing Standards
Context
The DurianPy Badge System relies on TechTix as the authoritative external source of truth for community meetup events. To register badge design blueprints and verify participant or speaker badge issuances, the badge backend requires verified meetup details (
name,date,venue) retrieved byentryId. Following Clean Architecture, this integration must be abstracted behind an outbound application port (TechTixGatewayPort) and implemented via an infrastructure HTTP adapter (TechTixHttpGateway), ensuring third-party network concerns do not bleed into domain models and use cases while enabling easy mocking in automated tests.Important Details
TechTixGatewayPortoutbound interface, domain exceptions, andTechTixHttpGatewayHTTP adapter callingGET /events/{entryId}with Bearer API key authentication, extracting only the necessary meetup attributes intoMeetupDetailDTOwhile discarding extraneous ticketing payload data.Sample Request / Input Payload
Sample Response / Output Payload
200 OK
Extracted Application DTO (
MeetupDetailDTO)404 Not Found
Scope
In-Scope:
TechTixGatewayPortinsrc/application/ports/gateways/techtix_gateway_port.py.TechTixGatewayErrorandTechTixEventNotFoundErrorinsrc/domain/exceptions/techtix_exceptions.py.src/domain/exceptions/__init__.py.TechTixHttpGatewayinsrc/infrastructure/gateway/techtix_http_gateway.pyusinghttpxto queryGET /events/{entryId}withAuthorization: Bearer <TECHTIX_API_KEY>.meetup_idfromeventIdor{entryId},namefromname,datefromstartDate, andvenuefromvenue) intoMeetupDetailDTO.ticketTypes,gcashNumber,konfhubApiKey,platformFee, andcertificateTemplate) at the gateway boundary.TECHTIX_API_BASE_URLandTECHTIX_API_KEYinsrc/core/settings.py.404 Not FoundtoTechTixEventNotFoundError; translate5xxserver errors or network timeouts toTechTixGatewayError.mask_stringin logging statements.src/presentation/api/dependencies/techtix_dependencies.py.Out-of-Scope:
Files to Edit
src/domain/exceptions/techtix_exceptions.py: DefineTechTixGatewayErrorandTechTixEventNotFoundErrorinheriting fromDomainErrorandEntityNotFoundError.src/domain/exceptions/__init__.py: Re-exportTechTixGatewayErrorandTechTixEventNotFoundError.src/application/ports/gateways/techtix_gateway_port.py: Define abstractTechTixGatewayPortwithget_meetup_details(meetup_id: str) -> MeetupDetailDTO.src/application/dtos/badge_design_dto.py: VerifyMeetupDetailDTOstructure (meetup_id,name,date,venue).src/core/settings.py: AddTECHTIX_API_BASE_URLandTECHTIX_API_KEYconfiguration fields with environment variable loading.src/infrastructure/gateway/techtix_http_gateway.py: ImplementTechTixHttpGatewaywithhttpx.Client, selective field mapping toMeetupDetailDTO, error translation, and token masking.src/presentation/api/dependencies/techtix_dependencies.py: Implement dependency injection providerget_techtix_gateway() -> TechTixGatewayPort.TechTixHttpGatewaywith mocked HTTP responses and error conditions.Acceptance Criteria
TechTixGatewayPortinterface definesget_meetup_details(meetup_id: str) -> MeetupDetailDTO.TechTixHttpGatewayexecutesGET /events/{entryId}withAuthorization: Bearer <TECHTIX_API_KEY>.meetup_id,name,date,venue) are extracted intoMeetupDetailDTO, ignoring all extraneous ticketing, pricing, and payment metadata.404 Not Found, the adapter catches it and raises domainTechTixEventNotFoundError.5xxor connection times out, the adapter catches it and raises domainTechTixGatewayError.TECHTIX_API_KEYloaded fromSettings.mask_stringin all log messages.__) naming convention.References
GET /events/{entryId}