Skip to content

feat: idr rate aggregator#212

Open
fauziladzuardhirokhmana wants to merge 1 commit into
allobankdev:mainfrom
fauziladzuardhirokhmana:feat/idr-rate-aggregator
Open

feat: idr rate aggregator#212
fauziladzuardhirokhmana wants to merge 1 commit into
allobankdev:mainfrom
fauziladzuardhirokhmana:feat/idr-rate-aggregator

Conversation

@fauziladzuardhirokhmana
Copy link
Copy Markdown

Summary

This PR implements an IDR rate aggregator service that fetches:

  • Latest IDR exchange rates
  • Historical IDR to USD rates
  • Supported currencies

The system uses a strategy pattern to handle different data sources and ensures consistent response formatting using DTOs.

Features

  • Fetch latest IDR exchange rates with spread calculation
  • Fetch historical IDR to USD exchange rates
  • Fetch supported currencies
  • Consistent JSON response using DTOs
  • Error handling for null or invalid API responses

The Strategy Pattern is used to decouple different data-fetching logics.

Each data type (latest rates, historical rates, supported currencies) has its own implementation of the IDRDataFetcher interface.

This makes the system:

  • Easily extendable (new data sources can be added without modifying existing code)
  • More maintainable
  • Cleaner separation of concerns

DTOs are used to define a clear contract between the backend and clients.

Benefits:

  • Avoid exposing raw API responses
  • Ensure consistent and controlled JSON output
  • Easier to maintain and modify response structure

Error handling is implemented at the fetcher level.

  • Null responses from external APIs are validated
  • Exceptions are logged using SLF4J
  • Runtime exceptions are thrown with meaningful messages

This ensures failures are detected early and are easier to debug.

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