Payment providers as classes (Strategy + factory); 10342 = monthly; health logs a failed Bazaar check
- payment/providers.py: ZarinpalProvider / BazaarProvider with one interface (check_plan, sku_for, payment_url, purchase_extras, discount_blocker, reconcile_user); provider_for / provider_for_method pick one; unknown fails. create_order, purchase view, discount redeem and reconcile_user_orders use it instead of scattered ifs. - subscription.0015: Bazaar SKU 10342 on the one-month plan (owner: "probably the monthly one"). - config/health: the Bazaar check no longer swallows its exception without a log. 982 tests green. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -41,8 +41,10 @@ def has_subscription_access(user_id: int) -> bool:
|
||||
"""
|
||||
if has_active_subscription(user_id):
|
||||
return True
|
||||
from payment.services import sync_bazaar_renewals
|
||||
return bool(sync_bazaar_renewals(user_id)) and has_active_subscription(user_id)
|
||||
# فقط بازار، نه همهی روشها: بازسنجیِ زرینپال در این مسیرِ پرترافیک برای هر بیاشتراکی با سفارشِ نیمهکاره
|
||||
# یک فراخوانیِ شبکه میشد؛ آن را صفحهی وضعیت و کالبک میکنند.
|
||||
from payment.providers import provider_for
|
||||
return bool(provider_for('bazaar').reconcile_user(user_id)) and has_active_subscription(user_id)
|
||||
|
||||
|
||||
def hearts_pass_until(user_id: int):
|
||||
|
||||
Reference in New Issue
Block a user