finance email

remotes/origin/yandex_rebiling
Andrey 8 years ago
parent 73d62c897d
commit 8ae4d09a3d
  1. 18
      finance/signals.py

@ -5,11 +5,27 @@ from django.dispatch import receiver
from yandex_money.models import Payment
from django.conf import settings
from finance.models import Invoice
from finance.models import Invoice, InvoiceRebilling
from courses.models import Course
from progress.models import Progress, ProgressLesson
@receiver(pre_save, sender=InvoiceRebilling)
def invoice_signal(instance, **kwargs):
"""Отправка сообщения после сохранения рассрочки"""
if instance.yandex_pay and instance.method == 'Y' and instance.status == 'P':
msg = EmailMessage(
'Вам выставлен новый счёт',
"""%s для оплаты перейдите по ссылке
%s/api/v1/finance/payment/%s/""" % (instance.get_comment(), settings.DOMAIN, instance.yandex_pay.id),
to=[instance.yandex_pay.cps_email],
bcc=[instance.bill.opener.email],
reply_to=[instance.bill.opener.email],
)
msg.send()
@receiver(pre_save, sender=Invoice)
def invoice_signal(instance, **kwargs):
"""Отправка сообщения после сохранения платежа"""

Loading…
Cancel
Save