~singpolyma/sgx-jmp

Eliminate a registration race condition

Check whether we've actually deleted anything before proceeding with
registration; if we have not deleted anything, it means another customer
has registered that number before this one could.

Signed-off-by: Amolith <amolith@secluded.site>
Update schema for new local inventory feature
"Order" numbers from local inventory

- Add methods necessary for actually assigning numbers to customers and
  deleting those numbers from the local database
- Add accompanying test

Signed-off-by: Amolith <amolith@secluded.site>
Only assign num from local inv if available

Add available_after constraint to all local inventory search queries and
update tests to match

Signed-off-by: Amolith <amolith@secluded.site>
Reserve number in appropriate backend

- At the start of registration, numbers are now reserved in
  Bandwidth or "reserved" in the local inventory, whichever source the
  number is from
- Tests mock successful reservation rather than half of a reservation

Signed-off-by: Amolith <amolith@secluded.site>
TelSelections returns object instead of string

Two new objects, TelSelection::ChooseTel::Tn::Bandwidth and
Tn::LocalInventory and TelSelections now returns and persists through
pending state the correct variant.

No new functionality at this time, but formatted_number is now used when
displaying the number to the user at registration.

Signed-off-by: Amolith <amolith@secluded.site>
Fetch numbers from local inventory

References: https://soprani.ca/todo/323
Signed-off-by: Amolith <amolith@secluded.site>
Add SQL queries to find numbers from local db

References: https://soprani.ca/todo/323
Signed-off-by: Amolith <amolith@secluded.site>
Toll Free Leads to Infinity

If rate is zero, then minutes remaining becomes infinite.
That's hard to express in json...

So instead I just leave the limits out, which downstream can interpret
as "unlimited".
Log when we warn for annual fee
Warn a max of once per day
Remove duplicate hardcoded fees
Need access to braintree in sim job
Setup logger and use it
Add $0 transaction when activating via Google Play
Also guard fetching the code itself
Limit creation of new subaccounts by trust level
When two plan logs overlap current window

Extend the later one
Next