BillProcess

February 8, 2018 ยท View on GitHub

BillProcess is a full-stack app that lets different internal stakeholders efficiently process monthly customer bills. It is built with Ruby on Rails, PostgreSQL, and React/Redux.

Live demo found here! http://billprocess.herokuapp.com/

Alternatively, to run this app locally:

  • git clone https://github.com/anastassia-b/bill-process.git
  • bundle install
  • npm install
  • rails db:setup
  • rails s
  • Visit localhost:3000/#/welcome in your browser!

Features

  • Complete user authentication with BCrypt gem.
  • Multiple Account types (Finance, Customer Success, Sales) allow for specialized permissions and views.
    • Finance users can generate bills and sent them to customers.
    • CustomerSuccess and Sales can approve and reject bills.
  • Bill tracks the history of actions on it, allowing for documentation and reversibility.

Database Schema

Users (stakeholders)

column namedata typedetails
idintegernot null, primary key
namestringnot null, indexed, unique
emailstring
rolestringnot null
password_digeststringnot null
session_tokenstringnot null, indexed, unique

Implemented Roles: "Finance", "Customer Success", "Sales"

Customers

column namedata typedetails
idintegernot null, primary key
csm_idintegerforeign key (references users), indexed
namestring
billing_addressstring
billing_emailstring
monthly_api_limitinteger
overage_unit_costfloat
start_datedate
end_datedate
require_csm_approvalboolean

Usage

column namedata typedetails
idintegernot null, primary key
customer_idintegernot null, foreign key (references customers), indexed
monthinteger
yearinteger
api_usageinteger

Bill

column namedata typedetails
idintegernot null, primary key
customer_idintegernot null, foreign key (references customers), indexed
monthinteger
yearinteger
overage_unitsinteger
overage_unit_costinteger
overage_amountinteger
statusstring
created_atdatetime
updated_atdatetime

A bill's overage_unit cost by default will be a customer's overage_unit_cost, but could be altered for flexibility. Therefore, overage_unit_cost is stored in two models.

Bill Actions

column namedata typedetails
idintegernot null, primary key
bill_idintegernot null, foreign key (references bills), indexed
stakeholder_idintegernot null, foreign key (references users), indexed
actionstring
commentstring
created_atdatetimenot null
updated_atdatetimenot null

Routes

HTML API

  • GET / - loads React web app

JSON API

User

  • GET /api/users/:userId
  • POST /api/users

Session

  • POST /api/session
  • DELETE /api/session

Customer

  • GET /api/customers
  • GET /api/customers/:customerId

Usage

  • GET /api/usage (Pass customerId, etc as parameters. Not using this route on frontend currently.)

Bill

  • GET /api/bills
  • GET /api/bills/:billId
  • POST /api/bills/
  • PATCH /api/bills/:id/approve
  • PATCH /api/bills/:id/reject

Creating or updating a bill create BillActions which log the activity.

Frontend Routes

  • /welcome - Login and Signup Page
  • /dashboard - Main Dashboard with Overage Bill Index
  • /bills/:id - Bill Show Page
  • /customers - Customer Index
  • /customers/:id - Customer Show Page with Usage

Future Implementation

  • Error handling tied to thunk actions
  • Testing

Note: Currently an assumption is that either Sales or CustomerSuccess can approve a bill. Future implementation will ensure that a bill passes through a 2-step approval system if it needs to.

Screenshots

welcome