fix(promo): Improve error handling for promo code application

- Enhanced the logic for determining the response to users when a promo code application fails, ensuring clearer messaging based on the type of error encountered.
- Introduced specific error messages for cases where the promo code is not found or not applicable as a discount, improving user experience and clarity.
This commit is contained in:
kavore
2026-02-02 23:55:04 +03:00
parent 5bb8f2add0
commit 4b5908d6cc
+10 -1
View File
@@ -193,7 +193,16 @@ async def process_promo_code_input(message: types.Message, state: FSMContext,
f"Promo code '{code_input}' application failed for user {user.id}. "
f"Bonus reason: {result}. Discount reason: {result_discount}"
)
response_to_user_text = result_discount # Prefer the discount attempt error
bonus_not_found_text = _(
"promo_code_not_found", code=code_input.upper()
)
discount_not_found_text = _(
"promo_code_not_found_or_not_discount", code=code_input.upper()
)
if result != bonus_not_found_text and result_discount == discount_not_found_text:
response_to_user_text = result
else:
response_to_user_text = result_discount # Prefer the discount attempt error
reply_markup = get_back_to_main_menu_markup(
current_lang, i18n
)