Question packs removed at the root; all subscriptions 4 assistant questions a day; Bazaar is subscription-only

- subscription.0017/0018, payment.0013: pack plans deleted, QuestionCredit/HeartsPass models and Plan.kind /
  question_credits / hearts_days / Order.question_credits / hearts_days dropped. The only paid pack order was the
  company owner's test account (user 26).
- Assistant: no credit spending; quota is the daily cap only (free 2, every plan 4, gift subscription 4).
- Bazaar: verify_purchase is subscription-only (no inapp guess), start/purchase responses lose productType,
  verify refuses an order without a subscription. A paid order with no subscription now logs ERROR.
- Removed POST /api/payment/orders (internal; no caller). Its permission tests stay.
- Pack-based tests rewritten on subscriptions (refund, security, Bazaar token); pack-only test files deleted.
- docs: profit table for 4/day on both payment routes plus free users; handbook, operations, CLAUDE.md current.
949 tests green.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-12 20:33:38 +03:30
parent 9c3adc3e60
commit 947f946909
39 changed files with 398 additions and 1174 deletions

View File

@@ -504,10 +504,10 @@ class YearlyPlanSeedTests(TestCase):
from django.core.cache import cache
cache.clear()
data = self.client.get('/api/subscription/plans').json()
# subscription.0016: بسته‌ها فروشی نیستند؛ قیمت‌ها همان پیشخانِ بازار؛ سقفِ دستیار ۵/۳/۳.
self.assertEqual({p['kind'] for p in data['plans']}, {'subscription'})
# subscription.0016/0017: فقط اشتراک؛ قیمت‌ها همان پیشخانِ بازار؛ سقفِ دستیار ۴ برای همه.
self.assertEqual([(p['durationDays'], p['price'], p['aiDailyQuota'], p['bazaarSku']) for p in data['plans']],
[(30, 598_000, 5, '10342'), (90, 898_000, 3, '10343'), (180, 1_398_000, 3, '10344')])
[(30, 598_000, 4, '10342'), (90, 898_000, 4, '10343'), (180, 1_398_000, 4, '10344')])
self.assertNotIn('kind', data['plans'][0])
self.assertTrue(all(p['features'] for p in data['plans']))
self.assertEqual(data['freeAiDailyQuota'], 2)
# پلن‌های اشتراکی پاک نشده‌اند؛ فقط فروخته نمی‌شوند.
@@ -535,7 +535,7 @@ class PlanCacheInvalidationTests(TestCase):
def test_admin_price_change_shows_up_immediately(self):
from django.core.cache import cache
cache.clear()
plan = Plan.objects.create(title='بسته‌ی آزمایشی', price=45000, kind='pack', question_credits=7)
plan = Plan.objects.create(title='اشتراکِ آزمایشی', price=45000, duration_days=30)
client = APIClient()
def price():