Skip to content

Feat/idr rate aggregator by thaufan#166

Open
thaufaniqbal wants to merge 16 commits intoallobankdev:mainfrom
thaufaniqbal:feat/idr-rate-aggregator
Open

Feat/idr rate aggregator by thaufan#166
thaufaniqbal wants to merge 16 commits intoallobankdev:mainfrom
thaufaniqbal:feat/idr-rate-aggregator

Conversation

@thaufaniqbal
Copy link

Summary

This PR implements the Strategy Pattern for IDR-related data fetchers and sets up the main service with spread factor calculation. It ensures modularity, testability, and clean architecture for the Finance API.

Changes

  • Added strategy classes:
    • LatestIdrRatesFetcher (with spread factor calculation)
    • HistoricalIdrUsdFetcher
    • SupportedCurrenciesFetcher
  • Configured WebClient via FactoryBean with base URL and timeout
  • Implemented USD_BuySpread_IDR calculation using personalized spread factor (0.00264)
  • Built FinanceDataStore as a thread-safe immutable in-memory store
  • Added ApplicationRunner for startup data initialization
  • Implemented MDC Trace Filter for request tracing
  • Added exception handling with custom ResourceNotFoundException
  • Updated README with setup, usage examples, and endpoint documentation
  • Added unit and integration tests (JUnit 5, Mockito, WireMock)

Testing

  • Verified endpoints via cURL/Postman:
    • /api/finance/data/latest_idr_rates
    • /api/finance/data/historical_idr_usd
    • /api/finance/data/supported_currencies
  • Spread factor calculation matches requirements
  • All unit and integration tests passed (mvn test)

Notes

  • Health check and app info available via Spring Boot Actuator
  • H2 in-memory database console enabled for inspection
  • Code structured to be modular, maintainable, and easily extensible for new resource types

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant