email chnages reverted

This commit is contained in:
Faheedkhan 2025-08-06 13:14:49 +03:00
parent e6e2ed0150
commit 0ea27d0826
11 changed files with 58 additions and 125 deletions

View File

@ -9456,10 +9456,12 @@ def submit_plan(request, dealer_slug):
tax=15,
status=1,
)
logger.info(f"order created {order}")
except Exception as e:
print(e)
logger.error(e)
if not order:
messages.error(request, _("Error creating order"))
logger.error("unable to create order")
return redirect("pricing_page", dealer_slug=dealer_slug)
transaction_url = handle_payment(request, order)
return redirect(transaction_url)
@ -9473,9 +9475,13 @@ def payment_callback(request, dealer_slug):
payment_id = request.GET.get("id")
history = models.PaymentHistory.objects.filter(transaction_id=payment_id).first()
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
print(order)
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(
user=dealer.user,
defaults={
@ -9487,12 +9493,20 @@ def payment_callback(request, dealer_slug):
'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'):
UserPlan.objects.create(
user=order.user,
plan=order.plan,
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:
@ -9510,7 +9524,7 @@ def payment_callback(request, dealer_slug):
order.complete_order()
history.status = "paid"
history.save()
logger.info(f"Order {order.id} for user {order.user} completed successfully. Payment history updated.")
invoice = order.get_invoices().first()
return render(
request,
@ -9519,12 +9533,14 @@ def payment_callback(request, dealer_slug):
)
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)}")
history.status = "failed"
history.save()
return render(request, "payment_failed.html", {"message": "Plan activation error"})
elif payment_status == "failed":
logger.warning(f"Payment failed for transaction ID {payment_id}. Message: {message}")
history.status = "failed"
history.save()
return render(request, "payment_failed.html", {"message": message})

View File

@ -1,25 +1,13 @@
{% load i18n %}{% autoescape off %}
مرحباً {% firstof user.get_full_name user.username %}،
{% trans "Hi" %} {% firstof user.get_full_name user.username %},
{% 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 %}
خطتك الحالية هي {{ plan.name }}.
{% blocktrans with plan_name=plan.name %}Your current plan is {{ plan_name }}. {% endblocktrans %}
{% endif %}
شكراً لك،
فريق تنحل
---------------------
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 %}
{% trans "Thank you" %}
--
{% blocktrans %}The Team at {{ site_name }}{% endblocktrans %}
{% endautoescape %}

View File

@ -1,3 +1 @@
{% load i18n %}
Your account {{ user }} has new plan {{ plan }}
حسابك {{ user }} لديه خطة جديدة {{ plan }}
{% load i18n %}{% blocktrans with user=user plan=plan.name %}Your account {{ user }} has new plan {{ plan }}{% endblocktrans %}

View File

@ -1,27 +1,14 @@
{% 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' %}
أو يمكنك ترقية خطتك من هنا:
{% blocktrans %}or you can upgrade your plan here:{% endblocktrans %}
http://{{ site_domain }}{% url 'upgrade_plan' %}
شكراً لك،
{% trans "Thank you" %}
--
فريق تنحل
---------------------
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 %}
{% blocktrans %}The Team at {{ site_name }}{% endblocktrans %}
{% endautoescape %}

View File

@ -1,5 +1 @@
{% load i18n %}{% autoescape off %}
لقد انتهت صلاحية حسابك {{ user }} للتو.
---------------------
Your account {{ user }} has just expired.
{% endautoescape %}
{% load i18n %}{% blocktrans %}Your account {{ user }} has just expired{% endblocktrans %}

View File

@ -1,20 +1,11 @@
{% 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" %}
--
فريق تنحل
---------------------
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 %}
{% blocktrans %}The Team at {{ site_name }}{% endblocktrans %}
{% endautoescape %}

View File

@ -1,14 +1 @@
{% load i18n %}
{% 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 %}
{% load i18n %}{% blocktrans with user=user days=pricing.period %}Your account {{ user }} has been extended by {{ days }} days{% endblocktrans %}

View File

@ -1,21 +1,14 @@
{% load i18n %}{% autoescape off %}
مرحباً {% firstof user.get_full_name user.username %}،
نكتب إليك لإعلامك، أنه قد تم إصدار {{ invoice_type }} رقم {{ invoice_number }}. يمكنك الاطلاع عليها وطباعتها عبر الرابط:
{% trans "Hi" %} {% firstof user.get_full_name user.username %},
{% 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 }}
يمكنك الاطلاع على تفاصيل الطلب عبر الرابط:
{% endblocktrans %}
{% trans "Details of the order can be see on:" %}:
http://{{ site_domain }}{% url 'order' pk=order %}
شكراً لك
{% trans "Thank you" %}
--
فريق تنحل
---------------------
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 %}
{% blocktrans %}The Team at {{ site_name }}{% endblocktrans %}
{% endautoescape %}

View File

@ -1,3 +1 @@
{% load i18n %}
Order {{ order }} - {{ invoice_type }} {{ invoice_number }} has been issued for {{ user }}
تم إصدار {{ invoice_type }} {{ invoice_number }} للأمر {{ order }} باسم {{ user }}
{% 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 %}

View File

@ -1,29 +1,10 @@
{% 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' %}
or you can upgrade your plan here:
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 %}
{% blocktrans %}or you can upgrade your plan here:{% endblocktrans %}
http://{{ site_domain }}{% url 'upgrade_plan' %}

View File

@ -1,3 +1 @@
{% load i18n %}
Your account {{ user }} will expire in {{ days }} day.
سينتهي حسابك {{ user }} في غضون {{ days }} يوم.
{% 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 %}