forked from uncloud/uncloud
Add OrderRecord model
This commit is contained in:
parent
4f25086a63
commit
8e41b894c0
2 changed files with 43 additions and 5 deletions
|
|
@ -98,12 +98,25 @@ class Order(models.Model):
|
|||
|
||||
@property
|
||||
def amount(self):
|
||||
# amount = recurring_price
|
||||
# if recurring and first_month:
|
||||
# amount += one_time_price
|
||||
records = OrderRecord.objects.filter(order=self)
|
||||
return 1
|
||||
|
||||
amount=1
|
||||
return amount
|
||||
class OrderRecord(models.Model):
|
||||
order = models.ForeignKey(Order, on_delete=models.CASCADE)
|
||||
setup_fee = models.DecimalField(default=0.0,
|
||||
max_digits=AMOUNT_MAX_DIGITS,
|
||||
decimal_places=AMOUNT_DECIMALS,
|
||||
validators=[MinValueValidator(0)])
|
||||
recurring_price = models.DecimalField(default=0.0,
|
||||
max_digits=AMOUNT_MAX_DIGITS,
|
||||
decimal_places=AMOUNT_DECIMALS,
|
||||
validators=[MinValueValidator(0)])
|
||||
|
||||
description = models.TextField()
|
||||
|
||||
@property
|
||||
def recurring_period(self):
|
||||
return self.order.recurring_period
|
||||
|
||||
class PaymentMethod(models.Model):
|
||||
uuid = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue