forked from uncloud/uncloud
Adapt billing tests to product activation structure
This commit is contained in:
parent
5d5bf486b5
commit
83a0ca0e4e
2 changed files with 8 additions and 4 deletions
|
|
@ -481,7 +481,7 @@ class Order(models.Model):
|
|||
# Trigger initial bill generation at order creation.
|
||||
def save(self, *args, **kwargs):
|
||||
super(Order, self).save(*args, **kwargs)
|
||||
Bill.generate_for(timezone.now().year, timezone.now().month, self.owner)
|
||||
Bill.generate_for(self.starting_date.year, self.starting_date.month, self.owner)
|
||||
|
||||
@property
|
||||
def records(self):
|
||||
|
|
@ -496,6 +496,10 @@ class Order(models.Model):
|
|||
return reduce(lambda acc, record: acc + record.recurring_price, self.records, 0)
|
||||
|
||||
# Used by uncloud_pay tests.
|
||||
@property
|
||||
def bills(self):
|
||||
return Bill.objects.filter(order=self)
|
||||
|
||||
def add_record(self, one_time_price, recurring_price, description):
|
||||
OrderRecord.objects.create(order=self,
|
||||
one_time_price=one_time_price,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue