uncloud/uncloud/ungleich_service/models.py

21 lines
680 B
Python
Raw Normal View History

import uuid
from django.db import models
from uncloud_pay.models import Product, RecurringPeriod
from uncloud_vm.models import VMProduct
class MatrixServiceProduct(Product):
monthly_managment_fee = 20
setup_fee = 30
description = "Managed Matrix HomeServer"
vm = models.ForeignKey(
VMProduct, on_delete=models.CASCADE
)
def recurring_price(self, recurring_period=RecurringPeriod.PER_MONTH):
if recurring_period == RecurringPeriod.PER_MONTH:
return monthly_managment_fee + vm.recurring_price(RecurringPeriod.PER_MONTH)
else:
raise Exception('Invalid recurring period for VM Product pricing.')