Giter Club home page Giter Club logo

paymentengine's Introduction

Run program

python3 payment_engine.py tests/fixtures/sample3.csv > client_accounts.csv

Run tests

python3 -m unittest discover

Notes

The development effort commenced with creating a fixture for sample input and a unit test on the main processing function, capturing the output and comparing it against what was expected.

Unit testing has primarily focussed on the process_record function which is doing most of the work.

End to end testing is included which has the program read fixture sample files and check the output

Custom field ordering has been allowed for the input by having the program scan the fields of the header row. This is a simple best-effort and if there were redundant fields with the expected names I believe it would just decide to use the column it saw last for a given field. Without specifying fields in the header it will assume the order as defined in the assignment spec.

Because the assumption was made that we must not allow processing of duplicated transaction ids, we must track all transaction ids in memory. This is a hard limit on the program right now. An idea to improve the efficiency, if we could relax needing to check for duplicate transaction ids is to process the input in two passes instead of the current single pass implementation. The first pass would only look for disputes/resolves/chargebacks and make a note of each tx that will need those applied. Then a rescan of the input file could skip needing to keep track of any transaction ids that arent being disputed/resolved/chargedback.

Additionally, the implementation of a state machine for the transactions themselves should be able to streamline the flag checking code that happens in each type of operation. We logically can only progress deposit->dispute->resolve/chargeback. An implementation of this was not settled on.

Client accounts can end up locked after a chargeback. In the absence of requirements for specific behavior to take with regards to accounts which have become locked, we will continue processing transactions discovered for a given client even after that client has become locked.

Any non fatal errors encountered while processing will be logged to stderr.

paymentengine's People

Contributors

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