e746b3c9a4
Closes Audit #3 P2 batch (knip dead exports/components, DemoSeeder hygiene, schema header drift). - Remove app/resources/js/views/admin/AdminPlaceholderView.vue (unreferenced placeholder view — confirmed via repo-wide grep, only doc references remain) - npm uninstall concurrently (no script invoked it; --legacy-peer-deps for Histoire 1.0-beta.1 peerDep quirk) - 12 unused exports → internal types (remove `export` keyword): - api/admin.ts: AdminTenantsStats, ApiTenantMetrics, ApiAdminBillingSummary, ApiAdminIncidentsSummary - api/notifications.ts: NotificationEvent - api/reports.ts: ApiReportType, ApiReportFormat, ApiReportParameters, ReportCounts, ReportQuota - composables/mockBilling.ts: TxType - composables/useStatusPill.ts: StatusPillSlug All 12 are used INSIDE their own file (response shapes), just not exported externally — converting to internal types satisfies knip without losing type-checking inside the file. - DatabaseSeeder::run() — DemoSeeder runs only in local+testing envs (`migrate:fresh --seed` in dev now produces demo tenant + admin@demo.local + 3 projects + ~14 demo deals; prod environments skip) - db/schema.sql header line 4: «62 базовые таблицы» → «63 базовые таблицы (61 regular + 2 partitioned parents: deals + supplier_lead_costs)» Closes schema header drift finding from Phase 3. Verification: - vue-tsc --noEmit: 0 errors - ESLint on touched files: 0 errors - Pest --parallel: 742/739/3sk/0 failed (identical to baseline, no regressions) - 2243 assertions / 34.46s Plan: docs/superpowers/plans/2026-05-14-audit3-deferred-fixes.md Task 2. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
176 lines
5.0 KiB
TypeScript
176 lines
5.0 KiB
TypeScript
/**
|
||
* Mock-данные для BillingView. Заменятся на API-fetch:
|
||
* GET /api/billing/wallet — баланс ₽ + леды + tariff.
|
||
* GET /api/billing/transactions?type={all|topup|charge|refund} — `balance_transactions`.
|
||
* GET /api/billing/invoices — `invoices` table (счета + УПД).
|
||
*
|
||
* Mock-структуры соответствуют схеме v8.7:
|
||
* - balance_transactions (§4.4): type ∈ {topup, lead_charge, refund, tariff_charge, manager_addon}.
|
||
* - invoices (§4.5): type ∈ {invoice, upd}, format ∈ {pdf, xml_1c83}.
|
||
*/
|
||
|
||
type TxType = 'topup' | 'lead_charge' | 'refund' | 'tariff_charge';
|
||
export type TxStatus = 'pending' | 'completed' | 'rejected';
|
||
|
||
export interface BillingTransaction {
|
||
id: number;
|
||
code: string; // 'TX-89421'
|
||
when: string; // '07.05 · 14:21'
|
||
type: TxType;
|
||
description: string;
|
||
status: TxStatus;
|
||
amount: number; // signed (+ topup/refund, − charge)
|
||
}
|
||
|
||
export const MOCK_TRANSACTIONS: BillingTransaction[] = [
|
||
{
|
||
id: 89421,
|
||
code: 'TX-89421',
|
||
when: '07.05 · 14:21',
|
||
type: 'topup',
|
||
description: 'Пополнение через ЮKassa',
|
||
status: 'pending',
|
||
amount: 5000,
|
||
},
|
||
{
|
||
id: 89384,
|
||
code: 'TX-89384',
|
||
when: '07.05 · 11:14',
|
||
type: 'lead_charge',
|
||
description: 'Списание · 3 лида проект «Окна Москва»',
|
||
status: 'completed',
|
||
amount: -6600,
|
||
},
|
||
{
|
||
id: 89370,
|
||
code: 'TX-89370',
|
||
when: '07.05 · 09:48',
|
||
type: 'refund',
|
||
description: 'Возврат лида #1018 · дубликат',
|
||
status: 'completed',
|
||
amount: 2200,
|
||
},
|
||
{
|
||
id: 89312,
|
||
code: 'TX-89312',
|
||
when: '06.05 · 22:06',
|
||
type: 'topup',
|
||
description: 'Пополнение через ЮKassa',
|
||
status: 'completed',
|
||
amount: 10000,
|
||
},
|
||
{
|
||
id: 89286,
|
||
code: 'TX-89286',
|
||
when: '06.05 · 18:32',
|
||
type: 'lead_charge',
|
||
description: 'Списание · 5 лидов проект «Натяжные потолки»',
|
||
status: 'completed',
|
||
amount: -9250,
|
||
},
|
||
{
|
||
id: 89108,
|
||
code: 'TX-89108',
|
||
when: '05.05 · 12:00',
|
||
type: 'tariff_charge',
|
||
description: 'Списание абонентской платы тарифа «Команда»',
|
||
status: 'completed',
|
||
amount: -990,
|
||
},
|
||
{
|
||
id: 88937,
|
||
code: 'TX-88937',
|
||
when: '04.05 · 16:42',
|
||
type: 'topup',
|
||
description: 'Попытка пополнения через банковский перевод',
|
||
status: 'rejected',
|
||
amount: 0,
|
||
},
|
||
{
|
||
id: 88714,
|
||
code: 'TX-88714',
|
||
when: '03.05 · 09:18',
|
||
type: 'refund',
|
||
description: 'Возврат лида #998 · спам',
|
||
status: 'completed',
|
||
amount: 1850,
|
||
},
|
||
];
|
||
|
||
export interface BillingTab {
|
||
id: 'all' | 'topup' | 'lead_charge' | 'refund';
|
||
label: string;
|
||
types: TxType[] | null;
|
||
}
|
||
|
||
export const BILLING_TABS: BillingTab[] = [
|
||
{ id: 'all', label: 'Все', types: null },
|
||
{ id: 'topup', label: 'Пополнения', types: ['topup'] },
|
||
{ id: 'lead_charge', label: 'Списания', types: ['lead_charge', 'tariff_charge'] },
|
||
{ id: 'refund', label: 'Возвраты', types: ['refund'] },
|
||
];
|
||
|
||
export type InvoiceFormat = 'pdf' | 'xml_1c83';
|
||
|
||
export interface Invoice {
|
||
id: number;
|
||
when: string; // '07.05.2026'
|
||
title: string; // 'Счёт № 2026-0512'
|
||
sub: string; // 'Тариф «Команда» · май 2026'
|
||
amountRub: number;
|
||
format: InvoiceFormat;
|
||
}
|
||
|
||
export const MOCK_INVOICES: Invoice[] = [
|
||
{
|
||
id: 1,
|
||
when: '07.05.2026',
|
||
title: 'Счёт № 2026-0512',
|
||
sub: 'Тариф «Команда» · май 2026',
|
||
amountRub: 990,
|
||
format: 'pdf',
|
||
},
|
||
{
|
||
id: 2,
|
||
when: '06.05.2026',
|
||
title: 'УПД № УПД-2026-0492',
|
||
sub: 'Списания за апрель · 18 лидов',
|
||
amountRub: 29850,
|
||
format: 'xml_1c83',
|
||
},
|
||
{
|
||
id: 3,
|
||
when: '05.05.2026',
|
||
title: 'УПД № УПД-2026-0488',
|
||
sub: 'Списания за март · 24 лида',
|
||
amountRub: 38100,
|
||
format: 'xml_1c83',
|
||
},
|
||
{
|
||
id: 4,
|
||
when: '01.04.2026',
|
||
title: 'Счёт № 2026-0498',
|
||
sub: 'Тариф «Команда» · апрель 2026',
|
||
amountRub: 990,
|
||
format: 'pdf',
|
||
},
|
||
];
|
||
|
||
export interface PendingPayment {
|
||
code: string;
|
||
amount: number;
|
||
method: string; // 'ЮKassa'
|
||
startedAt: string; // '14:21'
|
||
autoCancelAt: string; // '14:51'
|
||
timeoutMinutes: number;
|
||
}
|
||
|
||
export const MOCK_PENDING: PendingPayment | null = {
|
||
code: 'TX-89421',
|
||
amount: 5000,
|
||
method: 'ЮKassa',
|
||
startedAt: '14:21',
|
||
autoCancelAt: '14:51',
|
||
timeoutMinutes: 30,
|
||
};
|