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:
@@ -193,6 +193,15 @@ 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}"
|
||||
)
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user