Compare commits
6 Commits
953157ea15
...
0bd77cf1b6
| Author | SHA1 | Date | |
|---|---|---|---|
| 0bd77cf1b6 | |||
| b30ea9aa81 | |||
| 9de3755034 | |||
| ef9ea0bef5 | |||
| 23e0483763 | |||
| 29e1c7d7c5 |
@ -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()
|
||||
|
||||
|
||||
|
After Width: | Height: | Size: 573 KiB |
|
After Width: | Height: | Size: 1.1 KiB |
|
After Width: | Height: | Size: 2.8 KiB |
|
After Width: | Height: | Size: 506 KiB |
|
After Width: | Height: | Size: 522 KiB |
BIN
static/images/logos/users/new_dealer.png
Normal file
|
After Width: | Height: | Size: 1.2 MiB |
BIN
static/images/logos/vendors/Gemini_Generated_Image_6tpm9i6tpm9i6tpm_1.png
vendored
Normal file
|
After Width: | Height: | Size: 6.0 KiB |
BIN
static/images/logos/vendors/Gemini_Generated_Image_6tpm9i6tpm9i6tpm_1_PcQIcmG.png
vendored
Normal file
|
After Width: | Height: | Size: 4.3 KiB |
BIN
static/images/logos/vendors/Gemini_Generated_Image_6tpm9i6tpm9i6tpm_2.png
vendored
Normal file
|
After Width: | Height: | Size: 23 KiB |
@ -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 %}
|
||||
|
||||
@ -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 %}
|
||||
|
||||