|
|
|
@ -196,12 +196,18 @@ class PaymentwallCallbackView(View): |
|
|
|
payment.status = pingback.get_type() |
|
|
|
payment.status = pingback.get_type() |
|
|
|
payment.data = payment_raw_data |
|
|
|
payment.data = payment_raw_data |
|
|
|
if pingback.is_deliverable(): |
|
|
|
if pingback.is_deliverable(): |
|
|
|
|
|
|
|
effective_amount = pingback.get_parameter('effective_price_amount') |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if effective_amount: |
|
|
|
|
|
|
|
payment.amount = effective_amount |
|
|
|
|
|
|
|
|
|
|
|
transaction_to_mixpanel.delay( |
|
|
|
transaction_to_mixpanel.delay( |
|
|
|
payment.user.id, |
|
|
|
payment.user.id, |
|
|
|
payment.amount, |
|
|
|
payment.amount, |
|
|
|
now().strftime('%Y-%m-%dT%H:%M:%S'), |
|
|
|
now().strftime('%Y-%m-%dT%H:%M:%S'), |
|
|
|
product_type_name, |
|
|
|
product_type_name, |
|
|
|
) |
|
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
if product_type_name == 'school': |
|
|
|
if product_type_name == 'school': |
|
|
|
school_payment = SchoolPayment.objects.filter( |
|
|
|
school_payment = SchoolPayment.objects.filter( |
|
|
|
user=payment.user, |
|
|
|
user=payment.user, |
|
|
|
@ -251,6 +257,7 @@ class PaymentwallCallbackView(View): |
|
|
|
'update_at': payment.update_at, |
|
|
|
'update_at': payment.update_at, |
|
|
|
} |
|
|
|
} |
|
|
|
payment.save() |
|
|
|
payment.save() |
|
|
|
|
|
|
|
|
|
|
|
product_payment_to_mixpanel.delay( |
|
|
|
product_payment_to_mixpanel.delay( |
|
|
|
payment.user.id, |
|
|
|
payment.user.id, |
|
|
|
f'{product_type_name.title()} payment', |
|
|
|
f'{product_type_name.title()} payment', |
|
|
|
@ -268,6 +275,7 @@ class PaymentwallCallbackView(View): |
|
|
|
product_type_name, |
|
|
|
product_type_name, |
|
|
|
payment.roistat_visit, |
|
|
|
payment.roistat_visit, |
|
|
|
) |
|
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
author_balance = getattr(payment, 'author_balance', None) |
|
|
|
author_balance = getattr(payment, 'author_balance', None) |
|
|
|
if author_balance and author_balance.type == AuthorBalance.IN: |
|
|
|
if author_balance and author_balance.type == AuthorBalance.IN: |
|
|
|
if pingback.is_deliverable(): |
|
|
|
if pingback.is_deliverable(): |
|
|
|
@ -276,7 +284,6 @@ class PaymentwallCallbackView(View): |
|
|
|
payment.author_balance.status = AuthorBalance.PENDING |
|
|
|
payment.author_balance.status = AuthorBalance.PENDING |
|
|
|
else: |
|
|
|
else: |
|
|
|
payment.author_balance.status = AuthorBalance.DECLINED |
|
|
|
payment.author_balance.status = AuthorBalance.DECLINED |
|
|
|
|
|
|
|
|
|
|
|
payment.author_balance.save() |
|
|
|
payment.author_balance.save() |
|
|
|
return HttpResponse('OK') |
|
|
|
return HttpResponse('OK') |
|
|
|
else: |
|
|
|
else: |
|
|
|
|