Implement handling invoice.payment_succeeded and invoice.payment_failed webhooks
This commit is contained in:
parent
9b32290964
commit
8a59c2da1e
3 changed files with 85 additions and 0 deletions
|
|
@ -435,6 +435,19 @@ class HostingBillLineItem(AssignPermissionsMixin, models.Model):
|
|||
('view_hostingbilllineitem', 'View Monthly Hosting Bill Line Item'),
|
||||
)
|
||||
|
||||
def get_vm_id(self):
|
||||
"""
|
||||
If VM_ID is set in the metadata extract and return it as integer
|
||||
other return -1
|
||||
|
||||
:return:
|
||||
"""
|
||||
if "VM_ID" in self.metadata:
|
||||
data = json.loads(self.metadata)
|
||||
return int(data["VM_ID"])
|
||||
else:
|
||||
return None
|
||||
|
||||
|
||||
class VMDetail(models.Model):
|
||||
user = models.ForeignKey(CustomUser)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue