upgrades: factor out Stripe integration.

Factor out the Stripe code from the UserUpgrade class. Introduce a new
PaymentTransaction abstract class that represents a payment with some
payment processor, and a PaymentTransaction::Stripe class that
implements transactions with Stripe.

Note that we can't completely eliminate Stripe even though we no longer
accept payments with it because we still need to be able to look up old
payments in Stripe.
This commit is contained in:
evazion
2022-05-06 22:26:52 -05:00
parent 0d4c8baed8
commit 449fd6c49c
9 changed files with 293 additions and 214 deletions

View File

@@ -8,7 +8,7 @@ class WebhooksController < ApplicationController
def receive
case params[:source]
when "stripe"
UserUpgrade.receive_webhook(request)
PaymentTransaction::Stripe.receive_webhook(request)
head 200
when "discord"
json = DiscordSlashCommand.receive_webhook(request)