Giter Club home page Giter Club logo

fam-api's Introduction

Launcher Backend

Capital One {FAM} Hackathon backend (see front end here).

Setup

To create and start a postgres docker container:

$ docker run --name launcherdb -p 5432:5432 -e POSTGRES_USER=postgres -d postgres

To install dependencies, build and run the docker container:

$ glide install
$ docker build -t fam-api .
$ docker run -p 4000:6000 fam-api

If changes have been made to the API, you may need to run glide install if the dependencies have changed, and you will need to build and run the container again.

If the containers have been stopped by the repo has not been updated, docker start <container name or id> for both postgres and fam-api as necessary.

API will run on localhost:4000

API

/launchers/{id}

Retrieves a Launcher credit card account.

Accepts an id in the url and returns:

{
    "id": 1,
    "first_name": "Pepillo",
    "last_name": "Bulcroft",
    "interest_rate": 12.093205759592392,
    "credit_limit": 1000,
    "balance": 502.53080000000045,
    "due_date": "2017-11-05T03:03:18.788217Z",
    "minimum_payment": 50.7595140304111
}

/launchers/{id}/transactions

Retrieves transactions for a Launcher credit card.

Accepts an id in the url and returns:

[
  {
      "transaction_id": 100120001,
      "type": "charge",
      "merchant_name": "chatbooks",
      "amount": 1.3634,
      "date": "2017-10-08T00:00:00Z"
  },
  {
      "transaction_id": 100120002,
      "type": "charge",
      "merchant_name": "google *fantasy legend",
      "amount": 0.8755,
      "date": "2017-10-15T00:00:00Z"
  }
]

launchers/{id}/payoff

Calculates the payoff of a balance.

Accepts the following body; either total number of months or monthly payment may be provided:

{
	"balance": 100,
	"interest_rate": 10,
	"total_months": 2
}

{
	"balance": 100,
	"interest_rate": 10,
	"monthly_payment": 50.00
}

Returns:

{
    "balance": 100,
    "interest_rate": 12.093205759592392,
    "total_months": 23,
    "monthly_payment": 5,
    "total_interest_cost": 23.178644372552082,
    "graph": [
        {
            "principal": 3.992232853367301,
            "interest": 1.0077671466326992,
            "balance": 96.0077671466327,
            "month": 1
        },
        {
            "principal": 4.032465264480614,
            "interest": 0.9675347355193864,
            "balance": 91.97530188215208,
            "month": 2
        }
    ]
}

fam-api's People

Contributors

frankienicoletti avatar

Watchers

James Cloos avatar Luis avatar E. David Aja 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.