feat: consume money projected event amounts

This commit is contained in:
2026-08-25 22:30:08 +03:00
parent d10e1dd182
commit 1fd9a3a861
7 changed files with 25 additions and 29 deletions
@@ -41,12 +41,12 @@ describe("useBrokerageEvents", () => {
{ {
type: "dividend", type: "dividend",
date: "2026-09-01", date: "2026-09-01",
dateKind: "declared", dateKind: "registry",
instrumentId: "figi-1", figi: "figi-1",
instrumentUid: null,
ticker: "SBER", ticker: "SBER",
displayName: "Сбер", displayName: "Сбер",
amount: "12.34", projectedAmount: { currency: "RUB", value: "12.34" },
currency: "RUB",
}, },
], ],
}), }),
@@ -62,12 +62,12 @@ describe("useBrokerageEvents", () => {
{ {
type: "dividend", type: "dividend",
date: "2026-09-01", date: "2026-09-01",
dateKind: "declared", dateKind: "registry",
instrumentId: "figi-1", figi: "figi-1",
instrumentUid: null,
ticker: "SBER", ticker: "SBER",
displayName: "Сбер", displayName: "Сбер",
amount: "12.34", projectedAmount: { currency: "RUB", value: "12.34" },
currency: "RUB",
}, },
]); ]);
}); });
@@ -42,24 +42,22 @@ describe("AccountEventsPage", () => {
calculatedAt: "2026-08-14T00:00:00Z", calculatedAt: "2026-08-14T00:00:00Z",
events: [ events: [
{ {
amount: "1250",
currency: "RUB",
date: "2026-08-20", date: "2026-08-20",
dateKind: "event", dateKind: "event",
displayName: "ОФЗ 26238", displayName: "ОФЗ 26238",
figi: "FIGI", figi: "FIGI",
instrumentUid: "UID", instrumentUid: "UID",
projectedAmount: { currency: "RUB", value: "1250" },
ticker: "OFZ", ticker: "OFZ",
type: "coupon", type: "coupon",
}, },
{ {
amount: null,
currency: null,
date: "2026-08-25", date: "2026-08-25",
dateKind: "event", dateKind: "event",
displayName: "ОФЗ 26238", displayName: "ОФЗ 26238",
figi: "FIGI", figi: "FIGI",
instrumentUid: "UID", instrumentUid: "UID",
projectedAmount: null,
ticker: "OFZ", ticker: "OFZ",
type: "offer", type: "offer",
}, },
@@ -104,8 +104,8 @@ const AccountEventRow: FC<AccountEventRowProps> = (props) => {
</Stack> </Stack>
<Stack gap={2} align="flex-end"> <Stack gap={2} align="flex-end">
<Text fw={700}> <Text fw={700}>
{event.amount && event.currency {event.projectedAmount
? formatMoney({ currency: event.currency, value: event.amount }) ? formatMoney(event.projectedAmount)
: t("events.noAmount")} : t("events.noAmount")}
</Text> </Text>
<Text c="dimmed" size="sm"> <Text c="dimmed" size="sm">
+1 -2
View File
@@ -119,8 +119,7 @@ function mockLoadedAccountPage() {
instrumentUid: null, instrumentUid: null,
ticker: `BND${index}`, ticker: `BND${index}`,
displayName: `Купон ${index}`, displayName: `Купон ${index}`,
currency: "RUB", projectedAmount: { currency: "RUB", value: String(index + 1) },
amount: String(index + 1),
})), })),
}), }),
), ),
@@ -54,8 +54,8 @@ const RecentEvent: FC<RecentEventProps> = (props) => {
<Paper className={classes.cash} withBorder> <Paper className={classes.cash} withBorder>
<Text>{`${t(`events.type.${event.type}`)} · ${event.displayName}`}</Text> <Text>{`${t(`events.type.${event.type}`)} · ${event.displayName}`}</Text>
<Text fw={700}> <Text fw={700}>
{event.amount && event.currency {event.projectedAmount
? formatMoney({ currency: event.currency, value: event.amount }) ? formatMoney(event.projectedAmount)
: t("events.noAmount")} : t("events.noAmount")}
</Text> </Text>
</Paper> </Paper>
+1 -2
View File
@@ -274,8 +274,7 @@ export interface components {
instrumentUid: string | null; instrumentUid: string | null;
ticker: string; ticker: string;
displayName: string; displayName: string;
currency: string | null; projectedAmount: components["schemas"]["MoneyDto"] | null;
amount: string | null;
}; };
UpcomingEventsDto: { UpcomingEventsDto: {
accountId: string; accountId: string;
+9 -9
View File
@@ -1437,13 +1437,14 @@
"displayName": { "displayName": {
"type": "string" "type": "string"
}, },
"currency": { "projectedAmount": {
"type": "string", "nullable": true,
"nullable": true "type": "object",
}, "allOf": [
"amount": { {
"type": "string", "$ref": "#/components/schemas/MoneyDto"
"nullable": true }
]
} }
}, },
"required": [ "required": [
@@ -1454,8 +1455,7 @@
"instrumentUid", "instrumentUid",
"ticker", "ticker",
"displayName", "displayName",
"currency", "projectedAmount"
"amount"
] ]
}, },
"UpcomingEventsDto": { "UpcomingEventsDto": {