Code Monkey home page Code Monkey logo

filesdotcomtest's Introduction

FilesDotComTest

Write a WebAPI with only 1 method called “ProcessPayment” that receives a request like this

  • CreditCardNumber (mandatory, string, it should be a valid CCN)
  • CardHolder: (mandatory, string)
  • ExpirationDate (mandatory, DateTime, it cannot be in the past)
  • SecurityCode (optional, string, 3 digits)
  • Amount (mandatoy decimal, positive amount) Write a Payment domain/entity with the same properties as the request and a second entity to store the payment state (pending, processed, failed). Use Entity framework code first approach, write entity configurations and generate the migrations. 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 request should be validated before processed. The payment could be processed using different payment providers (external services) called:
  • IExpensivePaymentGateway or
  • ICheapPaymentGateway. 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 ICheapPaymentGateway. b) If the amount to be paid is £21-500, use IExpensivePaymentGateway if available. Otherwise, retry only once with ICheapPaymentGateway. c) If the amount is > £500, try only PremiumPaymentService and retry up to 3 times in case payment does not get processed d) Store/update the payment and payment state entities created previously once the processing is completed. Bonus:
  • Use repository/unit of work patterns
  • Use eager loading for all entities Recommendations :
  • The classes should be written in such a way that they are easy to test.
  • Write enough unit tests to cover the developed code (at least 1).
  • Use SOLID principles.
  • Use any IOC you think is best.
  • Use Entity Framework. Optional:
  • Use AutoMapper or other mapping tools of your choice
  • Use .Net Core to develop the WebAPI and Entity Framework Core.

filesdotcomtest's People

Contributors

temitopeoniyide avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.