feat(billing): add percentage discount coupons
Admins can create coupon codes that discount specific services (app runtimes, optional services, managed products, custom-domain addon, or all) and restrict them to specific users or make them public, with total and per-user usage caps and an active date window. Coupons apply in deploy, renewal, and upgrade flows: cost-breakdown lines are tagged with a service key, the eligible portion is discounted and capped to the payable amount, the invoice records discountAmount/ discountCode, and the redemption is recorded once when the invoice is fully paid (covering wallet, gateway, and mixed payments). - Discount + DiscountRedemption entities; invoice discount columns - DiscountService (CRUD, validation, redemption) + admin/validate API - Idempotent schema bootstrap on init so production (synchronize off) provisions the tables/columns without a migration runner - Admin discounts UI, coupon entry in deploy/renewal, invoice discount line - fa/en strings; discount.service unit spec Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -654,6 +654,7 @@ const fa = {
|
||||
},
|
||||
title: 'فاکتورها',
|
||||
subtitle: 'ببین هر پرداخت بابت چه بوده و فاکتورهای باز را پرداخت کن.',
|
||||
subtotal: 'جمع جزء',
|
||||
walletBalance: 'موجودی کیفپول',
|
||||
toman: 'تومان',
|
||||
filterAll: 'همه',
|
||||
@@ -1101,6 +1102,69 @@ const fa = {
|
||||
saveFailedShort: 'ذخیره ناموفق بود',
|
||||
hours: 'ساعت',
|
||||
days: 'روز',
|
||||
discounts: {
|
||||
title: 'کدهای تخفیف',
|
||||
subtitle: 'تخفیف درصدی روی سرویسهای مختلف؛ عمومی یا مخصوص کاربران خاص.',
|
||||
add: 'کد تخفیف جدید',
|
||||
empty: 'هنوز کد تخفیفی تعریف نشده',
|
||||
edit: 'ویرایش',
|
||||
delete: 'حذف',
|
||||
deleteConfirm: 'این کد تخفیف حذف شود؟',
|
||||
code: 'کد',
|
||||
codePlaceholder: 'NOWRUZ1403',
|
||||
name: 'عنوان',
|
||||
namePlaceholder: 'تخفیف نوروزی',
|
||||
description: 'توضیحات',
|
||||
percentOff: 'درصد تخفیف',
|
||||
scope: 'سرویسهای مشمول',
|
||||
allServices: 'همهٔ سرویسها',
|
||||
selectServices: 'انتخاب سرویسهای خاص',
|
||||
audience: 'کاربران مشمول',
|
||||
public: 'عمومی (همهٔ کاربران)',
|
||||
restricted: 'کاربران مشخص',
|
||||
searchUsers: 'جستوجوی کاربر بر اساس نام یا ایمیل…',
|
||||
noUsersSelected: 'هنوز کاربری انتخاب نشده',
|
||||
limits: 'محدودیتها',
|
||||
maxUses: 'سقف کل استفاده',
|
||||
maxUsesPerUser: 'سقف هر کاربر',
|
||||
unlimited: 'نامحدود',
|
||||
startsAt: 'تاریخ شروع',
|
||||
endsAt: 'تاریخ پایان',
|
||||
active: 'فعال',
|
||||
inactive: 'غیرفعال',
|
||||
used: 'استفادهشده',
|
||||
save: 'ذخیره',
|
||||
saving: 'در حال ذخیره…',
|
||||
cancel: 'انصراف',
|
||||
saved: 'کد تخفیف ذخیره شد',
|
||||
deleted: 'کد تخفیف حذف شد',
|
||||
saveFailed: 'ذخیرهٔ کد تخفیف ناموفق بود',
|
||||
groups: {
|
||||
runtime: 'رانتایم اپلیکیشن',
|
||||
optional: 'سرویسهای جانبی',
|
||||
managed: 'سرویسهای مدیریتشده',
|
||||
addon: 'افزونهها',
|
||||
},
|
||||
coupon: {
|
||||
label: 'کد تخفیف',
|
||||
placeholder: 'کد تخفیف را وارد کنید',
|
||||
apply: 'اعمال',
|
||||
checking: 'در حال بررسی…',
|
||||
applied: 'کد تخفیف اعمال شد',
|
||||
remove: 'حذف کد',
|
||||
discountLine: 'تخفیف',
|
||||
},
|
||||
reasons: {
|
||||
not_found: 'کد تخفیف نامعتبر است',
|
||||
inactive: 'این کد تخفیف غیرفعال است',
|
||||
not_started: 'این کد هنوز فعال نشده است',
|
||||
expired: 'این کد منقضی شده است',
|
||||
max_uses_reached: 'ظرفیت استفاده از این کد تمام شده است',
|
||||
max_uses_per_user_reached: 'سقف استفادهٔ شما از این کد پر شده است',
|
||||
not_eligible_user: 'این کد برای حساب شما قابل استفاده نیست',
|
||||
no_eligible_services: 'این کد روی سرویسهای انتخابی شما تخفیف ندارد',
|
||||
},
|
||||
},
|
||||
},
|
||||
servicesNew: {
|
||||
steps: ['نوع سرویس', 'پیکربندی', 'بررسی و پرداخت'],
|
||||
|
||||
Reference in New Issue
Block a user