SUMMARY
dash.models.Instance is created upon request and
infrastructure.models.InstanceCreated when the instance is created.
Using data from InstanceCreated to send invoices should solve this
issue.
ci/woodpecker/push/woodpecker Pipeline was successfulDetails
checking if payment is already fulfilled
DESCRIPTION
Invoice generation is dependent on instance_name. Deleting a VM
doesn't delete the corresponding payments record since payment
receipts should be preserved for accounting purposes.
But being heavily dependent on instance_name, without taking deleted
VMs into account produces incorrect behavior under certain
circumstances: if a VM named 'foo' is paid for and is deleted before
its billing cycle is competed and a new VM is created with the same
name, either by the same user or a different user, invoice won't be
generated for the new VM since a payment record already exists for
that billing cycle for the VM named 'foo'.
Marking deleted VMs' payment records unsuitable for checking if a VM
is already paid for will result in correct behavior.
fixes: https://gitea.hostea.org/Hostea/dashboard/issues/38
ci/woodpecker/push/woodpecker Pipeline was successfulDetails
SUMMARY
`python manage.py generate_invoice` generates invoices for VMs when
it enters a new billing cycle and sends a notification email to
VM owners.
This command should be run as frequently as desirable. Running daily
is recommended.
BILLING CYCLE
By default, a billing cycle is 30 days.
SUMMARY
PAYMENT WORKFLOW
1. User is redirected after a new instance is created into a view
that generates invoice. There are checks in place to ensure
invoices are not generated twice for the same VM. There is also a
check in place to generate invoices for time periods that are
already paid for
2. User is redirected to payment form
3. Stripe takes over
4. If payment is successful, user is redirected to success page
5. If payment failed, user is redirected to failure page
PENDING INVOICES
The user can see pending invoices on their dashboard
PAYMENT RECEIPTS
The user can see payment receipts on their dashboard