Add referral bonus configuration and enhance payment processing logic
- Introduced a new environment variable REFERRAL_ONE_BONUS_PER_REFEREE to control referral bonus application. - Updated referral bonus application logic to skip bonuses for users with active subscriptions at the time of payment. - Enhanced payment processing functions across multiple services to include current payment ID and skip logic for active users. - Added a new database method to count succeeded payments for users, improving referral bonus eligibility checks.
This commit is contained in:
@@ -157,7 +157,12 @@ class TributeService:
|
||||
provider="tribute",
|
||||
)
|
||||
referral_bonus = await referral_service.apply_referral_bonuses_for_payment(
|
||||
session, int(user_id), months)
|
||||
session,
|
||||
int(user_id),
|
||||
months,
|
||||
current_payment_db_id=payment_record.payment_id,
|
||||
skip_if_active_before_payment=True,
|
||||
)
|
||||
await session.commit()
|
||||
|
||||
db_user = await user_dal.get_user_by_id(session, int(user_id))
|
||||
|
||||
Reference in New Issue
Block a user