Coding Exercise:: Recommendations
Coding Exercise:: Recommendations
Write a Flask Web API with only 1 method called “ProcessPayment” that receives a request
like this
The payment could be processed using different payment providers (external services)
called:
- PremiumPaymentGateway
- ExpensivePaymentGateway
- CheapPaymentGateway.
The payment gateway that should be used to process each payment follows the next set of
business rules:
a) If the amount to be paid is less than £20, use CheapPaymentGateway.
b) If the amount to be paid is £21-500, use ExpensivePaymentGateway if available.
Otherwise, retry only once with CheapPaymentGateway.
c) If the amount is > £500, try only PremiumPaymentGateway and retry up to 3 times
in case payment does not get processed.
Recommendations:
- The classes should be written in such way that they are easy to test.
- Write as many tests as you think is enough to be certain about your solution works -
Use SOLID principles.
- Decouple the logic the prediction logic from the API as much as possible