admin: cancel a pending order, refund a paid one

There was no way to take an order back: staff could only edit the
status by hand, and turning 'paid' into 'failed' left the credits,
heart days or subscription days the order had given. Two OrderAdmin
actions now do it:
- cancel a pending order (a payment that does arrive later still counts);
- refund a paid order, after a confirmation page: takes back the pack's
  unspent credits (never below zero), its heart days, or the plan's
  subscription days, and undoes the referrer's commission.
The money itself is returned in the Zarinpal / Bazaar panel; the action
says so. Status is read-only in the order form. Steps in
docs/operations.md.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-02 22:37:30 +03:30
parent 4700ccbf91
commit d7d168e82f
10 changed files with 401 additions and 4 deletions

View File

@@ -0,0 +1,18 @@
# Generated by Django 5.2.17 on 2026-10-02 19:02
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('subscription', '0010_seed_question_packs'),
]
operations = [
migrations.AlterField(
model_name='questioncredit',
name='reason',
field=models.CharField(choices=[('purchase', 'خرید'), ('question', 'سوال'), ('grant', 'هدیه\u200cی ادمین'), ('refund', 'بازپرداخت')], max_length=10),
),
]