Git Product home page Git Product logo

bank-account's Introduction

Bank-Account

Purpose

  • Account creation just once.
  • Transaction authorization for the created account.
  • Error handling transforming to violations any violation of expected business rule.

Technologies

  • Kotlin
  • Gradle
  • Docker

Project Organization

  • We decided to use the Package by Feature approach to present the project by the problem that he solves and not by the way that will be provided to the user and organize the packages to have more cohesion and high modularity, and with minimal coupling between packages. If you want to read more about package by feature click here

Dependencies

  • Jackson to transform Json Strings to Objects
  • Mockk to Mock some objects in the tests
  • AssertJ to make more fluent the tests with exception
  • Shadowjar to create the fat jar that will be use in the Dockerfile

Project Setup

  • Docker
    • docker build -t bank-account .
  • Gradle
    • gradle clean build

Project Running

  • Docker

    • docker run --rm --name bank-account -it bank-account
  • Gradle

    • gradle clean test run
  • Send event messages, like:

{"account": {"active-card": true, "available-limit": 100} }
{"transaction": {"merchant": "Burger King", "amount": 20, "time": "2019-02-13T11:00:00.000Z" }}
{"transaction": {"merchant": "Habib's", "amount": 20, "time": "2019-02-13T11:00:00.000Z" }}
  • If you want to process the events just add an empty line like if you are consuming a unix file (EOL Unix).

Main decisions

  • Always need to be just one or none account active at the same time.
  • Creation of some interfaces to make the project easy to be extensible like if the project needs to change the data source (DataConsumer, Reader, OperationEvent, Operation, OperationViolation).
  • We implemented a batch application to read some transactions based in a specific account but if we need to implement a stream reader we can easily add this just creating another implementation for the DataConsumer.
  • To execute the event list process you need to insert a empty line (like EOL Unix file).
  • The transaction events always will be ordered by time.
  • The return of transaction events process will be returned in the order of time.
  • As the execution is sequential we decided for no multi-thread approach but something could be implemented with corroutines or workers.

Overall Coverage Summary

Package Class, % Method, % Line, %
all classes 97.6% (41/ 42) 99% (97/ 98) 94.7% (161/ 170)

Coverage Breakdown

Package Class % Method % Line %
br.com.bank 0% (0/ 1) 0% (0/ 1) 0% (0/ 9)
br.com.bank.infra 100% (2/ 2) 100% (4/ 4) 100% (6/ 6)
br.com.bank.operation 100% (8/ 8) 100% (13/ 13) 100% (27/ 27)
br.com.bank.operation.account 100% (12/ 12) 100% (34/ 34) 100% (59/ 59)
br.com.bank.operation.account.transaction 100% (7/ 7) 100% (17/ 17) 100% (32/ 32)
br.com.bank.operation.consumer 100% (1/ 1) 100% (2/ 2) 100% (2/ 2)
br.com.bank.operation.consumer.stdin 100% (2/ 2) 100% (4/ 4) 100% (8/ 8)
br.com.bank.operation.processor 100% (1/ 1) 100% (2/ 2) 100% (6/ 6)
br.com.bank.operation.validation 100% (1/ 1) 100% (2/ 2) 100% (2/ 2)
br.com.bank.operation.validation.violation 100% (7/ 7) 100% (19/ 19) 100% (19/ 19)
Generated on 2020-03-02 18:28

bank-account's People

Contributors

gadsc avatar

Watchers

 avatar sid 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.