2022-01-01 22:34:23 +00:00
|
|
|
from rest_framework import serializers
|
2022-01-06 21:36:22 +00:00
|
|
|
from .models import Order
|
2022-01-01 22:34:23 +00:00
|
|
|
|
2022-02-17 19:50:10 +00:00
|
|
|
|
2022-01-05 00:13:08 +00:00
|
|
|
class ListOrderSerializer(serializers.ModelSerializer):
|
2022-02-17 19:50:10 +00:00
|
|
|
|
2022-01-01 22:34:23 +00:00
|
|
|
class Meta:
|
|
|
|
model = Order
|
2022-02-17 19:50:10 +00:00
|
|
|
fields = (
|
|
|
|
"id",
|
|
|
|
"status",
|
|
|
|
"created_at",
|
|
|
|
"expires_at",
|
|
|
|
"type",
|
|
|
|
"currency",
|
|
|
|
"amount",
|
|
|
|
"payment_method",
|
|
|
|
"is_explicit",
|
|
|
|
"premium",
|
|
|
|
"satoshis",
|
|
|
|
"maker",
|
|
|
|
"taker",
|
|
|
|
)
|
|
|
|
|
2022-01-01 22:34:23 +00:00
|
|
|
|
|
|
|
class MakeOrderSerializer(serializers.ModelSerializer):
|
2022-02-17 19:50:10 +00:00
|
|
|
|
2022-01-01 22:34:23 +00:00
|
|
|
class Meta:
|
|
|
|
model = Order
|
2022-02-17 19:50:10 +00:00
|
|
|
fields = (
|
|
|
|
"type",
|
|
|
|
"currency",
|
|
|
|
"amount",
|
|
|
|
"payment_method",
|
|
|
|
"is_explicit",
|
|
|
|
"premium",
|
|
|
|
"satoshis",
|
|
|
|
)
|
|
|
|
|
2022-01-05 00:13:08 +00:00
|
|
|
|
2022-01-06 20:33:40 +00:00
|
|
|
class UpdateOrderSerializer(serializers.Serializer):
|
2022-02-17 19:50:10 +00:00
|
|
|
invoice = serializers.CharField(max_length=2000,
|
|
|
|
allow_null=True,
|
|
|
|
allow_blank=True,
|
|
|
|
default=None)
|
|
|
|
statement = serializers.CharField(max_length=10000,
|
|
|
|
allow_null=True,
|
|
|
|
allow_blank=True,
|
|
|
|
default=None)
|
|
|
|
action = serializers.ChoiceField(
|
|
|
|
choices=(
|
|
|
|
"take",
|
|
|
|
"update_invoice",
|
|
|
|
"submit_statement",
|
|
|
|
"dispute",
|
|
|
|
"cancel",
|
|
|
|
"confirm",
|
|
|
|
"rate_user",
|
|
|
|
"rate_platform",
|
|
|
|
),
|
|
|
|
allow_null=False,
|
|
|
|
)
|
|
|
|
rating = serializers.ChoiceField(
|
|
|
|
choices=("1", "2", "3", "4", "5"),
|
|
|
|
allow_null=True,
|
|
|
|
allow_blank=True,
|
|
|
|
default=None,
|
|
|
|
)
|