forked from zulip/zulip
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
billing: Do subscription management in-house instead of with Stripe B…
…illing. This is a major rewrite of the billing system. It moves subscription information off of stripe Subscriptions and into a local CustomerPlan table. To keep this manageable, it leaves several things unimplemented (downgrading, etc), and a variety of other TODOs in the code. There are also some known regressions, e.g. error-handling on /upgrade is broken.
- Loading branch information
Showing
107 changed files
with
3,069 additions
and
4,685 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
# -*- coding: utf-8 -*- | ||
# Generated by Django 1.11.16 on 2018-12-22 21:05 | ||
from __future__ import unicode_literals | ||
|
||
from django.db import migrations, models | ||
import django.db.models.deletion | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('corporate', '0002_customer_default_discount'), | ||
] | ||
|
||
operations = [ | ||
migrations.CreateModel( | ||
name='CustomerPlan', | ||
fields=[ | ||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), | ||
('licenses', models.IntegerField()), | ||
('automanage_licenses', models.BooleanField(default=False)), | ||
('charge_automatically', models.BooleanField(default=False)), | ||
('price_per_license', models.IntegerField(null=True)), | ||
('fixed_price', models.IntegerField(null=True)), | ||
('discount', models.DecimalField(decimal_places=4, max_digits=6, null=True)), | ||
('billing_cycle_anchor', models.DateTimeField()), | ||
('billing_schedule', models.SmallIntegerField()), | ||
('billed_through', models.DateTimeField()), | ||
('next_billing_date', models.DateTimeField(db_index=True)), | ||
('tier', models.SmallIntegerField()), | ||
('status', models.SmallIntegerField(default=1)), | ||
('customer', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='corporate.Customer')), | ||
], | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
75 changes: 75 additions & 0 deletions
75
corporate/tests/stripe_fixtures/billing_page_permissions:Charge.create.1.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
{ | ||
"amount": 64000, | ||
"amount_refunded": 0, | ||
"application": null, | ||
"application_fee": null, | ||
"balance_transaction": "txn_NORMALIZED00000000000001", | ||
"captured": true, | ||
"created": 1000000000, | ||
"currency": "usd", | ||
"customer": "cus_NORMALIZED0001", | ||
"description": "Upgrade to Zulip Standard, $80.0 x 8", | ||
"destination": null, | ||
"dispute": null, | ||
"failure_code": null, | ||
"failure_message": null, | ||
"fraud_details": {}, | ||
"id": "ch_NORMALIZED00000000000001", | ||
"invoice": null, | ||
"livemode": false, | ||
"metadata": {}, | ||
"object": "charge", | ||
"on_behalf_of": null, | ||
"order": null, | ||
"outcome": { | ||
"network_status": "approved_by_network", | ||
"reason": null, | ||
"risk_level": "normal", | ||
"risk_score": 00, | ||
"seller_message": "Payment complete.", | ||
"type": "authorized" | ||
}, | ||
"paid": true, | ||
"payment_intent": null, | ||
"receipt_email": "[email protected]", | ||
"receipt_number": null, | ||
"refunded": false, | ||
"refunds": { | ||
"data": [], | ||
"has_more": false, | ||
"object": "list", | ||
"total_count": 0, | ||
"url": "/v1/charges/ch_NORMALIZED00000000000001/refunds" | ||
}, | ||
"review": null, | ||
"shipping": null, | ||
"source": { | ||
"address_city": "Pacific", | ||
"address_country": "United States", | ||
"address_line1": "Under the sea,", | ||
"address_line1_check": "pass", | ||
"address_line2": null, | ||
"address_state": null, | ||
"address_zip": "33333", | ||
"address_zip_check": "pass", | ||
"brand": "Visa", | ||
"country": "US", | ||
"customer": "cus_NORMALIZED0001", | ||
"cvc_check": "pass", | ||
"dynamic_last4": null, | ||
"exp_month": 3, | ||
"exp_year": 2033, | ||
"fingerprint": "NORMALIZED000001", | ||
"funding": "credit", | ||
"id": "card_NORMALIZED00000000000001", | ||
"last4": "4242", | ||
"metadata": {}, | ||
"name": "Ada Starr", | ||
"object": "card", | ||
"tokenization_method": null | ||
}, | ||
"source_transfer": null, | ||
"statement_descriptor": "Zulip Standard", | ||
"status": "succeeded", | ||
"transfer_group": null | ||
} |
Oops, something went wrong.