~singpolyma/jmp-pay

Send notifications using Cheogram whispers

This way they don't need an assigned tel to work.
Include BTC amount and currency in notification
Don't send malformed to JID when customer has no tel yet
Ping healthchecks for each run
Activate pending plan for customer when they pay enough BTC

This is effectively the "BTC auto-accept" new way.  If they send enough to
activate (as set by activation_amount in config) and they have a pending plan in
redis and no plan in the db, then we buy them that plan.

We can't use the normal way to notify the user, because they likely haven't
bought a phone number yet.  Eventually we will be able to tell new-signup about
this and have it inserted into the flow there, I think? Not sure what we want to
do transitionally.
Add bonus whenever a larger BTC deposit comes in
Notify customer on sucessful BTC deposit

Since BTC transactions can take some time, let the user know when it is done and
how much credit they got for their money.
Notify customer when renewal fails due to low balance

This is done by sending from a configured JID to <tel>@cheogram.com in order to
have them receive a message from support.
Create initial monthly billing cronjob

Renews all expired plans where there is enough balance to do so.

Sets expires_at on all renewed plans to one month from today, so even if they
were very expired they are up to date the moment they pay.
Cronjob to check pending BTC transactions

When they become confirmed, insert them into the transactions table.
We can never double-insert because of the PRIMARY KEY on transaction_id, so the
script is always safe to run even if something ends up in redis twice.
Endpoint that pushes all unknown transactions into Redis

The intent is to use `electrum notify <address> <app>/electrum_noify?address=&customer_id=`

The app asks electrum for all transactions on that address, and then checks
which ones we *don't* already have recorded in the transactions table.  These
are pushed into Redis to be picked up by a to-be-written job that will write
them to the transactions table after 3 confirmations.
Save bidirectional association for customer_id in redis
Hide loading spinner on error so the error state can show
In production, require customer_id be passed also.

As a security measure, so people can't modify the cards on arbitrary JIDs.
Add magic comment
Going to use this as a customer id for the whole billing system

So it's not really braintree specific, even if we make it match the one there.