Code Monkey home page Code Monkey logo

checkoutpaymentgateway's Introduction

CheckoutPaymentGateway

This repository contains two solutions:

  • DummyBankApi: A bank simulator
  • PaymentGateway: a gateway that allows a merchant to:
    • To process a payment through your payment gateway.
    • To retrieve details of a previously made payment.

How to run the solution:

  • Open the PaymentGateway solution in visual studio as Admin (to be able to write in the sqlite db) and set PaymentGateway.API and starting project.
  • Open VS CLI and select PaymentGateway.Infrastructure Project in the dropdown and run this command to create your DB:

    update-database

update database

  • Open the DummyBankApi solution in visual studio and run it ( select DummyBankApi and not IISExpress)

Dummy bank

  • Run the PaymentGatewayApi project ( select PaymentGatewayApi and not IISExpress)

PaymentGateway

Use the Swagger UI interface to make api calls.

Assumptions made:

  • Just for this POC and to test it locally, the solution supports only two currencoes: EUR and USD and the Bank simulator will return failed response when currency is not EUR.
  • I return status code 402 for failed Transaction/payment.
  • The Bank Service can be unreachable/unavailable, that's why i create an entry of the transaction in our db in status processing before making the bankService call.

Areas of improvements

  • Use Polly to handle retry policies when contacting the external Bank service.
  • Use MediatR to create request/handler or (publish/subscribe) Instead of directly calling the bank service, create a an bankProcessingRequest and handle it elsewhere. That way we can add/change handler without touching our PaymentFacade.
  • Add reason code to response to explain why the transaction failed.
  • Encrypt the credit card data stored on our DB
  • Map the expiryDate field to a two field month and year in our DB
  • Test the validation of requests
  • Add Api tests/ performance tests.
  • Better logging

Cloud Technoligies to use:

  • Use RabbitMq/ServiceBus to handle interaction between paymentGateway and bank api
  • Use Azure KeyVolt to store sensitive information like creditcard details
  • Use CosmosDB to store transaction status/id.
  • Use azure devops CI/CD and Azure App Service to build/deploy and host the App

checkoutpaymentgateway's People

Contributors

afatnassi avatar

Watchers

James Cloos avatar  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.