fix: don't send pre-payment notification email
closes: https://gitea.gna.org/Hostea/dashboard/issues/49fix-rm-not-invoice
parent
0ab82fe0b4
commit
669a22a004
|
@ -122,17 +122,6 @@ class BillingTest(TestCase):
|
||||||
True,
|
True,
|
||||||
)
|
)
|
||||||
|
|
||||||
invoice_generated_mail = mail.outbox.pop()
|
|
||||||
self.assertEqual(
|
|
||||||
all(
|
|
||||||
[
|
|
||||||
invoice_generated_mail.to[0] == self.email,
|
|
||||||
"An invoice is generated" in invoice_generated_mail.body,
|
|
||||||
]
|
|
||||||
),
|
|
||||||
True,
|
|
||||||
)
|
|
||||||
|
|
||||||
## payment failure page; no real functionality but user is redirected here
|
## payment failure page; no real functionality but user is redirected here
|
||||||
# by stripe if payment is successful
|
# by stripe if payment is successful
|
||||||
resp = c.get(reverse("billing.invoice.fail", args=(payment.public_ref,)))
|
resp = c.get(reverse("billing.invoice.fail", args=(payment.public_ref,)))
|
||||||
|
|
|
@ -98,27 +98,4 @@ def generate_invoice(instance: Instance) -> Payment:
|
||||||
instance=instance,
|
instance=instance,
|
||||||
)
|
)
|
||||||
|
|
||||||
invoice_link = get_invoice_link(payment=payment)
|
|
||||||
|
|
||||||
ctx = {
|
|
||||||
"username": instance.owned_by.username,
|
|
||||||
"link": invoice_link,
|
|
||||||
"payment": payment,
|
|
||||||
}
|
|
||||||
|
|
||||||
body = render_to_string(
|
|
||||||
"billing/emails/payment-notification.txt",
|
|
||||||
context=ctx,
|
|
||||||
)
|
|
||||||
|
|
||||||
email = instance.owned_by.email
|
|
||||||
sender = settings.DEFAULT_FROM_EMAIL
|
|
||||||
|
|
||||||
send_mail(
|
|
||||||
subject="[Hostea] An invoice is generated for your Hostea VM",
|
|
||||||
message=body,
|
|
||||||
from_email=f"No reply Hostea<{sender}>", # TODO read from settings.py
|
|
||||||
recipient_list=[email],
|
|
||||||
)
|
|
||||||
|
|
||||||
return payment
|
return payment
|
||||||
|
|
Loading…
Reference in New Issue