Code Monkey home page Code Monkey logo

smartpay's Introduction

Incomplete Tasks

  • api provides several statuses with the intention of returning specific http responses, the http responses need to be implemented
  • Unit testing of api was lighter than I would have liked
  • Took a few shortcuts with microhttpd which I suspect might have some memory repercussions, but I'm not sure
  • The parser is very rigid, it would be nice to use a library like json-c instead
  • Ideally, the store module would be a dynamically allocated linked-list
  • Add DELETE support - there is some consideration in store for this, but it's primitive
  • Add PUT for update support

API

Querying Terminals - IMPLEMENTED

Query a terminal

GET /terminals/1
{
  "id": 1,
  "cardType": [ "Visa", "EFTPOS" ],
  "TransactionType": [ "Cheque", "Savings" ]
}

Query all terminals

GET /terminals
{
  "terminals":
  [
    {
      "id": 0,
      "cardType": [ "Visa", "MasterCard", "EFTPOS" ],
      "TransactionType": [ "Cheque", "Savings", "Credit" ]
    },
    {
      "id": 1,
      "cardType": [ "Visa", "EFTPOS" ],
      "TransactionType": [ "Cheque", "Savings" ]
    },
    //...
  ]
}

Adding a Terminal - IMPLEMENTED

To Add a terminal

POST /terminals '{"cardType": ["visa", "MasterCard"], "TransactionType": ["Cheque"]}'

The result will be the terminal id:

0

Interacting with CURL

curl -X GET -H "Accept: application/json" localhost:11337/terminals
curl -X POST -H "Accept: application/json" --data '{"cardType": ["visa", "MasterCard"], "TransactionType": ["Cheque"]}' localhost:11337/terminals

Dependencies

Cmake

https://cmake.org/install/

Libmicrohttpd

On Mac:

brew install libmicrohttpd

On Ubuntu:

sudo apt install libmicrohttpd

On Windows: ???

Build

From Command Line

mkdir build
cd build
cmake ..
cmake --build .

VSCode

Install the CMake Tools extension and use the little blue bar at the bottom of the window ;)

Acceptance Testing

Acceptance tests are run as a bash script. In one terminal execute the program:

./build/App

In another terminal, execute the tests:

./acceptance/acceptance.sh

Unit Tests

Unit tests can be run after a build:

./build/test/tests/Test

smartpay's People

Contributors

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