Real provider integration: aggregator gateway behind TravelProviderGateway (Phase 3) - #11
Merged
Merged
Conversation
First real provider integration: replace the simulated-only sync path with an
HTTP loyalty-data aggregator adapter, activated by config.
- core: HttpAggregatorTravelProviderGateway — POSTs {providerId, membershipNumber,
credential?} to {baseUrl}/v1/balance with bearer auth, validates the response,
forwards transient credentials for one-time use, optionally scoped to
supportedProviderIds. Injectable fetch; 5 unit tests (incl. composite
precedence over the simulated gateway).
- refactor: shared buildTravelProviderGateway() factory composes aggregator (when
configured) ahead of the simulated fallback; web + worker containers now use
it instead of hand-composing (dropped their direct Composite/Simulated imports).
- env: AGGREGATOR_API_URL / AGGREGATOR_API_KEY (web + worker).
- infra: opt-in AGGREGATOR_API_KEY secret (`-c enableAggregator=true`) +
AGGREGATOR_API_URL context on the web service and the sync task; secret ARN
output. Default deploys unchanged.
- docs: integrations.md (aggregator section + factory), .env-example.
Verification: 128 tests pass (97 core incl. 5 new + 20 bot + 11 extension);
typecheck + lint clean; cdk synth clean default + `-c enableAggregator=true`.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
Bugbot is not enabled for this team, so this pull request was not reviewed. Enable Bugbot in the Cursor dashboard to get automatic reviews on future PRs. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The first real provider integration — replaces the simulated-only sync path with an HTTP loyalty-data aggregator adapter (the roadmap's "one adapter over a loyalty-data aggregator to cover the long tail"), activated by config and sitting behind the existing
TravelProviderGatewayport.HttpAggregatorTravelProviderGateway(core) — POSTs{providerId, membershipNumber, credential?}to{baseUrl}/v1/balancewith bearer auth, validates the response, forwards a transient credential for one-time use (never persisted), and can be scoped tosupportedProviderIds. Injectable fetch; 5 unit tests including composite precedence over the simulated gateway.buildTravelProviderGateway()factory composes the aggregator (when configured) ahead of the simulated fallback. The web and worker containers now use it instead of hand-composing, and dropped their directComposite/Simulatedimports — one place owns the gateway wiring.AGGREGATOR_API_URL/AGGREGATOR_API_KEY(web + worker).AGGREGATOR_API_KEYSecrets Manager placeholder (-c enableAggregator=true) +AGGREGATOR_API_URLcontext on the web service and the 6-hourly sync task; secret ARN output. Default deploys unchanged.docs/integrations.md(aggregator section + factory),.env-example.Open/closed at work: no use case, route, or schema changes — syncs just start returning real balances for covered providers, and balance history accumulates automatically.
Verification
cdk synthclean both default (no aggregator) and-c enableAggregator=true(secret + env on web + sync task confirmed in the template).🤖 Generated with Claude Code