implement credit card listing

This commit is contained in:
Nico Schottelius 2020-12-28 23:35:34 +01:00
commit e225bf1cc0
12 changed files with 183 additions and 63 deletions

View file

@ -7,8 +7,13 @@
Welcome to uncloud, checkout the following locations:
<ul>
<li><a href="/api/">The API</a>
<li><a href="/cc/reg/">The CC registration</a>
<li><a href="{% url 'api-root' %}">The uncloud API</a>
<li><a href="{% url 'cc_register' %}">Register a credit card</a>
(this is required to be done via Javascript so that we never see
your credit card, but it is sent directly to stripe)
You can list your credit card via the API.
</ul>
</div>

View file

@ -72,10 +72,12 @@ router.register(r'v1/user/register', authviews.AccountManagementViewSet, basenam
router.register(r'v2/net/wireguardvpn', netviews.WireGuardVPNViewSet, basename='wireguardvpnnetwork')
router.register(r'v2/net/wireguardvpnsizes', netviews.WireGuardVPNSizes, basename='wireguardvpnnetworksizes')
# Payment related
router.register(r'v2/payment/credit-card', payviews.CreditCardViewSet, basename='credit-card')
urlpatterns = [
path(r'api/', include(router.urls)),
path(r'api/', include(router.urls), name='api'),
path('api-auth/', include('rest_framework.urls', namespace='rest_framework')), # for login to REST API
path('openapi', get_schema_view(
@ -92,8 +94,6 @@ urlpatterns = [
path('admin/', admin.site.urls),
path('cc/reg/', payviews.RegisterCard.as_view(), name="cc_register"),
path('cc/list/', payviews.ListCards.as_view(), name="cc_list"),
path('cc/delete/<payment_method_id>', payviews.DeleteCard.as_view(), name="cc_delete"),
path('', uncloudviews.UncloudIndex.as_view(), name="uncloudindex"),
]