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

@@ -18,7 +18,6 @@ from rest_framework.test import APIClient
from accounts.authentication import issue_access_token
from accounts.models import User
from progress.models import UserHearts
from subscription.models import HeartsPass
from .models import Choice, Grade, Lesson, Node, Question, Unit, UserAnswer
@@ -100,14 +99,6 @@ class HeartsGateTests(_World, TestCase):
self.assertEqual(self.answer(self.questions[1], correct=False).json()['heartsRemaining'], 0)
self.assertEqual(self.finish_island().status_code, 200)
def test_unlimited_hearts_from_a_pack_are_never_blocked(self):
self.hearts(0)
HeartsPass.objects.create(user_id=self.user.id, expires_at=timezone.now() + timedelta(days=7))
# جزیره دو سوال دارد و پایان بی‌جواب پذیرفته نمی‌شود؛ قلبِ نامحدود هر دو جواب را می‌گیرد.
for question in self.questions:
self.assertEqual(self.answer(question, correct=False).status_code, 200)
self.assertEqual(self.finish_island().status_code, 200)
def test_after_the_wait_a_heart_comes_back_and_play_continues(self):
self.hearts(0, next_in=timedelta(seconds=-1))
response = self.answer(self.questions[0], correct=True)

View File

@@ -62,9 +62,9 @@ class PaywallTests(TestCase):
def test_status_reports_plan_title_and_quota(self):
from subscription.models import Plan
plan = Plan.objects.get(kind='subscription', on_sale=True, duration_days=90)
plan = Plan.objects.get(on_sale=True, duration_days=90)
Subscription.objects.create(user_id=self.user.id, plan=plan, status='active',
expires_at=timezone.now() + timezone.timedelta(days=10))
body = self.client.get('/api/subscription/status').json()
self.assertEqual((body['active'], body['planTitle'], body['planDurationDays'], body['aiDailyQuota']),
(True, 'سه‌ماهه', 90, 3))
(True, 'سه‌ماهه', 90, 4))