|
4 | 4 | from modules.organization.invoice.models.entities import (
|
5 | 5 | Credit,
|
6 | 6 | InvoiceDetails,
|
| 7 | + MockStripeCustomer, |
| 8 | + MockStripeSubscription, |
7 | 9 | PaymentPlan,
|
8 | 10 | RecordStatus,
|
9 | 11 | )
|
@@ -62,8 +64,12 @@ def add_organization(
|
62 | 64 | )
|
63 | 65 | organization = Organization(**org_request.dict())
|
64 | 66 |
|
65 |
| - customer = self.billing.create_customer(organization.name) |
66 |
| - subscription = self.billing.create_subscription(customer.id) |
| 67 | + if invoice_settings.stripe_disabled: |
| 68 | + customer = MockStripeCustomer() |
| 69 | + subscription = MockStripeSubscription() |
| 70 | + else: |
| 71 | + customer = self.billing.create_customer(organization.name) |
| 72 | + subscription = self.billing.create_subscription(customer.id) |
67 | 73 | # default organization plan is CREDIT_ONLY
|
68 | 74 | organization.invoice_details = InvoiceDetails(
|
69 | 75 | plan=PaymentPlan.CREDIT_ONLY,
|
@@ -161,8 +167,12 @@ def add_organization_by_slack_installation(
|
161 | 167 | owner=slack_installation_request.user.id,
|
162 | 168 | )
|
163 | 169 |
|
164 |
| - customer = self.billing.create_customer(organization.name) |
165 |
| - subscription = self.billing.create_subscription(customer.id) |
| 170 | + if invoice_settings.stripe_disabled: |
| 171 | + customer = MockStripeCustomer() |
| 172 | + subscription = MockStripeSubscription() |
| 173 | + else: |
| 174 | + customer = self.billing.create_customer(organization.name) |
| 175 | + subscription = self.billing.create_subscription(customer.id) |
166 | 176 | organization.invoice_details = InvoiceDetails(
|
167 | 177 | plan=PaymentPlan.CREDIT_ONLY,
|
168 | 178 | stripe_customer_id=customer.id,
|
|
0 commit comments