Payment event ledger (PaymentEvent) replicated to the backup server, plus CSV export script on 247
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -115,3 +115,28 @@ class BazaarCredential(models.Model):
|
||||
|
||||
def __str__(self):
|
||||
return 'متصل' if self.refresh_token else 'متصل نیست'
|
||||
|
||||
|
||||
class PaymentEvent(models.Model):
|
||||
"""
|
||||
دفترِ رویدادهای مسیرِ خرید (ساخت سفارش، رفتن به درگاه، بازگشت از درگاه، نتیجهی verify،
|
||||
لغو/بازپرداخت). فقط افزودنی است و هیچ منطقی بر آن تکیه ندارد.
|
||||
|
||||
چرا جدول و نه فایلِ لاگ: دیتابیس لحظهای به سرورِ بکاپِ ۲۴۷ میرود (WAL)، پس این ردیفها
|
||||
بیهیچ کانال و دسترسیِ تازه همانجا هم میرسند؛ فایلِ خوانا از روی همان نسخه ساخته میشود
|
||||
(`ops/pgbackup/export-payment-events.sh`). `StatusChangeLog` فقط تغییرِ وضعیت را نگه میدارد؛
|
||||
«کاربر رفت به درگاه ولی برنگشت» در آن نیست و اینجا هست.
|
||||
در `detail` هیچ توکنِ خرید یا کلیدی نمیرود؛ authority فقط ۶۴ نویسهی اول.
|
||||
"""
|
||||
order_id = models.IntegerField(null=True, blank=True, db_index=True) # ارجاع سبک به Order؛ بیسفارش هم میشود
|
||||
user_id = models.IntegerField(null=True, blank=True, db_index=True)
|
||||
provider = models.CharField(max_length=20, blank=True)
|
||||
event = models.CharField(max_length=40, db_index=True)
|
||||
detail = models.JSONField(default=dict, blank=True)
|
||||
created_at = models.DateTimeField(auto_now_add=True, db_index=True)
|
||||
|
||||
class Meta:
|
||||
ordering = ['-created_at']
|
||||
|
||||
def __str__(self):
|
||||
return f'order {self.order_id}: {self.event}'
|
||||
|
||||
Reference in New Issue
Block a user