~singpolyma/sgx-jmp

ref: 045da39f25b74034e7bba44cb5f1db48a935ba84 sgx-jmp/.rubocop.yml -rw-r--r-- 1.3 KiB
The sugar version prevents the promise from being returned
Customer Info

This should allow us, the admins, to query information about a customer
without having to dive in and run a couple redis queries and some
database queries before getting the full picture of who we're talking
to.

It also allows the users to request some data about themselves. Balance and
phone number are already visible in other places, but their expiry is currently
not, and people have been asking about it.
Merge branch 'command-object'

* command-object:
  ErrorToSend => FinalStanza
  Since Command#finish causes an error, a then off the end won't work
  Refactor commands to have Command and Command::Execution objects
Refactor commands to have Command and Command::Execution objects

Brings the common elements of all commands together, and threads the most useful
state (such as ability to reply) through automatically using the new EMPromise
fiber trampoline.
Merge branch 'count-outbound-messages'

* count-outbound-messages:
  Store customer outbound messages/day for 1 year in redis
Store customer outbound messages/day for 1 year in redis

Storage is a sorted set, with dates as the values and message counts as the
scores.  Use zincrby to increment the message count by 1 on each new message.
Use zremrangebylex to remove all items older than 1 year so the set does not
grow unboundedly.

Dates with known message counts can be found using zrangebylex. Scores can be
had one at a time with zscore.  In redis 6.2+ zrange bylex withscores or zmscore
may also be used, but that is only in Debian experimental at time of writing.
Merge branch 'pass-messages'

* pass-messages:
  Pass messages to and from the SGX
Pass messages to and from the SGX

Rewriting the from/to as appropriate.
Merge branch 'set-forwarding-on-finish'

* set-forwarding-on-finish:
  Configure number for inbound calls
Merge branch 'import-to-catapult'

* import-to-catapult:
  Import newly-purchased numbers to Catapult
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-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
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.
Merge branch 'register-command-first-pass'

* register-command-first-pass:
  Add sourcehut CI
  Add Rakefile to run all tests
  Initial registration flow for Bitcoin
  Registrations that start on the web will have a tel selected already
  Helpers for doing Electrum RPC
  Add helper to fetch current BTC sell prices
  Allow skipping tests without being caught in pry
Initial registration flow for Bitcoin

This is the Bitcoin "happy path" where there is already a tel and a customer_id.
Gets all the way to generating a BTC address for payment and quoting an amount.
Stubs out flows for credit card and activation code as well, but does not
implement those flows.

TBD: after bitcoin payment comes in and jmp-pay activates the account, we should
come back here to actually buy the number, select a new one if no longer
available, etc.
Split logic out into testable objects

Rubocop clean. Good test coverage of helper objects.
Write initial buy credit command
Initial commit

Supports registering with backend SGX via basic iq:register.

Does not support data forms version with nice labels.

Does not verify billing or anything else yet, just unconditionally registers the user.