diff --git a/apps/payment/models.py b/apps/payment/models.py
index 415ad98e..25e98c82 100644
--- a/apps/payment/models.py
+++ b/apps/payment/models.py
@@ -190,7 +190,7 @@ class SchoolPayment(Payment):
month_price_sum = aggregate.get('month_price__sum', 0) * weekday_count // all_weekday_count
else:
month_price_sum = aggregate.get('month_price__sum', 0)
- if month_price_sum >= config.SERVICE_DISCOUNT_MIN_AMOUNT:
+ if self.id is None and month_price_sum >= config.SERVICE_DISCOUNT_MIN_AMOUNT:
discount = config.SERVICE_DISCOUNT
else:
discount = 0
diff --git a/apps/payment/views.py b/apps/payment/views.py
index 40fccca0..afe2b8ac 100644
--- a/apps/payment/views.py
+++ b/apps/payment/views.py
@@ -197,12 +197,18 @@ class PaymentwallCallbackView(View):
payment.status = pingback.get_type()
payment.data = payment_raw_data
if pingback.is_deliverable():
+ effective_amount = pingback.get_parameter('effective_price_amount')
+
+ if effective_amount:
+ payment.amount = effective_amount
+
transaction_to_mixpanel.delay(
payment.user.id,
payment.amount,
now().strftime('%Y-%m-%dT%H:%M:%S'),
product_type_name,
)
+
if product_type_name == 'school':
school_payment = SchoolPayment.objects.filter(
user=payment.user,
@@ -252,6 +258,7 @@ class PaymentwallCallbackView(View):
'update_at': payment.update_at,
}
payment.save()
+
product_payment_to_mixpanel.delay(
payment.user.id,
f'{product_type_name.title()} payment',
@@ -269,6 +276,7 @@ class PaymentwallCallbackView(View):
product_type_name,
payment.roistat_visit,
)
+
author_balance = getattr(payment, 'author_balance', None)
if author_balance and author_balance.type == AuthorBalance.IN:
if pingback.is_deliverable():
@@ -277,7 +285,6 @@ class PaymentwallCallbackView(View):
payment.author_balance.status = AuthorBalance.PENDING
else:
payment.author_balance.status = AuthorBalance.DECLINED
-
payment.author_balance.save()
return HttpResponse('OK')
else:
diff --git a/apps/school/templates/school/livelesson_detail.html b/apps/school/templates/school/livelesson_detail.html
index 01663932..50a320fe 100644
--- a/apps/school/templates/school/livelesson_detail.html
+++ b/apps/school/templates/school/livelesson_detail.html
@@ -8,20 +8,19 @@
{{ livelesson.title }}
{{ livelesson.short_description }}
+
{% if livelesson.stream_index %}
-
-
-
- Если видео не загрузилось, уменьшите качество видео или обновите страницу
+
+ Если видео не загрузилось, - уменьшите качество видео или обновите страницу
{% else %}
{% if livelesson.cover %}
- {% else %}
- {% endif %}
+ {% endif %}
{% endif %}
+