~singpolyma/sgx-jmp

Break out CustomerPlan

We had Plan and Customer but the relationship between the two lived
entirely in Customer, which was growing quite large. Break that
relationship out into its own concept and give it a name.
Inject BackendSgx per customer

Instead of being a singleton that represents the entire relationship
with the backend, the object is now per-customer (since any meaningful
method requires a customer anyway for the from JID at least) and can be
delegated to directly from Customer.
Merge branch 'invites'

* invites:
  Block repeated invite code tries by customer id
  Allow user to activate using invite code
Block repeated invite code tries by customer id

So it's not as trivial to brute-force the space and find an open one. Limit is
10 tries per hour.
Allow user to activate using invite code

Checks if the code is available and marks it used, then activates. Tracks who
invited and who used in the table for later reward or punishment.
Fix for credit card flow
Merge branch 'set-forwarding-on-finish'

* set-forwarding-on-finish:
  Configure number for inbound calls
Fixed code to expect 201 but forgot to update tests
Merge branch 'import-to-catapult'

* import-to-catapult:
  Import newly-purchased numbers to Catapult
Merge branch 'show-ratecenter-during-signup'

* show-ratecenter-during-signup:
  Show rate center during signup
Merge branch 'activated-users-to-finish'

* activated-users-to-finish:
  Test that registered users get the Registered step
  Already activated user goes straight to finish
Show rate center during signup

Fetch from bandwidth so we can show it to the user, in case they happen to care.
Test that registered users get the Registered step
Already activated user goes straight to finish

If not registered, but activated, they must have paid but failed to get their
number setup. Maybe the number was already taken. Maybe they paid manually. In
any case we can skip all intervening steps and go straight to buying and
configuring their number for them.
Import newly-purchased numbers to Catapult

Since we still use Catapult ("v1") for voice application, we need to import all
numbers there and set their applicationId to match.
Configure number for inbound calls

Adds the settings to redis that jmp-fwdcalls will use to route inbound calls.
Not done by the sgx registration even though fwdcalls is currently a plug-over,
and of course won't be once fwdcalls dies so do it here.
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
Next