Skip to content

Sednor/payment-service

Repository files navigation

🧑‍💻 Task Requirements

You need to build a C# Web API that exposes a single endpoint:

POST /payout

Your service must:

  1. Accept incoming requests with header:

    x-provider: A
    

    or

    x-provider: B
    
  2. Forward the request to the correct mock provider (http://provider-a:5001/payout or http://provider-b:5002/payout).

  3. Each provider has:

    • Different request schema
    • Different response schema
  4. Your solution should:

    • Keep the controller thin — it should only delegate work to your application services.

    • Introduce a central service (for example, PayoutCoreService) that orchestrates the flow:

      • Log the start of a payout.
      • Translate the incoming request into the provider’s format.
      • Call the provider.
      • Translate the provider’s response back to your system’s response format.
      • Log the successful payout.
    • Encapsulate provider-specific logic behind interfaces so it’s easy to add new providers later.

    • Introduce a mapping layer to handle conversions between your internal DTOs and provider-specific DTOs.


📌 What we expect to see

  • A design where:

    • Provider selection is not hardcoded in the controller (it should be resolved cleanly elsewhere).
    • Mappers/adapters handle translation of requests and responses.
    • A single orchestration service ties everything together.

You are free to design the abstractions as you see fit. What matters most is that the code is extensible, clean, and testable.


About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages