~singpolyma/sgx-jmp

Show rate center during signup

Fetch from bandwidth so we can show it to the user, in case they happen to care.
Merge branch 'new-signup-credit-card-decline'

* new-signup-credit-card-decline:
  Block repeated declines for 24 hours
  Handle credit card decline
Block repeated declines for 24 hours
Handle credit card decline

Show user error on decline and give the chance to pick another card.
Merge branch 'new-signup-add-credit-card'

* new-signup-add-credit-card:
  Happy path for credit card signup
  Panic should work on any value for error
  Allow getting default payment method, not just index
  Object representing the backend SGX to use
  Stop polluting Object namespace with Blather DSL
  Work in the presence of em-synchrony
  Helper to allow ordering phone number from Bandwidth v2
  Helper to get a promise that resolves after N seconds
  Every payment kind will need the plan, so put it at the top
  Use registration pattern for Payment kinds
  Method to bill the plan of a Customer
  Use Forwardable for simple delegations
  Helper to allow using sync-style code in a Promise context
  New signup: go to web to choose credit card
  OOB helper
  Reject promise on stanza error
  Fix typo
Happy path for credit card signup

Assuming credit card payment works, you can now activate a new account by paying
with one.
Panic should work on any value for error
Allow getting default payment method, not just index
Object representing the backend SGX to use

This is what should know about things like the customer id -> jid mapping, etc.
Stop polluting Object namespace with Blather DSL
Work in the presence of em-synchrony

em-synchrony monkeypatches em-http when loaded. The old functionality is still
present, but under different method names.
Helper to allow ordering phone number from Bandwidth v2

Uses their gem which uses Faraday. Set Faraday to em-synchrony so their gem is
now using EventMachine but still sync so their code will work unchanged.  Wrap
all uses of the gem in EM.promise_fiber to get a promise back out of that.

Implement a poll helper that can wait until a new order is complete at Bandwidth
before continuing.  They support an HTTP callback method, but only global on
account? This is much easier to work with in our context.
Helper to get a promise that resolves after N seconds
Every payment kind will need the plan, so put it at the top
Use registration pattern for Payment kinds

Instead of a hard-coded case statement.
Method to bill the plan of a Customer

Bills their balance for the cost of one month of plan.
Activates the plan by insert into plan_log, unless already active in which case
extends current plan by one month.
Use Forwardable for simple delegations
Helper to allow using sync-style code in a Promise context

This helper spins up a fiber and returns an unresolved EMPromise, then runs the
passed-in block inside the fiber and fulfills the promise with the result of the
block. Because nothing is looking for the Fiber to return it is free to act as a
trampoline for EMPromise#sync and other fiber-sync-style code that does not
block the EM reactor.
New signup: go to web to choose credit card

This step, if chosen, directs the user to the jmp-pay webapp to add a credit
card.  It includes an OOB element for use by user agents that can handle
that (possibly for webview embed, etc) with a note-based fallback as per XEP.
Once the user chooses "next" the code checks if they have actually added a card,
and if so continues to a yet-unimplemented step and if not repeats the
instruction to go to the web app.
Next