django-orchestra-test/orchestra/contrib/payments/api.py

22 lines
698 B
Python
Raw Normal View History

2014-07-23 16:24:56 +00:00
from rest_framework import viewsets
2015-04-05 18:02:36 +00:00
from orchestra.api import router, LogApiMixin
2015-04-05 10:46:24 +00:00
from orchestra.contrib.accounts.api import AccountApiMixin
2014-07-23 16:24:56 +00:00
from .models import PaymentSource, Transaction
from .serializers import PaymentSourceSerializer, TransactionSerializer
2015-04-05 18:02:36 +00:00
class PaymentSourceViewSet(LogApiMixin, AccountApiMixin, viewsets.ModelViewSet):
2014-07-23 16:24:56 +00:00
serializer_class = PaymentSourceSerializer
2015-04-23 14:34:04 +00:00
queryset = PaymentSource.objects.all()
2014-07-23 16:24:56 +00:00
2015-04-05 18:02:36 +00:00
class TransactionViewSet(LogApiMixin, viewsets.ModelViewSet):
2014-07-23 16:24:56 +00:00
serializer_class = TransactionSerializer
2015-04-23 14:34:04 +00:00
queryset = Transaction.objects.all()
2014-07-23 16:24:56 +00:00
router.register(r'payment-sources', PaymentSourceViewSet)
router.register(r'transactions', TransactionViewSet)