-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add stripe subscription remaining endpoints
- Loading branch information
Showing
3 changed files
with
77 additions
and
35 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,7 @@ | ||
# -*- coding: utf-8 -*- | ||
from django.db.models.signals import post_save | ||
from django.dispatch import receiver | ||
from djstripe.models import Customer as DJStripeCustomer | ||
# from django.db.models.signals import post_save | ||
# from django.dispatch import receiver | ||
# from djstripe.models import Customer as DJStripeCustomer | ||
|
||
from bd_api.apps.account.models import Account | ||
from bd_api.utils import is_prod | ||
|
||
|
||
@receiver(post_save, sender=Account) | ||
def create_stripe_customer(sender, instance, created, **kwargs): | ||
"""Create stripe customer from after registration""" | ||
|
||
if created and is_prod(): | ||
DJStripeCustomer.create(subscriber=instance) | ||
# from bd_api.apps.account.models import Account | ||
# from bd_api.utils import is_prod |
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 |
---|---|---|
@@ -1,12 +1,34 @@ | ||
# -*- coding: utf-8 -*- | ||
from django.urls import include, path | ||
|
||
from bd_api.apps.payment.views import StripeCustomerView, StripeSubscriptionView | ||
from bd_api.apps.payment.views import ( | ||
StripeCustomerSubscriptionView, | ||
StripeCustomerView, | ||
StripeSubscriptionView, | ||
) | ||
|
||
urlpatterns = [ | ||
path("", include("djstripe.urls", namespace="payment")), | ||
path("customer/<account_id>/", StripeCustomerView, name="payment_customer"), | ||
path("customer/", StripeCustomerView.as_view(), name="payment_customer"), | ||
path("customer/<account_id>/", StripeCustomerView.as_view(), name="payment_customer"), | ||
path( | ||
"subscription/<account_id>/<price_id>/", StripeSubscriptionView, name="payment_subscription" | ||
"customer/<account_id>/subscription/", | ||
StripeCustomerSubscriptionView.as_view(), | ||
name="payment_subscription", | ||
), | ||
path( | ||
"customer/<account_id>/subscription/<subscription_id>", | ||
StripeCustomerSubscriptionView.as_view(), | ||
name="payment_subscription", | ||
), | ||
path( | ||
"subscription/", | ||
StripeSubscriptionView.as_view(), | ||
name="payment_subscription", | ||
), | ||
path( | ||
"subscription/<subscription_id>/", | ||
StripeSubscriptionView.as_view(), | ||
name="payment_subscription", | ||
), | ||
] |
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