Centarra/panel2 — pull request #14 by nasonfish (2014-03-23 02:10:06+00:00)
Title: invoice: Use coinbase instead of blockchain for accepting Bitcoins as payment

This will allow us to use the Coinbase API to accept Bitcoins as payment, since blockchain has been said to be slow or unresponsive.

### Issues
- if someone underpays or overpays, they will be presented with an error message: http://i.imgur.com/C1yTIMU.png - which urges them to contact the merchant for a refund. However, their payment is still processed in the invoice and goes through fine. I don't have a way to fix this, I thought the variable_price variable should have removed that message.
- I've left the blockchain api in the code, so if any payments are pending, they are going to be received even if we're not offering blockchain anymore. I don't want to cheat anyone out of their money, so `blockchain.py` and its corresponding import can be deleted in a week or so, or whenever you feel appropriate.
- We sort of stack modals on top of each other when they are accessing the Bitcoin Payment button, I don't really have a fix for this or if it's really an issue.

### Setting up

- The variables in the configuration file `COINBASE_SECRET` and `COINBASE_API_KEY` need to be set with information from Coinbase.
- I would suggest some sort of script to remove all current `btc_adr` from `Invoice`s to make sure we don't still offer blockchain addresses for old invoices. Something like:
```python
for i in Invoice.query.filter(Invoice.payment_ts is not None).all():
i.btc_adr = None
db.session.add(i)
db.session.commit()
```
This should allow the `btc_adr`s to be recreated when the pages are loaded again.