Skip to content

Commit

Permalink
Merge pull request #237 from healthy-food-and-dietary-products/featur…
Browse files Browse the repository at this point in the history
…e/stripe_redirection

Feature/stripe redirection
  • Loading branch information
juliana-str authored Jan 11, 2024
2 parents 7a106e2 + 518707b commit e5e9773
Show file tree
Hide file tree
Showing 4 changed files with 208 additions and 96 deletions.
33 changes: 33 additions & 0 deletions backend/api/orders_serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -291,3 +291,36 @@ class StripeCheckoutSessionCreateSerializer(serializers.ModelSerializer):
class Meta:
model = Order
fields = tuple()


class StripeSessionCreateSerializer(serializers.Serializer):
"""Serializer to show Stripe Checkout Session URL."""

checkout_session_url = serializers.URLField()


class StripePaySuccessPageSerializer(serializers.Serializer):
"""Serializer to get the order number from Stripe Checkout Session after payment."""

stripe_session_id = serializers.CharField()
order_id = serializers.CharField(read_only=True)
order_number = serializers.CharField(read_only=True)


class StripeError500Serializer(serializers.Serializer):
"""Serializer for errors during Stripe payments."""

message = serializers.CharField()
errors = serializers.CharField()


class CustomSuccessSerializer(serializers.Serializer):
"""Serializer for custom success messages."""

message = serializers.CharField()


class CustomErrorSerializer(serializers.Serializer):
"""Serializer for custom errors."""

errors = serializers.CharField()
Loading

0 comments on commit e5e9773

Please sign in to comment.