Giter Site home page Giter Site logo

paymentsystem's Introduction

PaymentSystem

Used Technologies

  • Grape For fast and well designed API
  • Swagger for interactive API documentation
  • Grape::Entity for api presenters
  • Ruby (2.5.8)
  • RSpec For Unit & API Tests
  • Capybara For UI tests
  • Best CSV tool ever - SmarterCSV
  • Custom ideally horizontal scaling API authentication based on JWT JWT
  • Pry For Easy Debugging And Code Inspecting
  • Sidekiq for background jobs, sidekiq-scheduler for scheduling
  • Draper for views wrappers
  • Rails 5.2.4.3 - this version was released at May 18, 2020, Rails 6 was incopable with some technologies that are using here
  • Devise for simple UI authentication
  • state_machine for different transaction types statuses
  • Bootstrap

Patterns & Rails Enhancements

  • Service Objects - based on Command (for authentication) & Strategy for user input processing
  • Convention Over Configuration principle used for complex user params processing at API
  • Form Objects - used together with service objects - they encapsulates validation logic to make new Transactions approved, or move them to error state (Context pattern with service strategy)
  • Special State Machine for each transaction type - for more flexibility
  • Presenters - including special presenter for form result
  • Wrappers (Draper's decorators)
  • MySQL Enum instead of rails enum
  • Foreign Keys for dependent tables
  • STI for Transactions
  • CSV import works using also Service Objects & Form Objects
  • Optimistic locks for merchants & transactions to prevent double changes

What It Does

  • System support 4 different types of transactions
  • Transactions can be dependent to each other
  • Transactions should be created and moved to status 'error' when they are partially invalid, so we cannot use plain rails validations practice, and should have validations at forms & models
  • Merchants can moved to inactive status - so system will not create new transactions for such merchants
  • To remove merchant - merchant should have 0 transactions, that can be done after removing transactions by schedule
  • User will be able to upload csv with different fields in different order, but some of them are required
  • Removing Job runs by schedule every hour, and remove all transactions that related to authorize transactions that were created more than one hour ago, this is needed to have referential integrity
  • System has different UI's for admins and merchants
  • System has seeds for basic data

Code Analysis

  • Tests Coverage 98% by SimpleCov, including browser tests, api tests, and unit tests for services
  • Code Inspected by RuboCop, no offenses detected
  • Code Inspected for security vulnerabilities by Brakeman, no warnings found

Requirements

  • Ruby = 2.5.8
  • MySQL
  • Redis

Setup

  • Go to project's folder in your terminal
  • set PaymentSystem_DATABASE_PASSWORD
  • Run bundle
  • Run rake db:setup

Run API

  • Start server rails s
  • Start background job bundle exec sidekiq
  • Go to http://localhost:3000/

API Documentation

  • Start server rails s
  • Go to http://localhost:3000/documentation

Background Processes Monitoring

  • Start server rails s
  • Go to http://localhost:3000/sidekiq

Seeds

  • rake db:seed

Running tests

  • rspec spec/

Tests Coverage Report

  • Not At .gitignore for easy review
  • Open In Browser coverage/index.html

Code Quality report

  • Run rubocop

paymentsystem's People

Contributors

edikgat avatar

Watchers

 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.