Giter Site home page Giter Site logo

checkout's Introduction

Checkout PaymentGateway Assessment

Project Information

This assessment contains 2 main parts:

  • Payment Gateway System Allow Merchants to create payments, submit payments and get payments list.
  • Mocked Bank Payment Processor The moked Bank Payment Processor is simulating credit card payment to the bank.

Future Improvments

  • There is no cache mechanism for GetPayments & PaymentDetails methods. It would be nice to have MemoryCache, Distributed Cache etc.
  • Repositories & Services could be separated (read/write repo and service) so that these are also connected to different Databases. For instance, queries could read from Db like nosql, and we can keep Sql to write our data.
  • A queue or background processing jobs for future-payment api method to trigger payment for non-realtime use could be useful.
  • Constants could be used instead of hard coded error messages.

Installation

Project and database have been developed with Entity Framework Code first approach, therefore, once you run the project, it will automatically create the Database & test api users.

Install project via Docker :

If you prefer to run project from Linux container on Docker, run this code on the root directory folder of docker-compose file :

docker-compose up

Sql instance will be up from port number : 1433

Api port number : 5001 (localhost:5001/api)

Install project via Visual Studio IIS Express :

If you prefer to run the project via Visual Studio without any Docker containers :

First, you should set your Sql connection string in Checkout.PaymentGateway.Api project appsettings.json :

  "ConnectionStrings": {
    "DefaultConnection": "Server=ms-sql-server, 1433;Initial Catalog=CheckoutPaymentGatewayDB;User ID=SA;Password=SqlPassword2021;"
  },

API Structure :

Untitled Diagram

To improve readbility Swagger UI has been integrated to project. All request could have been done through Swagger UI ( api/index.html )

Important Notes : It's not possible to reach any api methods without authorization

To be authorized ;

  • First you should make a request to the /api/authentication endpoint with your merchantID and apiKey.
  • If your merchantID and apiKey are correct, api will return an encyrpted "secret" key.
  • For all other api calls you should put this "Secret" key on the "Authorization" header.

Test Users :

{
  "merchantID" = "HB123H7123G712",
  "apiKey" = "314179fa-7de9-4c9d-8d52-fb6f62ab3815",
},
{
  "merchantID": "HB123H7123G712",
  "apiKey": "14ec3398-45aa-4149-82c7-d9c6fa594bcf"
},
{
  "merchantID": "K12312N21M123",
  "apiKey": "b93b78f9-fb2f-4a00-9c55-95bb4ae2fc6a"
},
{
  "merchantID": "1231MN11H2781",
  "apiKey": "352015a8-7553-40d1-8870-8f382a1256ae"
},

Project Architecture :

Project_Diagram

Technologies

  • .NET Core 3.1
  • Entity Framework Core
  • Mssql
  • XUnit
  • Docker

Libraries

EntityFrameworkCore: It has been used as ORM framework.

Documentation: https://docs.microsoft.com/en-us/ef/core/

MediatR: It has been used for reduce dependencies between objects.

Documentation: https://github.com/jbogard/MediatR/wiki

System.IdentityModel.Tokens.Jwt(JWT): It has been used for authentication.

Documentation: https://docs.microsoft.com/en-us/dotnet/api/system.identitymodel.tokens.jwt

FluentValidation: It has been used for validation of commands and queries.

Documentation: https://github.com/FluentValidation/FluentValidation

AutoMapper: It has been used for object-to-object mapping from entity to Dto or ViewModels.

Documentation: https://docs.automapper.org/en/stable/

Newtonsoft: It has been used for json convert from enum.

Documentation: https://www.newtonsoft.com/json/help/html/Introduction.htm

Swagger: It has been used for api documentation and structure.

Documentation: https://swagger.io/docs/

FluentValidation: It has been used for improve testing readability.

Documentation: https://fluentassertions.com/introduction**

xUnit: It has been used for unit tests.

Documentation: https://xunit.net/docs/getting-started/netcore/cmdline**

EntityFrameworkCore.InMemory: It has been used to create mock database.

Documentation: https://docs.microsoft.com/en-us/ef/core/providers/in-memory

Moq: It has been used to create mock objects.

Documentation: https://documentation.help/Moq/

checkout's People

Contributors

servetadil 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.