fix fish variz name, dalilrad, sms, bale
This commit is contained in:
1 parent
90931a5a64
commit
35a1ec1794
30 files changed
+674
-39
No files matched your search
@@ -0,0 +1,28 @@
|
||||
"""Customer identity and the payer recorded on each receipt are independent."""
|
||||
from django.core.exceptions import ValidationError
|
||||
from apps.core.persian_text import normalize_persian_text
|
||||
|
||||
|
||||
def customer_name(customer):
|
||||
profile = getattr(customer, 'customer_profile', None)
|
||||
name = f'{profile.first_name} {profile.last_name}'.strip() if profile else ''
|
||||
return normalize_persian_text(name or customer.get_full_name())
|
||||
|
||||
|
||||
def depositor_name(value):
|
||||
name = normalize_persian_text(value)
|
||||
if not name.replace('\u200c', '').replace('\u200b', '').strip():
|
||||
raise ValidationError('نام واریزکننده را وارد کنید.')
|
||||
if len(name) > 150:
|
||||
raise ValidationError('نام واریزکننده باید حداکثر ۱۵۰ کاراکتر باشد.')
|
||||
return name
|
||||
|
||||
|
||||
def receipt_identity(customer, payer):
|
||||
name = customer_name(customer)
|
||||
payer = normalize_persian_text(payer)
|
||||
if not name:
|
||||
return payer or 'نام ثبت نشده'
|
||||
if not payer or name == payer:
|
||||
return name
|
||||
return f'{name} (واریزکننده: {payer})'
|
||||
Reference in new issue
Block a user