feat(promo): Enhance promo code functionality and discount consumption logic
- Integrated promo code service into subscription service to streamline discount consumption during payment processing. - Improved error handling and logging for promo code activation and usage increment. - Updated payment services to handle discount calculations more robustly, including fallback mechanisms for invalid discount scenarios. - Added new methods for managing promo code activations and usage in the database layer.
This commit is contained in:
@@ -190,9 +190,10 @@ async def process_promo_code_input(message: types.Message, state: FSMContext,
|
||||
# Both failed
|
||||
await session.rollback()
|
||||
logging.info(
|
||||
f"Promo code '{code_input}' application failed for user {user.id}. Reason: {result}"
|
||||
f"Promo code '{code_input}' application failed for user {user.id}. "
|
||||
f"Bonus reason: {result}. Discount reason: {result_discount}"
|
||||
)
|
||||
response_to_user_text = result # Original error message from bonus code attempt
|
||||
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