Skip to content

Instantly share code, notes, and snippets.

@FermiDirak
Created April 2, 2018 16:52
Show Gist options
  • Save FermiDirak/e40129b9dd24e3fec8164ddd1363e6f1 to your computer and use it in GitHub Desktop.
Save FermiDirak/e40129b9dd24e3fec8164ddd1363e6f1 to your computer and use it in GitHub Desktop.
Cash Register API
database:
Items Table:
* id INT (index)
* price MONEY
* name STRING (natural language index)
* SKU INT
* PPU MONEY
* Taxable BOOL
Transactions Table:
* id INT (index)
* timestamp TIME
* open BOOL
TransactionItemsJunction Table:
* id INT
* transactionId INT (index)
* itemId INT
/setUp: Allows a cashier to initialize register with price list
/initialize @money @salesTax
Allows the cashier to initialize register with given money amount and sales tax amount
/balance Gets the amount of balance in the register
/transact Creates a new transaction
/transactionAddItem @transactionId @itemId Adds item id to the current transaction
/viewTransaction @transactionId Views the transactions from id as well as subtotal
/closeTransaction @transactionId @money
Amount of money recieved by customer. Change is calculated for the user
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment