feat: real-time currency conversion with external API integration and fallback strategy#204
Open
wellnerds wants to merge 3 commits intoApiki:masterfrom
Open
feat: real-time currency conversion with external API integration and fallback strategy#204wellnerds wants to merge 3 commits intoApiki:masterfrom
wellnerds wants to merge 3 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.
Author
|
Ready for review. All requirements implemented and tested locally. |
Author
🚀 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. |
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.
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.