first version dummy webhook for braintree
This commit is contained in:
@@ -52,6 +52,17 @@ else:
|
|||||||
from rowers.models import Rower,PaidPlan, CoachingGroup
|
from rowers.models import Rower,PaidPlan, CoachingGroup
|
||||||
from rowers.utils import ProcessorCustomerError
|
from rowers.utils import ProcessorCustomerError
|
||||||
|
|
||||||
|
def webhook(request):
|
||||||
|
webhook_notification = gateway.webhook_notification.parse(
|
||||||
|
str(request.POST['bt_signature']),
|
||||||
|
request.POST['bt_payload'])
|
||||||
|
|
||||||
|
# Example values for webhook notification properties
|
||||||
|
print(webhook_notification.kind) # "subscription_went_past_due"
|
||||||
|
print(webhook_notification.timestamp) # "Sun Jan 1 00:00:00 UTC 2012"
|
||||||
|
|
||||||
|
return Response(status=200)
|
||||||
|
|
||||||
def create_customer(rower,force=False):
|
def create_customer(rower,force=False):
|
||||||
if not rower.customer_id or force:
|
if not rower.customer_id or force:
|
||||||
result = gateway.customer.create(
|
result = gateway.customer.create(
|
||||||
|
|||||||
@@ -921,6 +921,7 @@ urlpatterns = [
|
|||||||
re_path(r'^history/$',views.history_view,name="history_view"),
|
re_path(r'^history/$',views.history_view,name="history_view"),
|
||||||
re_path(r'^history/user/(?P<userid>\d+)/data/$',views.history_view_data,name="history_view_data"),
|
re_path(r'^history/user/(?P<userid>\d+)/data/$',views.history_view_data,name="history_view_data"),
|
||||||
re_path(r'^history/data/$',views.history_view_data,name="history_view_data"),
|
re_path(r'^history/data/$',views.history_view_data,name="history_view_data"),
|
||||||
|
re_path(r'^braintree/$',views.braintree_webhook_view,name="braintree_webhook_view"),
|
||||||
]
|
]
|
||||||
|
|
||||||
if settings.DEBUG:
|
if settings.DEBUG:
|
||||||
|
|||||||
@@ -5,6 +5,10 @@ from __future__ import unicode_literals
|
|||||||
|
|
||||||
from rowers.views.statements import *
|
from rowers.views.statements import *
|
||||||
|
|
||||||
|
def braintree_webhook_view(request):
|
||||||
|
braintreestuff.webhook(request)
|
||||||
|
return JsonResponse(status=200)
|
||||||
|
|
||||||
def paidplans_view(request):
|
def paidplans_view(request):
|
||||||
if not request.user.is_anonymous:
|
if not request.user.is_anonymous:
|
||||||
r = request.user.rower
|
r = request.user.rower
|
||||||
|
|||||||
Reference in New Issue
Block a user