Fix payment update updates
This commit is contained in:
parent
31507c0f1a
commit
7e278228bd
2 changed files with 7 additions and 0 deletions
|
@ -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)
|
||||
|
||||
|
|
|
@ -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:
|
||||
|
|
Loading…
Reference in a new issue