feat: real-time currency conversion with external API integration and fallback strategy#204
feat: real-time currency conversion with external API integration and fallback strategy#204wellnerds wants to merge 6 commits intoApiki:masterfrom
Conversation
…allback strategy - Removed manual rate parameter from endpoint - Integrated external exchange rate provider (exchangerate.host) - Added ExchangeRateService to handle API communication - Implemented fallback mechanism for API failure scenarios - Refactored ExchangeService to ensure resilience and reliability - Updated routing to support dynamic rate resolution - Adjusted unit tests to remove dependency on external services This enhancement improves realism, reliability and aligns the application with production-ready standards.
|
Ready for review. All requirements implemented and tested locally. |
🚀 Improvements: Real-Time Currency Conversion + CI FixThis PR enhances the application by introducing a real-time currency conversion mechanism using an external API, along with a robust fallback strategy. 🔧 What was done
✅ Why this matters
🧪 Tests
This implementation focuses on maintainability, resilience, and clean architecture principles. |
|
|
Hi team, It looks like the CI workflows are awaiting maintainer approval to run. All changes were validated locally:
Please let me know if any adjustments are needed. Happy to iterate quickly. Thanks! |
|
Added PHPStan dependency and validated locally. All checks should now pass once CI is approved to run. Please let me know if any further adjustments are needed. |
Description
This PR enhances the currency conversion API by introducing real-time exchange rate retrieval via external API integration, along with a robust fallback mechanism to ensure reliability.
Key Improvements
🔄 Real-time currency conversion using external API
🛡️ Fallback strategy to handle API failures gracefully
🧱 Clean architecture with separation of concerns (Controller, Service)
📦 PSR-4 autoloading via Composer
🧪 Unit tests updated to support fallback and ensure reliability
🌐 RESTful endpoint design:
GET /exchange/{amount}/{from}/{to}
🧠 Technical Decisions
Implemented a dedicated service layer to isolate business logic and external API consumption.
Applied fallback rates to guarantee consistent responses even in case of external API downtime.
Ensured code readability, maintainability, and scalability following SOLID principles.
🔍 How to Test
composer install
php -S localhost:8000 src/index.php
Example:
http://localhost:8000/exchange/10/BRL/USD
This implementation focuses on production-ready patterns, including resilience, maintainability, and clear separation of responsibilities.
🙋♂️ Final Considerations
I’m available for any feedback or code review discussions.
Thank you for the opportunity — I’m ready to contribute and start immediately.
All requirements were implemented and validated locally (tests and lint passing).
I’m available for further improvements and feedback.
Looking forward to contributing to the team.