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

@@ -14,6 +14,9 @@ class CreateOrderRequestSerializer(serializers.Serializer):
# قیمت رو کنترل می‌کنه، نه ما).
provider = serializers.ChoiceField(choices=['gateway', 'bazaar'], required=False, default='gateway')
bazaarProductSku = serializers.CharField(required=False, allow_blank=True)
# بسته‌ی سوال (subscription.Plan با kind='pack'): بدونِ این، سفارشِ بسته بی‌plan_id ساخته می‌شد و
# پرداختش هیچ اعتباری نمی‌داد (بازبینیِ ۲۰۲۶-۱۰-۰۲).
planId = serializers.CharField(required=False, allow_null=True, allow_blank=True)
class BazaarVerifyRequestSerializer(serializers.Serializer):