(core) link AppSumo activations with stripe, and support upgrades/downgrades

Summary:
This links AppSumo sign-ups with Stripe subscriptions
and our billing pages. Different AppSumo tiers are supported by
different coupons on the standard plan. Configuration of this
is in stripe, and then cached in the database.

The front end is tweaked just enough to make completing a sign-up
possible. It is not yet friendly.

Not covered includes:
 * Streamlining landing page.
 * Making billing pages git clearer summaries of AppSumo states.
 * Making flow through Cognito as graceful as possible - default
   probably doesn't meet AppSumo requirements.
 * Disabling site on cancellation/refund.
 * Downgrades when more seats in use than lower tier allows.

Test Plan: api-level tests added. No front-end tests yet.

Reviewers: dsagal

Reviewed By: dsagal

Differential Revision: https://phab.getgrist.com/D2878
This commit is contained in:
Paul Fitzpatrick
2021-06-24 09:25:36 -04:00
parent 6240fd6982
commit 1af99e9567
4 changed files with 24 additions and 7 deletions

View File

@@ -1673,7 +1673,8 @@ export class HomeDBManager extends EventEmitter {
// Pick out properties that are allowed to be changed, to prevent accidental updating
// of other information.
const updated = pick(billingAccountCopy, 'inGoodStanding', 'status', 'stripeCustomerId',
'stripeSubscriptionId', 'stripePlanId', 'product');
'stripeSubscriptionId', 'stripePlanId', 'product', 'externalId',
'externalOptions');
billingAccount.paid = undefined; // workaround for a typeorm bug fixed upstream in
// https://github.com/typeorm/typeorm/pull/4035
await transaction.save(Object.assign(billingAccount, updated));