aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2012-12-10 17:34:44 -0800
committerAdam Soltys <[email protected]>2012-12-11 00:06:49 -0800
commit7f19424e402be418d18b77dab06f263ef450a146 (patch)
tree62992fb6d26250dfb8ddd7d1ce097b31f901a883
parent4b5d0c7635cd14dd78fc6ab1ac5d494bd99b41d4 (diff)
downloadcoinos-server-7f19424e402be418d18b77dab06f263ef450a146.tar.gz
coinos-server-7f19424e402be418d18b77dab06f263ef450a146.zip
Minor fixes
-rw-r--r--README.md30
-rw-r--r--app.coffee2
-rw-r--r--public/css/calculator.less2
-rw-r--r--public/js/report.coffee8
-rw-r--r--views/main/about.html14
-rw-r--r--views/main/exchangers.html29
-rw-r--r--views/transactions/index.html2
7 files changed, 56 insertions, 31 deletions
diff --git a/README.md b/README.md
index b2e3b195..cbc592e1 100644
--- a/README.md
+++ b/README.md
@@ -1,27 +1,27 @@
-# Bitcoin Point of Sale
+# Vancouver Bitcoin
-This is a simple utility that a merchant can run on a tablet or phone to convert dollars to bitcoins and receive payments from clients. A setup page allows you to configure the company title, logo, address, exchange rate, and commission.
+This is the source code for http://vanbtc.ca/
-We use the websocket payment notification API from http://blockchain.info/api/api_websocket to listen for and display payment notifications in real time. The bitcoin exchange rates are fetched from http://bitcoincharts.com/.
+The site includes a simple Point-of-Sale utility that merchants can run on a tablet or phone to convert dollars to bitcoins and receive payments from customers. See http://vanbtc.ca/calculator for an example.
-When transactions are detected, they are logged along with the time and current exchange rate, and a report is provided so that merchants can account for how many bitcoins they received in a given time period and see their equivalent dollar value. If desired, merchants can then keep a cash float on hand and instruct cashiers to convert the received bitcoins to dollars on-premise at the time of payment, daily, weekly, monthly or as desired.
+A setup page allows anyone to configure some basic parameters like title, logo, address, exchange, and commission: http://vanbtc.ca/setup
-# Installation
+These parameters can be saved and made available at a convenient URL.
+
+# Technical Details
-The main calculator page `calculator.html` is programmed in HTML5 and should run in any modern browser. The transaction logging and reporting functionality requires a data store. It's currently using PHP to write to flat JSON files but am probably going to switch to NodeJS and MySQL.
+The site is programmed in HTML and Coffeescript using NodeJS and jQuery. Account details and transactions are stored in a Redis database.
-# Demo Instance
+We use the websocket payment notification API from http://blockchain.info/api/api_websocket to listen for and display payment notifications in real time. The bitcoin exchange rates are fetched from http://bitcoincharts.com/ and cached with a 15 minute expiry.
-http://vanbtc.ca/
+When transactions are detected, they're logged along with the current exchange rate. A report is provided so that merchants can account for how many bitcoins they received in a given time period and see their equivalent dollar value. This allows us to insulate merchants from bitcoin market volatility by offering to purchase their bitcoins for exactly what they were worth at the time of sale.
-# Todo
+# Installation
-* Allow calculator configurations to be saved and assigned to an account
-* Short/pretty URLs for pre-saved configurations
-* Security/authentication around transaction logging
-* Verify transaction logs against the blockchain
-* More robust disconnect and error handling
-* Better device detection and browser testing
+ git clone https://github.com/asoltys/vanbtc.ca
+ cd vanbtc.ca
+ npm install
+ coffee app
# License
diff --git a/app.coffee b/app.coffee
index 5ac4b033..add2f017 100644
--- a/app.coffee
+++ b/app.coffee
@@ -46,7 +46,7 @@ for route, view of routes
)(route, view)
authorize = (req, res, next) ->
- if req.params.user? is req.user?.username or
+ if req.params.user is req.user?.username or
req.user?.username is 'admin'
return next()
res.redirect('/login')
diff --git a/public/css/calculator.less b/public/css/calculator.less
index deb385ac..58d1a258 100644
--- a/public/css/calculator.less
+++ b/public/css/calculator.less
@@ -21,7 +21,7 @@ div#calculator {
small, label { color: #999; font-size: 1.2em; }
strong#total { font-size: 2em; }
#title { display: none; }
- #logo { display: none; padding: 10px 0; }
+ #logo { display: none; padding: 10px 0; margin-bottom: 10px; max-height: 150px; }
#error { margin-top: 10px; }
}
diff --git a/public/js/report.coffee b/public/js/report.coffee
index 004f655f..ab5da2b9 100644
--- a/public/js/report.coffee
+++ b/public/js/report.coffee
@@ -17,13 +17,15 @@ $(->
filterDates = ->
transactions = $.grep(g.transactions, (e, i) ->
+ return false unless e
+
from = moment($('#from').val(), "MM/DD/YYYY")
to = moment($('#to').val(), "MM/DD/YYYY")
d = moment(e.date)
amount = parseFloat(e.exchange) * parseFloat(e.received)
- return false unless !isNaN(parseFloat(amount)) && isFinite(amount)
- return (!from? || d.diff(from) >= 0) && (!to? || d.diff(to) <= 0)
+ !isNaN(parseFloat(amount)) && isFinite(amount) &&
+ (!from? || d.diff(from) >= 0) && (!to? || d.diff(to) <= 0)
)
display(transactions)
@@ -36,7 +38,7 @@ display = (transactions) ->
$('tbody').append("""
<tr>
<td colspan='5'>
- No transactions were found during the specified time period
+ No transactions were found for the specified time period
</td>
</tr>
""")
diff --git a/views/main/about.html b/views/main/about.html
index 42155a33..fa8503a0 100644
--- a/views/main/about.html
+++ b/views/main/about.html
@@ -13,7 +13,7 @@
<p>
New addresses start with a zero balance. Transactions between addresses are
recorded in a public file and <a href="http://blockchain.info/unconfirmed-transactions">published on
- the Internet</a>. Copies of the file are distributed over the bitcoin network which keeps track of the balance at every address.
+ the Internet</a>. The file has a record of every transaction that's taken place since Bitcoin started in 2009 and is used to determine the current balance of every address.
</p>
<p>
@@ -25,10 +25,10 @@
<p>
Over time, fewer and fewer
- bitcoins will be created until there are a total of
- 21 million of them in circulation by the year 2040. Each bitcoin
+ bitcoins will be created until finally there are a total of
+ 21 million of them in circulation by the year 2040. Each one of them
is divisible up to 8 decimal places, making
- it possible to transact very small portions of them.
+ it possible to transact very small amounts.
</p>
</div>
<div class="span6">
@@ -68,18 +68,18 @@
<div class="span6">
<h1>Where can I get some?</h1>
<p>
- Contact one of our trusted <a href="/exchangers">exchangers</a>.
+ Contact one of our trusted <a href="/exchangers">exchangers</a>. We'll meet you in person to sell you bitcoins and will be happy to help you get started if you're new.
</p>
<p>
- There are also several bitcoin markets operating online. The largest one in Canada
+ There are several bitcoin markets operating online as well. The largest one in Canada
is <a href="http://cavirtex.com/">cavirtex.com</a> and is run out of Calgary. They link up buyers and sellers and facilitate trades by
allowing you to deposit and withdraw Canadian dollars directly from your bank account. A list of other
online exchanges and their rates can be found at <a href="http://bitcoincharts.com">bitcoincharts.com</a>.
</p>
<p>
- You can also use sites like <a href="http://localbitcoins.com/">Local Bitcoins</a>, <a href="http://bitcoinary.com/">Bitcoinary</a>, and <a href="http://bitcoin-otc.com/">Bitcoin OTC</a> to find people to trade with over the Internet if you want to take your chances with strangers.
+ You can also use sites like <a href="http://localbitcoins.com/">Local Bitcoins</a>, <a href="http://bitcoinary.com/">Bitcoinary</a>, and <a href="http://bitcoin-otc.com/">Bitcoin OTC</a> to find people to trade with directly.
</p>
</div>
diff --git a/views/main/exchangers.html b/views/main/exchangers.html
index 6d62697e..fbe6a77f 100644
--- a/views/main/exchangers.html
+++ b/views/main/exchangers.html
@@ -31,7 +31,16 @@
<td>Hastings/Sunrise</td>
</tr>
<tr>
- <td colspan="2"><a href="https://localbitcoins.com/accounts/profile/asoltys/" class="btn">Contact</a></td>
+ <td class="first"><b>Phone:</b></td>
+ <td>604-358-6745</td>
+ </tr>
+ <tr>
+ <td class="first"><b>Email:</b></td>
+ <td><a href="mailto:[email protected]">[email protected]</a></td>
+ </tr>
+ <tr>
+ <td class="first"><b>LocalBitcoins:</b></td>
+ <td colspan="2"><a href="https://localbitcoins.com/accounts/profile/asoltys/">asoltys</a></td>
</tr>
</table>
</div>
@@ -44,7 +53,16 @@
<td>Fairview</td>
</tr>
<tr>
- <td colspan="2"><a href="https://localbitcoins.com/accounts/profile/stretchwynand/" class="btn">Contact</a></td>
+ <td class="first"><b>Phone:</b></td>
+ <td>604-358-6745</td>
+ </tr>
+ <tr>
+ <td class="first"><b>Email:</b></td>
+ <td><a href="mailto:[email protected]">[email protected]</a></td>
+ </tr>
+ <tr>
+ <td class="first"><b>LocalBitcoins:</b></td>
+ <td colspan="2"><a href="https://localbitcoins.com/accounts/profile/stretchwynand/">stretchwynand</a></td>
</tr>
</table>
</div>
@@ -57,7 +75,12 @@
<td>West End</td>
</tr>
<tr>
- <td colspan="2"><a href="https://localbitcoins.com/accounts/profile/beeteecee/" class="btn">Contact</a></td>
+ <td class="first"><b>Website:</b></td>
+ <td><a href="http://beeteecee.com/" target="_blank">beeteecee.com</a></td>
+ </tr>
+ <tr>
+ <td class="first"><b>LocalBitcoins:</b></td>
+ <td colspan="2"><a href="https://localbitcoins.com/accounts/profile/beeteecee/">beeteecee</a></td>
</tr>
</table>
</div>
diff --git a/views/transactions/index.html b/views/transactions/index.html
index d768da57..adaa2cc2 100644
--- a/views/transactions/index.html
+++ b/views/transactions/index.html
@@ -20,7 +20,7 @@
<tr>
<th>Date</th>
<th>Address</th>
- <th>Exchange Rate</th>
+ <th>Rate</th>
<th>BTC</th>
<th>CAD</th>
</tr>