|
|
|
|
@ -297,6 +297,8 @@ class PaymentwallCallbackView(View): |
|
|
|
|
product_payment_class = DrawingCampPayment |
|
|
|
|
elif product_type_name == 'gift_certificate': |
|
|
|
|
product_payment_class = GiftCertificatePayment |
|
|
|
|
elif product_type_name == 'package': |
|
|
|
|
product_payment_class = PackagePayment |
|
|
|
|
else: |
|
|
|
|
return HttpResponse(status=403) |
|
|
|
|
|
|
|
|
|
@ -363,6 +365,17 @@ class PaymentwallCallbackView(View): |
|
|
|
|
'created_at': payment.created_at, |
|
|
|
|
'update_at': payment.update_at, |
|
|
|
|
} |
|
|
|
|
elif product_type_name == 'package': |
|
|
|
|
properties = { |
|
|
|
|
'payment_id': payment.id, |
|
|
|
|
'amount': payment.amount, |
|
|
|
|
'status': payment.status, |
|
|
|
|
'date_start': payment.date_start, |
|
|
|
|
'date_end': payment.date_end, |
|
|
|
|
'created_at': payment.created_at, |
|
|
|
|
'update_at': payment.update_at, |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
payment.save() |
|
|
|
|
|
|
|
|
|
product_payment_to_mixpanel.delay( |
|
|
|
|
@ -392,6 +405,9 @@ class PaymentwallCallbackView(View): |
|
|
|
|
elif product_type_name != 'drawing_camp': |
|
|
|
|
send_email.delay('Спасибо за покупку!', payment.user.email, 'notification/email/buy_email.html', |
|
|
|
|
product_type=product_type_name, date_start=payment.date_start, date_end=payment.date_end) |
|
|
|
|
elif product_type_name != 'package': |
|
|
|
|
send_email.delay('Спасибо за покупку!', payment.user.email, 'notification/email/buy_email.html', |
|
|
|
|
product_type=product_type_name, date_start=payment.date_start, date_end=payment.date_end) |
|
|
|
|
|
|
|
|
|
author_balance = getattr(payment, 'author_balance', None) |
|
|
|
|
if author_balance and author_balance.type == AuthorBalance.IN: |
|
|
|
|
@ -519,7 +535,7 @@ class PackagePaymentBuyView(TemplateView): |
|
|
|
|
'demo': 1, |
|
|
|
|
'test_mode': 1, |
|
|
|
|
'success_url': host + str( |
|
|
|
|
reverse_lazy('gift-certificate-payment-success', args=[gift_certificate_payment.id])), |
|
|
|
|
reverse_lazy('package-payment-success', args=[pp.id])), |
|
|
|
|
'failure_url': host + str(reverse_lazy('payment-error')), |
|
|
|
|
} |
|
|
|
|
) |
|
|
|
|
@ -530,7 +546,3 @@ class PackagePaymentBuyView(TemplateView): |
|
|
|
|
@method_decorator(login_required, name='dispatch') |
|
|
|
|
class PackagePaymentBuySuccessView(TemplateView): |
|
|
|
|
template_name = 'payment/package_payment_success.html' |
|
|
|
|
|
|
|
|
|
def get(self, request, pk=None, *args, **kwargs): |
|
|
|
|
course = get_object_or_404(Course, pk=pk) |
|
|
|
|
return self.render_to_response(context={'course': course}) |
|
|
|
|
|