Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a Flask Web API with only 1 method called ProcessPayment that receives a request like this - CreditCardNumber (mandatory, string, it should be a

Write a Flask Web API with only 1 method called ProcessPayment that receives a request like this - CreditCardNumber (mandatory, string, it should be a valid credit card number) - CardHolder: (mandatory, string) - ExpirationDate (mandatory, DateTime, it cannot be in the past) - SecurityCode (optional, string, 3 digits) - Amount (mandatoy decimal, positive amount) The response of this method should be 1 of the followings based on - Payment is processed: 200 OK - The request is invalid: 400 bad request - Any error: 500 internal server error 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.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Flash XML Applications Use AS2 And AS3 To Create Photo Galleries Menus And Databases

Authors: Joachim Schnier

1st Edition

0240809173, 978-0240809175

More Books

Students also viewed these Databases questions

Question

What are the Five Phases of SDLC? Explain each briefly.

Answered: 1 week ago

Question

How can Change Control Procedures manage Project Creep?

Answered: 1 week ago