email chnages reverted
This commit is contained in:
parent
e6e2ed0150
commit
0ea27d0826
@ -9456,10 +9456,12 @@ def submit_plan(request, dealer_slug):
|
|||||||
tax=15,
|
tax=15,
|
||||||
status=1,
|
status=1,
|
||||||
)
|
)
|
||||||
|
logger.info(f"order created {order}")
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(e)
|
logger.error(e)
|
||||||
if not order:
|
if not order:
|
||||||
messages.error(request, _("Error creating order"))
|
messages.error(request, _("Error creating order"))
|
||||||
|
logger.error("unable to create order")
|
||||||
return redirect("pricing_page", dealer_slug=dealer_slug)
|
return redirect("pricing_page", dealer_slug=dealer_slug)
|
||||||
transaction_url = handle_payment(request, order)
|
transaction_url = handle_payment(request, order)
|
||||||
return redirect(transaction_url)
|
return redirect(transaction_url)
|
||||||
@ -9473,9 +9475,13 @@ def payment_callback(request, dealer_slug):
|
|||||||
payment_id = request.GET.get("id")
|
payment_id = request.GET.get("id")
|
||||||
history = models.PaymentHistory.objects.filter(transaction_id=payment_id).first()
|
history = models.PaymentHistory.objects.filter(transaction_id=payment_id).first()
|
||||||
payment_status = request.GET.get("status")
|
payment_status = request.GET.get("status")
|
||||||
|
logger.info(f"Received payment callback for dealer_slug: {dealer_slug}, payment_id: {payment_id}, status: {payment_status}")
|
||||||
order = Order.objects.filter(user=dealer.user, status=1).first() # Status 1 = NEW
|
order = Order.objects.filter(user=dealer.user, status=1).first() # Status 1 = NEW
|
||||||
|
|
||||||
print(order)
|
print(order)
|
||||||
if payment_status == "paid":
|
if payment_status == "paid":
|
||||||
|
logger.info(f"Payment successful for transaction ID {payment_id}. Processing order completion.")
|
||||||
|
|
||||||
billing_info, created = BillingInfo.objects.get_or_create(
|
billing_info, created = BillingInfo.objects.get_or_create(
|
||||||
user=dealer.user,
|
user=dealer.user,
|
||||||
defaults={
|
defaults={
|
||||||
@ -9487,12 +9493,20 @@ def payment_callback(request, dealer_slug):
|
|||||||
'country': dealer.entity.country or " ",
|
'country': dealer.entity.country or " ",
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
if created:
|
||||||
|
logger.info(f"Created new billing info for user {dealer.user}.")
|
||||||
|
else:
|
||||||
|
logger.debug(f"Billing info already exists for user {dealer.user}.")
|
||||||
|
|
||||||
if not hasattr(order.user, 'userplan'):
|
if not hasattr(order.user, 'userplan'):
|
||||||
UserPlan.objects.create(
|
UserPlan.objects.create(
|
||||||
user=order.user,
|
user=order.user,
|
||||||
plan=order.plan,
|
plan=order.plan,
|
||||||
expire=datetime.now().date() + timedelta(days=order.get_plan_pricing().pricing.period)
|
expire=datetime.now().date() + timedelta(days=order.get_plan_pricing().pricing.period)
|
||||||
)
|
)
|
||||||
|
logger.info(f"Created new UserPlan for user {order.user} with plan {order.plan}.")
|
||||||
|
else:
|
||||||
|
logger.info(f"UserPlan already exists for user {order.user}.")
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
|
||||||
@ -9510,7 +9524,7 @@ def payment_callback(request, dealer_slug):
|
|||||||
order.complete_order()
|
order.complete_order()
|
||||||
history.status = "paid"
|
history.status = "paid"
|
||||||
history.save()
|
history.save()
|
||||||
|
logger.info(f"Order {order.id} for user {order.user} completed successfully. Payment history updated.")
|
||||||
invoice = order.get_invoices().first()
|
invoice = order.get_invoices().first()
|
||||||
return render(
|
return render(
|
||||||
request,
|
request,
|
||||||
@ -9519,12 +9533,14 @@ def payment_callback(request, dealer_slug):
|
|||||||
)
|
)
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
logger.exception(f"Error completing order {order.id} for user {order.user}: {e}")
|
||||||
logger.error(f"Plan activation failed: {str(e)}")
|
logger.error(f"Plan activation failed: {str(e)}")
|
||||||
history.status = "failed"
|
history.status = "failed"
|
||||||
history.save()
|
history.save()
|
||||||
return render(request, "payment_failed.html", {"message": "Plan activation error"})
|
return render(request, "payment_failed.html", {"message": "Plan activation error"})
|
||||||
|
|
||||||
elif payment_status == "failed":
|
elif payment_status == "failed":
|
||||||
|
logger.warning(f"Payment failed for transaction ID {payment_id}. Message: {message}")
|
||||||
history.status = "failed"
|
history.status = "failed"
|
||||||
history.save()
|
history.save()
|
||||||
return render(request, "payment_failed.html", {"message": message})
|
return render(request, "payment_failed.html", {"message": message})
|
||||||
|
|||||||
@ -1,25 +1,13 @@
|
|||||||
{% load i18n %}{% autoescape off %}
|
{% load i18n %}{% autoescape off %}
|
||||||
|
{% trans "Hi" %} {% firstof user.get_full_name user.username %},
|
||||||
مرحباً {% firstof user.get_full_name user.username %}،
|
|
||||||
|
|
||||||
{% if userplan.expire != None %}
|
{% if userplan.expire != None %}
|
||||||
خطتك الحالية هي {{ plan.name }} وستنتهي صلاحيتها في {{ userplan.expire }}.
|
{% blocktrans with plan_name=plan.name expire=userplan.expire %}Your current plan is {{ plan_name }} and it will expire on {{ expire }}. {% endblocktrans %}
|
||||||
{% else %}
|
{% else %}
|
||||||
خطتك الحالية هي {{ plan.name }}.
|
{% blocktrans with plan_name=plan.name %}Your current plan is {{ plan_name }}. {% endblocktrans %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
شكراً لك،
|
{% trans "Thank you" %}
|
||||||
فريق تنحل
|
--
|
||||||
---------------------
|
{% blocktrans %}The Team at {{ site_name }}{% endblocktrans %}
|
||||||
|
|
||||||
Hi {% firstof user.get_full_name user.username %},
|
|
||||||
|
|
||||||
{% if userplan.expire != None %}
|
|
||||||
Your current plan is {{ plan_name }} and it will expire on {{ expire }}. {% endblocktrans %}
|
|
||||||
{% else %}
|
|
||||||
Your current plan is {{ plan_name }}. {% endblocktrans %}
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
Thank you
|
|
||||||
The Team at Tenhal
|
|
||||||
{% endautoescape %}
|
{% endautoescape %}
|
||||||
@ -1,3 +1 @@
|
|||||||
{% load i18n %}
|
{% load i18n %}{% blocktrans with user=user plan=plan.name %}Your account {{ user }} has new plan {{ plan }}{% endblocktrans %}
|
||||||
Your account {{ user }} has new plan {{ plan }}
|
|
||||||
حسابك {{ user }} لديه خطة جديدة {{ plan }}
|
|
||||||
@ -1,27 +1,14 @@
|
|||||||
{% load i18n %}{% autoescape off %}
|
{% load i18n %}{% autoescape off %}
|
||||||
مرحباً {% firstof user.get_full_name user.username %}،
|
{% trans "Hi" %} {% firstof user.get_full_name user.username %},
|
||||||
|
|
||||||
لقد انتهت صلاحية حسابك للتو.
|
{% blocktrans %}Your account has just expired.{% endblocktrans %}
|
||||||
|
|
||||||
يمكنك استعادة خطتك الحالية {{ userplan.plan.name }} من هنا:
|
{% blocktrans with plan_name=userplan.plan.name %}You can restore your current plan {{ plan_name }} here:{% endblocktrans %}
|
||||||
http://{{ site_domain }}{% url 'current_plan' %}
|
http://{{ site_domain }}{% url 'current_plan' %}
|
||||||
أو يمكنك ترقية خطتك من هنا:
|
{% blocktrans %}or you can upgrade your plan here:{% endblocktrans %}
|
||||||
http://{{ site_domain }}{% url 'upgrade_plan' %}
|
http://{{ site_domain }}{% url 'upgrade_plan' %}
|
||||||
|
|
||||||
شكراً لك،
|
{% trans "Thank you" %}
|
||||||
--
|
--
|
||||||
فريق تنحل
|
{% blocktrans %}The Team at {{ site_name }}{% endblocktrans %}
|
||||||
---------------------
|
|
||||||
Hi {% firstof user.get_full_name user.username %},
|
|
||||||
|
|
||||||
Your account has just expired.
|
|
||||||
|
|
||||||
You can restore your current plan {{ userplan.plan.name }} here:
|
|
||||||
http://{{ site_domain }}{% url 'current_plan' %}
|
|
||||||
or you can upgrade your plan here:
|
|
||||||
http://{{ site_domain }}{% url 'upgrade_plan' %}
|
|
||||||
|
|
||||||
Thank you,
|
|
||||||
--
|
|
||||||
The Team at TENHAL
|
|
||||||
{% endautoescape %}
|
{% endautoescape %}
|
||||||
@ -1,5 +1 @@
|
|||||||
{% load i18n %}{% autoescape off %}
|
{% load i18n %}{% blocktrans %}Your account {{ user }} has just expired{% endblocktrans %}
|
||||||
لقد انتهت صلاحية حسابك {{ user }} للتو.
|
|
||||||
---------------------
|
|
||||||
Your account {{ user }} has just expired.
|
|
||||||
{% endautoescape %}
|
|
||||||
@ -1,20 +1,11 @@
|
|||||||
{% load i18n %}{% autoescape off %}
|
{% load i18n %}{% autoescape off %}
|
||||||
مرحباً {% firstof user.get_full_name user.username %}،
|
{% trans "Hi" %} {% firstof user.get_full_name user.username %},
|
||||||
|
|
||||||
تم تمديد صلاحية حسابك للتو لمدة {{ pricing.period }} يوم. خطتك الحالية هي {{plan.name}} وستنتهي في {{userplan.expire}}.
|
{% blocktrans with days=pricing.period plan_name=plan.name expire=userplan.expire %}Your account has just been extended by {{ days }} days. Your current plan is {{ plan_name }} and it will expire on {{ expire }}. {% endblocktrans %}
|
||||||
|
|
||||||
سيتم إرسال فاتورة في رسالة بريد إلكتروني أخرى، في حال تم تقديم بيانات الفوترة.
|
{% trans "An invoice will be sent with another e-mail, if billing data was provided." %}
|
||||||
شكراً لك
|
|
||||||
|
{% trans "Thank you" %}
|
||||||
--
|
--
|
||||||
فريق تنحل
|
{% blocktrans %}The Team at {{ site_name }}{% endblocktrans %}
|
||||||
---------------------
|
|
||||||
Hi {% firstof user.get_full_name user.username %},
|
|
||||||
|
|
||||||
Your account has just been extended by {{ pricing.period }} days. Your current plan is {{plan.name}} and it will expire on {{userplan.expire}}.
|
|
||||||
|
|
||||||
An invoice will be sent with another e-mail, if billing data was provided.
|
|
||||||
|
|
||||||
Thank you
|
|
||||||
--
|
|
||||||
The Team at Tenhal
|
|
||||||
{% endautoescape %}
|
{% endautoescape %}
|
||||||
@ -1,14 +1 @@
|
|||||||
{% load i18n %}
|
{% load i18n %}{% blocktrans with user=user days=pricing.period %}Your account {{ user }} has been extended by {{ days }} days{% endblocktrans %}
|
||||||
{% autoescape off %}
|
|
||||||
مرحباً {% firstof user.get_full_name user.username %}،
|
|
||||||
تم تمديد حسابك {{ user }} لمدة {{ pricing.period }} يوم
|
|
||||||
شكراً لك
|
|
||||||
--
|
|
||||||
فريق تنحل
|
|
||||||
--------
|
|
||||||
Hi {% firstof user.get_full_name user.username %},
|
|
||||||
Your account {{ user }} has been extended by {{ pricing.period }} days
|
|
||||||
Thank you
|
|
||||||
--
|
|
||||||
The Team at Tenhal
|
|
||||||
{% endautoescape %}
|
|
||||||
@ -1,21 +1,14 @@
|
|||||||
{% load i18n %}{% autoescape off %}
|
{% load i18n %}{% autoescape off %}
|
||||||
مرحباً {% firstof user.get_full_name user.username %}،
|
{% trans "Hi" %} {% firstof user.get_full_name user.username %},
|
||||||
نكتب إليك لإعلامك، أنه قد تم إصدار {{ invoice_type }} رقم {{ invoice_number }}. يمكنك الاطلاع عليها وطباعتها عبر الرابط:
|
|
||||||
|
{% blocktrans %}We are writing to inform you, that {{ invoice_type }} {{ invoice_number }} has been issued. You can view it and print it at:
|
||||||
http://{{ site_domain }}{{ url }}
|
http://{{ site_domain }}{{ url }}
|
||||||
يمكنك الاطلاع على تفاصيل الطلب عبر الرابط:
|
{% endblocktrans %}
|
||||||
|
|
||||||
|
{% trans "Details of the order can be see on:" %}:
|
||||||
http://{{ site_domain }}{% url 'order' pk=order %}
|
http://{{ site_domain }}{% url 'order' pk=order %}
|
||||||
|
|
||||||
شكراً لك
|
{% trans "Thank you" %}
|
||||||
--
|
--
|
||||||
فريق تنحل
|
{% blocktrans %}The Team at {{ site_name }}{% endblocktrans %}
|
||||||
---------------------
|
|
||||||
Hi {% firstof user.get_full_name user.username %},
|
|
||||||
We are writing to inform you, that {{ invoice_type }} {{ invoice_number }} has been issued. You can view it and print it at:
|
|
||||||
http://{{ site_domain }}{{ url }}
|
|
||||||
Details of the order can be see on:
|
|
||||||
http://{{ site_domain }}{% url 'order' pk=order %}
|
|
||||||
|
|
||||||
Thank you
|
|
||||||
--
|
|
||||||
The Team at Tenhal
|
|
||||||
{% endautoescape %}
|
{% endautoescape %}
|
||||||
@ -1,3 +1 @@
|
|||||||
{% load i18n %}
|
{% load i18n %}{% trans 'Order' %} {{ order }} - {% blocktrans with invoice_type=invoice_type invoice_number=invoice_number user=user %}{{ invoice_type }} {{ invoice_number }} has been issued for {{ user }}{% endblocktrans %}
|
||||||
Order {{ order }} - {{ invoice_type }} {{ invoice_number }} has been issued for {{ user }}
|
|
||||||
تم إصدار {{ invoice_type }} {{ invoice_number }} للأمر {{ order }} باسم {{ user }}
|
|
||||||
@ -1,29 +1,10 @@
|
|||||||
{% load i18n %}{% autoescape off %}
|
{% load i18n %}{% autoescape off %}
|
||||||
Hi {% firstof user.get_full_name user.username %},
|
{% trans "Hi" %} {% firstof user.get_full_name user.username %},
|
||||||
|
|
||||||
Your account will expire in {{ days }} days.
|
{% blocktrans %}Your account will expire in {{ days }} days.{% endblocktrans %}
|
||||||
|
|
||||||
You can extend your current plan {{ userplan.plan.name }} on page:
|
{% blocktrans with plan_name=userplan.plan.name %}You can extend your current plan {{ plan_name }} on page:{% endblocktrans %}
|
||||||
http://{{ site_domain }}{% url 'current_plan' %}
|
http://{{ site_domain }}{% url 'current_plan' %}
|
||||||
|
|
||||||
or you can upgrade your plan here:
|
{% blocktrans %}or you can upgrade your plan here:{% endblocktrans %}
|
||||||
http://{{ site_domain }}{% url 'upgrade_plan' %}
|
http://{{ site_domain }}{% url 'upgrade_plan' %}
|
||||||
|
|
||||||
Thank you
|
|
||||||
--
|
|
||||||
The Team at Tenhal
|
|
||||||
----------------
|
|
||||||
مرحباً {% firstof full_name username %}،
|
|
||||||
|
|
||||||
سينتهي حسابك في غضون {{ days }} يوم.
|
|
||||||
|
|
||||||
يمكنك تمديد خطتك الحالية {{ userplan.plan.name }} على الصفحة التالية:
|
|
||||||
http://{{ site_domain }}{% url 'current_plan' %}
|
|
||||||
|
|
||||||
أو يمكنك ترقية خطتك هنا:
|
|
||||||
http://{{ site_domain }}{% url 'upgrade_plan' %}
|
|
||||||
|
|
||||||
شكراً لك
|
|
||||||
--
|
|
||||||
فريق تنحل
|
|
||||||
{% endautoescape %}
|
|
||||||
|
|||||||
@ -1,3 +1 @@
|
|||||||
{% load i18n %}
|
{% load i18n %}{% blocktrans count days as days %}Your account {{ user }} will expire in {{ days }} day{% plural %}Your account {{ user }} will expire in {{ days }} days{% endblocktrans %}
|
||||||
Your account {{ user }} will expire in {{ days }} day.
|
|
||||||
سينتهي حسابك {{ user }} في غضون {{ days }} يوم.
|
|
||||||
Loading…
x
Reference in New Issue
Block a user