Compare commits

...

6 Commits

12 changed files with 22 additions and 13 deletions

View File

@ -9368,6 +9368,7 @@ def payment_callback(request, dealer_slug):
history = models.PaymentHistory.objects.filter(transaction_id=payment_id).first()
payment_status = request.GET.get("status")
order = Order.objects.filter(user=dealer.user, status=1).first() # Status 1 = NEW
print(order)
if payment_status == "paid":
billing_info, created = BillingInfo.objects.get_or_create(
user=dealer.user,
@ -9380,19 +9381,27 @@ def payment_callback(request, dealer_slug):
'country': dealer.entity.country or " ",
}
)
if not hasattr(order.user, 'userplan'):
UserPlan.objects.create(
user=order.user,
plan=order.plan,
expire=datetime.now().date() + timedelta(days=order.get_plan_pricing().pricing.period)
)
try:
# if order.user.userplan:
# user = order.user
# pricing = order.get_plan_pricing().pricing
# logger.info(f"Processing order completion for {user} - upgrading to {order.plan}")
# user.userplan.plan = order.plan
# user.userplan.expire = datetime.now() + timedelta(days=pricing.period)
# user.userplan.save()
# user.save()
# logger.info(f"User {user} upgraded to {order.plan} plan successfully")
order.complete_order()
user = order.user
pricing = order.get_plan_pricing().pricing
logger.info(f"Processing order completion for {user} - upgrading to {order.plan}")
user.userplan.plan = order.plan
user.userplan.expire = datetime.now() + timedelta(days=pricing.period)
user.userplan.save()
user.save()
logger.info(f"User {user} upgraded to {order.plan} plan successfully")
history.status = "paid"
history.save()

Binary file not shown.

After

Width:  |  Height:  |  Size: 573 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 506 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 522 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

View File

@ -79,7 +79,7 @@
{% else %}
{% url "estimate_create" request.dealer.slug as create_estimate_url %}
{% include "empty-illustration-page.html" with value="estimate" url=create_estimate_url image='images/no_content/no_estimate.jpg' %}
{% include "empty-illustration-page.html" with value="estimate" url=create_estimate_url %}
{% endif %}
{% endblock %}

View File

@ -83,8 +83,8 @@
{% else %}
{% if request.user.userplan %}
{% url "user_create" request.dealer.slug as create_staff_url image="images/no_content/no_user.png" %}
{% include "empty-illustration-page.html" with value="staff" url=create_staff_url %}
{% url "user_create" request.dealer.slug as create_staff_url %}
{% include "empty-illustration-page.html" with value="staff" url=create_staff_url image="images/no_content/no_user.png"%}
{% else %}
{% url "pricing_page" request.dealer.slug as pricing_page_url %}