Яндекс деньги

feature/fix_generate_pass
Andrey 8 years ago
parent 5868a97230
commit caf1c7c649
  1. 11
      finance/signals.py

@ -11,7 +11,7 @@ from access.models import Progress
def delete_dependencies(instance, **kwargs): def delete_dependencies(instance, **kwargs):
"""Отправка сообщения после сохранения платежа""" """Отправка сообщения после сохранения платежа"""
if instance.yandex_pay and instance.method == 'Y' and instance.status == 'P': if instance.yandex_pay and instance.method == 'Y' and instance.status == 'P':
EmailMessage( msg = EmailMessage(
'Вам выставлен новый счёт', 'Вам выставлен новый счёт',
'''Вам выставлен счёт, для оплаты перейдите по ссылке '''Вам выставлен счёт, для оплаты перейдите по ссылке
https://go.skillbox.ru/api/v1/finance/payment/%s/''' % instance.yandex_pay.id, https://go.skillbox.ru/api/v1/finance/payment/%s/''' % instance.yandex_pay.id,
@ -20,6 +20,7 @@ def delete_dependencies(instance, **kwargs):
[instance.bill.opener.email], [instance.bill.opener.email],
reply_to=[instance.bill.opener.email], reply_to=[instance.bill.opener.email],
) )
msg.send()
if instance.status == 'F': if instance.status == 'F':
if instance.is_open: if instance.is_open:
@ -28,7 +29,7 @@ def delete_dependencies(instance, **kwargs):
user=instance.bill.user, user=instance.bill.user,
active_obj=instance.bill.course.get_first(['tutorial', 'task',]) active_obj=instance.bill.course.get_first(['tutorial', 'task',])
) )
EmailMessage( msg = EmailMessage(
'Ваш платёж прошёл успешно', 'Ваш платёж прошёл успешно',
'''Вам открыт доступ к курсу "%s", вы можете перейти по ссылке и '''Вам открыт доступ к курсу "%s", вы можете перейти по ссылке и
ознакомиться с материабламиhttps://go.skillbox.ru/course/%s/''' ознакомиться с материабламиhttps://go.skillbox.ru/course/%s/'''
@ -39,7 +40,7 @@ def delete_dependencies(instance, **kwargs):
reply_to=[instance.bill.opener.email], reply_to=[instance.bill.opener.email],
) )
else: else:
EmailMessage( msg = EmailMessage(
'Ваш платёж прошёл успешно', 'Ваш платёж прошёл успешно',
'''Курс "%s" был забронирован''' % instance.bill.course.title, '''Курс "%s" был забронирован''' % instance.bill.course.title,
'robo@skillbox.ru', 'robo@skillbox.ru',
@ -47,9 +48,10 @@ def delete_dependencies(instance, **kwargs):
[instance.bill.opener.email], [instance.bill.opener.email],
reply_to=[instance.bill.opener.email], reply_to=[instance.bill.opener.email],
) )
msg.send()
if instance.status == 'C': if instance.status == 'C':
EmailMessage( msg = EmailMessage(
'Ошибка платежа!' 'Ошибка платежа!'
"""Внимание не прошёл платёж пользавателю %s, """Внимание не прошёл платёж пользавателю %s,
по курсу "%s" ID платежа: %s. Если не получается по курсу "%s" ID платежа: %s. Если не получается
@ -61,6 +63,7 @@ def delete_dependencies(instance, **kwargs):
[instance.bill.opener.email], [instance.bill.opener.email],
reply_to=["andrey.korolev@skillbox.ru"] reply_to=["andrey.korolev@skillbox.ru"]
) )
msg.send()
@receiver(post_save, sender=Payment) @receiver(post_save, sender=Payment)

Loading…
Cancel
Save