Private
Public Access
1
0

first version dummy webhook for braintree

This commit is contained in:
Sander Roosendaal
2021-02-02 20:28:36 +01:00
parent aa5b2c82f0
commit c41b7611ee
3 changed files with 16 additions and 0 deletions

View File

@@ -52,6 +52,17 @@ else:
from rowers.models import Rower,PaidPlan, CoachingGroup
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):
if not rower.customer_id or force:
result = gateway.customer.create(

View File

@@ -921,6 +921,7 @@ urlpatterns = [
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/data/$',views.history_view_data,name="history_view_data"),
re_path(r'^braintree/$',views.braintree_webhook_view,name="braintree_webhook_view"),
]
if settings.DEBUG:

View File

@@ -5,6 +5,10 @@ from __future__ import unicode_literals
from rowers.views.statements import *
def braintree_webhook_view(request):
braintreestuff.webhook(request)
return JsonResponse(status=200)
def paidplans_view(request):
if not request.user.is_anonymous:
r = request.user.rower