shailendra-prajapati / filed-flask-test Goto Github PK
View Code? Open in Web Editor NEWA Flask Web API with method called “Process Payment” that receives a request like this - Credit Card Number (mandatory, string) - Card Holder: (mandatory, string) - Expiration Date (mandatory, DateTime) - Security Code - Amount (mandatoy) The responses are the following - Payment is processed: 200 OK - The request is invalid: 400 bad request - Any error: 500 internal server error. The payment is processed using different payment providers called: - PremiumPaymentGateway - ExpensivePaymentGateway - CheapPaymentGateway. The payment gateway that is 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.