Bariki cashback, order edit, and current work in progress

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
zabudko-ruandClaude Opus 5.5 committed 2026-10-25 22:57:03 +04:00
1 parent dda917fc71
commit 45477fb018
94 files changed
+10955 -650

No files matched your search

+6 -4
View File
@@ -1,5 +1,5 @@
import { afterAll, beforeEach, describe, expect, it } from 'vitest';
import { encodeStartPayload } from '@barev/core';
import { addMonths, encodeStartPayload } from '@barev/core';
import {
applyAgencyCode,
assignmentCandidates,
@@ -95,7 +95,7 @@ describe('онбординг (ONB-1…6)', () => {
expect(client.user.locale).toBe('hy');
const gift = await giveConsent(ctx, start.clientId);
expect(gift?.endsAt.getTime()).toBe(NOW.getTime() + 30 * 24 * 3600_000);
expect(gift?.endsAt.getTime()).toBe(addMonths(NOW, 1).getTime());
expect(events).toContainEqual(expect.objectContaining({ type: 'gift.activated' }));
expect(await db.subscription.count({ where: { clientId: start.clientId, source: 'AGENCY_GIFT' } })).toBe(1);
});
@@ -388,9 +388,11 @@ describe('выплаты клинеру по пресету', () => {
expect(orderPayout(full, maria)).toBe(9000 + 2500 + 1500 + 2000);
// без пресета — индивидуальная ставка 70% от итога
expect(orderPayout(full, { ...maria, payoutPreset: null })).toBe(Math.floor(full.totalPrice * 0.7));
// сотрудник компании — ставка компании
// сотрудник партнёра «как Uber» — ему платит партнёр, от нас 0
const lusine = await db.provider.findUniqueOrThrow({ where: { id: fx.lusine.id }, include: { company: true, payoutPreset: true } });
expect(orderPayout(full, lusine)).toBe(Math.floor(full.totalPrice * 0.65));
expect(orderPayout(full, lusine)).toBe(0);
// «расходы наши» — ФОТ клинера, % от оплаченного
expect(orderPayout(full, { ...lusine, company: { deal: 'PROFIT_SHARE', fotPct: 40 } })).toBe(Math.floor(full.totalPrice * 0.4));
});
});