robosats/api/serializers.py
Reckless_Satoshi 755874b100
Advanced maker options v2 (#110)
* Add escrow/invoice time customization

* Add accordion for Expiry times

* Add current price on order maker

* Add deposit timeout limit on order page

* Minor aestetic fixes

* Implement pause/unpause and expiry reasons

* Add renew order

* Add highlight buy/sell on maker page

* Fix order renewal. Improve book visuals and response.

* Fix double renew requests

* Fix cancel orders. Fix paused status to delay

* Fix paused order layout and loading spinner

* Add telegram message: order is in chat
2022-04-29 18:54:20 +00:00

90 lines
2.5 KiB
Python

from rest_framework import serializers
from .models import Order
class ListOrderSerializer(serializers.ModelSerializer):
class Meta:
model = Order
fields = (
"id",
"status",
"created_at",
"expires_at",
"type",
"currency",
"amount",
"has_range",
"min_amount",
"max_amount",
"payment_method",
"is_explicit",
"premium",
"satoshis",
"bondless_taker",
"maker",
"taker",
"escrow_duration",
)
class MakeOrderSerializer(serializers.ModelSerializer):
class Meta:
model = Order
fields = (
"type",
"currency",
"amount",
"has_range",
"min_amount",
"max_amount",
"payment_method",
"is_explicit",
"premium",
"satoshis",
"public_duration",
"escrow_duration",
"bond_size",
"bondless_taker",
)
class UpdateOrderSerializer(serializers.Serializer):
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=(
"pause",
"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,
)
amount = serializers.DecimalField(max_digits=18, decimal_places=8, allow_null=True, required=False, default=None)
class ClaimRewardSerializer(serializers.Serializer):
invoice = serializers.CharField(max_length=2000,
allow_null=True,
allow_blank=True,
default=None)
class PriceSerializer(serializers.Serializer):
pass