bazaar: a pack bought through Bazaar now gives its credits; verify reports the real order status

Bazaar orders are only created through POST /api/payment/orders, which
took no planId, so a pack order had plan_id=None: Bazaar verified the
purchase, the order became paid, and grant_pack never ran. The endpoint
now takes planId (rejected when unknown) and snapshots the plan title.
The verify response also returned the pre-payment status ('pending')
because apply_order_payment_result updates its own copy of the order.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-02 13:04:41 +03:30
parent 5fb9f4aaa0
commit fe658c697a
4 changed files with 88 additions and 1 deletions

View File

@@ -3,6 +3,7 @@
نسخه‌ی کامل برای مدیرعامل (جدول و نمودار، HTML و PDF):
`~/Desktop/گزارشات Tadrisino/گزارش-۲۶/`. این فایل خلاصه‌ی فنیِ همان است و
می‌گوید عددها از کجا آمده‌اند و چطور دوباره اندازه گرفته می‌شوند.
قیمتِ هر توکن و تاریخچه‌ی قیمت‌ها در `docs/model-prices.md` است.
## هزینه‌ی هر سوال (مهرِ ۱۴۰۵، پرامپتِ `tutor-v11-math-only`؛ از `tutor-v12-age-tone` لحن برای ۱۸+ بزرگسالانه است، `gpt-4.1-mini`)
@@ -64,7 +65,8 @@ Message.objects.filter(role='assistant', created_at__gte=since).values('conversa
- اپ موجودی را از `GET /api/ai/quota` می‌خواند و بعد از هر جواب از `remainingQuota` و `credits`ِ خودِ
جواب. صفحه‌ی خرید `GET /api/subscription/status` (`questionCredits`، `unlimitedHeartsUntil`) را می‌خواند.
- **کافه‌بازار:** هر بسته باید در پنلِ بازار «محصولِ مصرفی» تعریف شود و اپِ اندروید بعد از تأیید
consume کند. این هنوز انجام نشده است.
consume کند. این هنوز انجام نشده است. سفارشِ بازارِ یک بسته باید با `planId` ساخته شود
(`POST /api/payment/orders`)؛ تا ۲۰۲۶-۱۰-۰۲ این فیلد وجود نداشت و پرداختِ بسته از بازار هیچ اعتباری نمی‌داد.
## محافظِ دستیار (`rag/services/guardrails.py`)