Fix payment update updates

This commit is contained in:
fnux 2020-03-05 11:28:43 +01:00
parent 31507c0f1a
commit 7e278228bd
2 changed files with 7 additions and 0 deletions

View file

@ -31,6 +31,11 @@ class PaymentMethodSerializer(serializers.ModelSerializer):
model = PaymentMethod
fields = ['uuid', 'source', 'description', 'primary', 'stripe_card_last4', 'active']
class UpdatePaymentMethodSerializer(serializers.ModelSerializer):
class Meta:
model = PaymentMethod
fields = ['description', 'primary']
class ChargePaymentMethodSerializer(serializers.Serializer):
amount = serializers.DecimalField(max_digits=10, decimal_places=2)

View file

@ -41,6 +41,8 @@ class PaymentMethodViewSet(viewsets.ModelViewSet):
def get_serializer_class(self):
if self.action == 'create':
return CreatePaymentMethodSerializer
elif self.action == 'update':
return UpdatePaymentMethodSerializer
elif self.action == 'charge':
return ChargePaymentMethodSerializer
else: