diff --git a/api/v1/views.py b/api/v1/views.py
index 41cd881a..bb5eb6ed 100644
--- a/api/v1/views.py
+++ b/api/v1/views.py
@@ -419,13 +419,24 @@ class AuthorRequestViewSet(ExtendedModelViewSet):
class PaymentViewSet(ExtendedModelViewSet):
- queryset = Payment.objects.filter(status__isnull=False).order_by('-created_at')
+ queryset = Payment.objects.all()
serializer_class = PaymentSerializer
permission_classes = (IsAdmin,)
- filter_fields = ('status',)
+ filter_fields = ('status', 'user',)
ordering_fields = (
'id', 'user__email',
'user__first_name', 'user__last_name',
'amount', 'created_at',
)
search_fields = ('user__email', 'user__first_name', 'user__last_name',)
+
+ def get_queryset(self):
+ queryset = self.queryset
+ course = self.request.query_params.get('course')
+ weekdays = self.request.query_params.getlist('weekdays[]')
+ if course:
+ queryset = CoursePayment.objects.filter(course=course)
+ if weekdays:
+ queryset = SchoolPayment.objects.filter(weekdays__overlap=weekdays)
+
+ return queryset.filter(status__isnull=False).order_by('-created_at')
diff --git a/apps/course/templates/course/_items.html b/apps/course/templates/course/_items.html
index 42757ddc..b4356f2b 100644
--- a/apps/course/templates/course/_items.html
+++ b/apps/course/templates/course/_items.html
@@ -48,7 +48,7 @@
{{ course.category | upper }}
+ href="{% url 'courses' %}?category={{ course.category.id }}">{{ course.category | upper }}
{% if not course.is_free %}
{{ course.price|floatformat:"-2" }}₽
{% endif %}
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 74a6eb4e..50a320fe 100644
--- a/apps/school/templates/school/livelesson_detail.html
+++ b/apps/school/templates/school/livelesson_detail.html
@@ -8,20 +8,19 @@
diff --git a/web/package.json b/web/package.json
index 758fad6a..7a93432c 100755
--- a/web/package.json
+++ b/web/package.json
@@ -34,9 +34,13 @@
"webpack": "^3.10.0"
},
"dependencies": {
+ "autosize": "^4.0.2",
+ "autosize-input": "^1.0.2",
"axios": "^0.17.1",
"babel-polyfill": "^6.26.0",
"baguettebox.js": "^1.10.0",
+ "downscale": "^1.0.4",
+ "glob": "^7.1.2",
"history": "^4.7.2",
"ilyabirman-likely": "^2.3.0",
"inputmask": "^3.3.11",
diff --git a/web/src/components/blocks/Image.vue b/web/src/components/blocks/Image.vue
index 9006500d..11968d70 100644
--- a/web/src/components/blocks/Image.vue
+++ b/web/src/components/blocks/Image.vue
@@ -1,5 +1,5 @@
-