hackish way of registering works

This commit is contained in:
Nico Schottelius 2020-12-25 17:29:17 +01:00
commit 6efedcb381
5 changed files with 80 additions and 56 deletions

View file

@ -51,12 +51,12 @@ class OrderViewSet(viewsets.ReadOnlyModelViewSet):
class RegisterCard(LoginRequiredMixin, TemplateView):
login_url = '/login/'
# This is not supposed to be "static" --
# the idea is to be able to switch the provider when needed
template_name = "uncloud_pay/stripe.html"
def get_context_data(self, **kwargs):
customer_id = uncloud_stripe.get_customer_id_for(self.request.user)
setup_intent = uncloud_stripe.create_setup_intent(customer_id)
context = super().get_context_data(**kwargs)
@ -159,7 +159,7 @@ class PaymentMethodViewSet(viewsets.ModelViewSet):
# TODO: find a way to use reverse properly:
# https://www.django-rest-framework.org/api-guide/reverse/
callback_path= "payment-method/{}/activate-stripe-cc/".format(
payment_method.uuid)
payment_method.id)
callback = reverse('api-root', request=request) + callback_path
# Render stripe card registration form.