add payment_link and banks
This commit is contained in:
1 parent
2ae79b1ca4
commit
de3135b588
100 files changed
+6167
-47
No files matched your search
@@ -0,0 +1,42 @@
|
||||
"""Deposit identifier algorithm copied from repository alghortim_shenase.py.
|
||||
|
||||
The input is the customer local mobile number, retaining its leading zero.
|
||||
This is a deterministic identifier, not a random or unique-per-notice value.
|
||||
"""
|
||||
|
||||
def generate_id_algorithm(id_code: str) -> str:
|
||||
"""
|
||||
Calculates the verification code based on the reverse-engineered logic:
|
||||
1. Iterate digits from right to left (index i = 0, 1, 2...).
|
||||
2. Weights:
|
||||
- If i < 8: Weight = 8 - i (Sequence: 8, 7, 6, 5, 4, 3, 2, 1)
|
||||
- If i >= 8: Weight = i + 1 (Sequence: 9, 10, ...)
|
||||
3. Sum = Sum(Digit * Weight)
|
||||
4. Check Digit = Sum % 99
|
||||
"""
|
||||
# تمیزکاری ورودی (حذف فاصلهها و اطمینان از عددی بودن)
|
||||
if not id_code.isdigit():
|
||||
return "Error: ورودی باید فقط عدد باشد."
|
||||
|
||||
total_sum = 0
|
||||
|
||||
# پیمایش از راست به چپ
|
||||
# reversed(id_code) ارقام را برعکس میکند
|
||||
for i, char in enumerate(reversed(id_code)):
|
||||
digit = int(char)
|
||||
|
||||
# تعیین وزن بر اساس ایندکس (مکان رقم از راست)
|
||||
if i < 8:
|
||||
weight = 8 - i
|
||||
else:
|
||||
weight = i + 1
|
||||
|
||||
total_sum += digit * weight
|
||||
|
||||
# محاسبه باقیمانده بر 99
|
||||
check_digit = total_sum % 99
|
||||
|
||||
# فرمتدهی دو رقمی (مثلاً 6 میشود 06)
|
||||
check_digit_str = f"{check_digit:02}"
|
||||
|
||||
return f"{id_code}{check_digit_str}"
|
||||
Reference in new issue
Block a user