feat(frontend): Add comprehensive bank account management system.

- Add drawer-based bank account connection flow with country/bank selection
- Create bank connection success page with redirect handling
- Add bank connections status card showing all requisitions and their states
- Move account management actions to appropriate sections (add to connections, edit in accounts)
- Implement proper delete functionality for bank connections via GoCardless API
- Add proper TypeScript types for all bank-related data structures
- Improve error handling for bank connection operations with specific HTTP status codes
- Remove transaction data when disconnecting accounts while preserving history

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Elisiário Couto
2025-09-25 11:31:15 +01:00
parent dc3522220a
commit ef7c026db9
24 changed files with 785 additions and 195 deletions

View File

@@ -2,9 +2,9 @@ name: CI
on:
push:
branches: [ "main", "dev" ]
branches: ["main", "dev"]
pull_request:
branches: [ "main", "dev" ]
branches: ["main", "dev"]
jobs:
test-python:
@@ -43,8 +43,8 @@ jobs:
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
node-version: "20"
cache: "npm"
cache-dependency-path: frontend/package-lock.json
- name: Install dependencies

View File

@@ -2,16 +2,11 @@
"mcpServers": {
"shadcn": {
"command": "npx",
"args": [
"shadcn@latest",
"mcp"
]
"args": ["shadcn@latest", "mcp"]
},
"playwright": {
"command": "npx",
"args": [
"@playwright/mcp@latest"
]
"args": ["@playwright/mcp@latest"]
}
}
}

View File

@@ -202,8 +202,12 @@ export default function AccountSettings() {
alt={`${account.institution_id} logo`}
className="w-full h-full object-contain"
onError={() => {
console.warn(`Failed to load bank logo for ${account.institution_id}: ${account.logo}`);
setFailedImages(prev => new Set([...prev, account.id]));
console.warn(
`Failed to load bank logo for ${account.institution_id}: ${account.logo}`,
);
setFailedImages(
(prev) => new Set([...prev, account.id]),
);
}}
/>
) : (

View File

@@ -0,0 +1,203 @@
import { useState } from "react";
import { useQuery, useMutation } from "@tanstack/react-query";
import { Plus, Building2, ExternalLink } from "lucide-react";
import { apiClient } from "../lib/api";
import { Button } from "./ui/button";
import { Label } from "./ui/label";
import {
Drawer,
DrawerClose,
DrawerContent,
DrawerDescription,
DrawerFooter,
DrawerHeader,
DrawerTitle,
DrawerTrigger,
} from "./ui/drawer";
import {
Select,
SelectContent,
SelectItem,
SelectTrigger,
SelectValue,
} from "./ui/select";
import { Alert, AlertDescription } from "./ui/alert";
export default function AddBankAccountDrawer() {
const [open, setOpen] = useState(false);
const [selectedCountry, setSelectedCountry] = useState<string>("");
const [selectedBank, setSelectedBank] = useState<string>("");
const { data: countries } = useQuery({
queryKey: ["supportedCountries"],
queryFn: apiClient.getSupportedCountries,
});
const { data: banks, isLoading: banksLoading } = useQuery({
queryKey: ["bankInstitutions", selectedCountry],
queryFn: () => apiClient.getBankInstitutions(selectedCountry),
enabled: !!selectedCountry,
});
const connectBankMutation = useMutation({
mutationFn: (institutionId: string) =>
apiClient.createBankConnection(institutionId),
onSuccess: (data) => {
// Redirect to the bank's authorization link
if (data.link) {
window.open(data.link, "_blank");
setOpen(false);
}
},
onError: (error) => {
console.error("Failed to create bank connection:", error);
},
});
const handleCountryChange = (country: string) => {
setSelectedCountry(country);
setSelectedBank("");
};
const handleConnect = () => {
if (selectedBank) {
connectBankMutation.mutate(selectedBank);
}
};
const resetForm = () => {
setSelectedCountry("");
setSelectedBank("");
};
return (
<Drawer
open={open}
onOpenChange={(isOpen) => {
setOpen(isOpen);
if (!isOpen) {
resetForm();
}
}}
>
<DrawerTrigger asChild>
<Button size="sm">
<Plus className="h-4 w-4 mr-2" />
Add New Account
</Button>
</DrawerTrigger>
<DrawerContent className="max-h-[80vh]">
<DrawerHeader>
<DrawerTitle>Connect Bank Account</DrawerTitle>
<DrawerDescription>
Select your country and bank to connect your account to Leggen
</DrawerDescription>
</DrawerHeader>
<div className="px-6 space-y-6 overflow-y-auto">
{/* Country Selection */}
<div className="space-y-2">
<Label htmlFor="country">Country</Label>
<Select value={selectedCountry} onValueChange={handleCountryChange}>
<SelectTrigger>
<SelectValue placeholder="Select your country" />
</SelectTrigger>
<SelectContent>
{countries?.map((country) => (
<SelectItem key={country.code} value={country.code}>
{country.name}
</SelectItem>
))}
</SelectContent>
</Select>
</div>
{/* Bank Selection */}
{selectedCountry && (
<div className="space-y-2">
<Label htmlFor="bank">Bank</Label>
{banksLoading ? (
<div className="p-4 text-center text-muted-foreground">
Loading banks...
</div>
) : banks && banks.length > 0 ? (
<Select value={selectedBank} onValueChange={setSelectedBank}>
<SelectTrigger>
<SelectValue placeholder="Select your bank" />
</SelectTrigger>
<SelectContent>
{banks.map((bank) => (
<SelectItem key={bank.id} value={bank.id}>
<div className="flex items-center space-x-2">
{bank.logo ? (
<img
src={bank.logo}
alt={`${bank.name} logo`}
className="w-4 h-4 object-contain"
/>
) : (
<Building2 className="w-4 h-4" />
)}
<span>{bank.name}</span>
</div>
</SelectItem>
))}
</SelectContent>
</Select>
) : (
<Alert>
<AlertDescription>
No banks available for the selected country.
</AlertDescription>
</Alert>
)}
</div>
)}
{/* Instructions */}
{selectedBank && (
<Alert>
<AlertDescription>
You'll be redirected to your bank's website to authorize the
connection. After approval, you'll return to Leggen and your
account will start syncing.
</AlertDescription>
</Alert>
)}
{/* Error Display */}
{connectBankMutation.isError && (
<Alert variant="destructive">
<AlertDescription>
Failed to create bank connection. Please try again.
</AlertDescription>
</Alert>
)}
</div>
<DrawerFooter>
<div className="flex space-x-2">
<Button
onClick={handleConnect}
disabled={!selectedBank || connectBankMutation.isPending}
className="flex-1"
>
<ExternalLink className="h-4 w-4 mr-2" />
{connectBankMutation.isPending
? "Connecting..."
: "Open Bank Authorization"}
</Button>
<DrawerClose asChild>
<Button
variant="outline"
disabled={connectBankMutation.isPending}
>
Cancel
</Button>
</DrawerClose>
</div>
</DrawerFooter>
</DrawerContent>
</Drawer>
);
}

View File

@@ -47,7 +47,10 @@ export default function DiscordConfigDrawer({
apiClient.updateNotificationSettings({
...settings,
discord: discordConfig,
filters: settings?.filters || { case_insensitive: [], case_sensitive: [] },
filters: settings?.filters || {
case_insensitive: [],
case_sensitive: [],
},
}),
onSuccess: () => {
queryClient.invalidateQueries({ queryKey: ["notificationSettings"] });
@@ -60,10 +63,12 @@ export default function DiscordConfigDrawer({
});
const testMutation = useMutation({
mutationFn: () => apiClient.testNotification({
service: "discord",
message: "Test notification from Leggen - Discord configuration is working!"
}),
mutationFn: () =>
apiClient.testNotification({
service: "discord",
message:
"Test notification from Leggen - Discord configuration is working!",
}),
onSuccess: () => {
console.log("Test Discord notification sent successfully");
},
@@ -81,13 +86,13 @@ export default function DiscordConfigDrawer({
testMutation.mutate();
};
const isConfigValid = config.webhook.trim().length > 0 && config.webhook.includes('discord.com/api/webhooks');
const isConfigValid =
config.webhook.trim().length > 0 &&
config.webhook.includes("discord.com/api/webhooks");
return (
<Drawer open={open} onOpenChange={setOpen}>
<DrawerTrigger asChild>
{trigger || <EditButton />}
</DrawerTrigger>
<DrawerTrigger asChild>{trigger || <EditButton />}</DrawerTrigger>
<DrawerContent>
<div className="mx-auto w-full max-w-md">
<DrawerHeader>
@@ -103,7 +108,9 @@ export default function DiscordConfigDrawer({
<form onSubmit={handleSubmit} className="p-4 space-y-6">
{/* Enable/Disable Toggle */}
<div className="flex items-center justify-between">
<Label className="text-base font-medium">Enable Discord Notifications</Label>
<Label className="text-base font-medium">
Enable Discord Notifications
</Label>
<Switch
checked={config.enabled}
onCheckedChange={(enabled) => setConfig({ ...config, enabled })}
@@ -118,11 +125,14 @@ export default function DiscordConfigDrawer({
type="url"
placeholder="https://discord.com/api/webhooks/..."
value={config.webhook}
onChange={(e) => setConfig({ ...config, webhook: e.target.value })}
onChange={(e) =>
setConfig({ ...config, webhook: e.target.value })
}
disabled={!config.enabled}
/>
<p className="text-xs text-muted-foreground">
Create a webhook in your Discord server settings under Integrations Webhooks
Create a webhook in your Discord server settings under
Integrations Webhooks
</p>
</div>
@@ -130,9 +140,13 @@ export default function DiscordConfigDrawer({
{config.enabled && (
<div className="p-3 bg-muted rounded-md">
<div className="flex items-center space-x-2">
<div className={`w-2 h-2 rounded-full ${isConfigValid ? 'bg-green-500' : 'bg-red-500'}`} />
<div
className={`w-2 h-2 rounded-full ${isConfigValid ? "bg-green-500" : "bg-red-500"}`}
/>
<span className="text-sm font-medium">
{isConfigValid ? 'Configuration Valid' : 'Invalid Webhook URL'}
{isConfigValid
? "Configuration Valid"
: "Invalid Webhook URL"}
</span>
</div>
{!isConfigValid && config.webhook.trim().length > 0 && (
@@ -145,8 +159,13 @@ export default function DiscordConfigDrawer({
<DrawerFooter className="px-0">
<div className="flex space-x-2">
<Button type="submit" disabled={updateMutation.isPending || !config.enabled}>
{updateMutation.isPending ? "Saving..." : "Save Configuration"}
<Button
type="submit"
disabled={updateMutation.isPending || !config.enabled}
>
{updateMutation.isPending
? "Saving..."
: "Save Configuration"}
</Button>
{config.enabled && isConfigValid && (
<Button

View File

@@ -67,20 +67,32 @@ export default function NotificationFiltersDrawer({
};
const addCaseInsensitiveFilter = () => {
if (newCaseInsensitive.trim() && !filters.case_insensitive.includes(newCaseInsensitive.trim())) {
if (
newCaseInsensitive.trim() &&
!filters.case_insensitive.includes(newCaseInsensitive.trim())
) {
setFilters({
...filters,
case_insensitive: [...filters.case_insensitive, newCaseInsensitive.trim()],
case_insensitive: [
...filters.case_insensitive,
newCaseInsensitive.trim(),
],
});
setNewCaseInsensitive("");
}
};
const addCaseSensitiveFilter = () => {
if (newCaseSensitive.trim() && !filters.case_sensitive?.includes(newCaseSensitive.trim())) {
if (
newCaseSensitive.trim() &&
!filters.case_sensitive?.includes(newCaseSensitive.trim())
) {
setFilters({
...filters,
case_sensitive: [...(filters.case_sensitive || []), newCaseSensitive.trim()],
case_sensitive: [
...(filters.case_sensitive || []),
newCaseSensitive.trim(),
],
});
setNewCaseSensitive("");
}
@@ -96,30 +108,33 @@ export default function NotificationFiltersDrawer({
const removeCaseSensitiveFilter = (index: number) => {
setFilters({
...filters,
case_sensitive: filters.case_sensitive?.filter((_, i) => i !== index) || [],
case_sensitive:
filters.case_sensitive?.filter((_, i) => i !== index) || [],
});
};
return (
<Drawer open={open} onOpenChange={setOpen}>
<DrawerTrigger asChild>
{trigger || <EditButton />}
</DrawerTrigger>
<DrawerTrigger asChild>{trigger || <EditButton />}</DrawerTrigger>
<DrawerContent>
<div className="mx-auto w-full max-w-2xl">
<DrawerHeader>
<DrawerTitle>Notification Filters</DrawerTitle>
<DrawerDescription>
Configure which transaction descriptions should trigger notifications
Configure which transaction descriptions should trigger
notifications
</DrawerDescription>
</DrawerHeader>
<form onSubmit={handleSubmit} className="p-4 space-y-6">
{/* Case Insensitive Filters */}
<div className="space-y-3">
<Label className="text-base font-medium">Case Insensitive Filters</Label>
<Label className="text-base font-medium">
Case Insensitive Filters
</Label>
<p className="text-sm text-muted-foreground">
Filters that match regardless of capitalization (e.g., "AMAZON" matches "amazon")
Filters that match regardless of capitalization (e.g., "AMAZON"
matches "amazon")
</p>
<div className="flex space-x-2">
@@ -134,7 +149,11 @@ export default function NotificationFiltersDrawer({
}
}}
/>
<Button type="button" onClick={addCaseInsensitiveFilter} size="sm">
<Button
type="button"
onClick={addCaseInsensitiveFilter}
size="sm"
>
<Plus className="h-4 w-4" />
</Button>
</div>
@@ -157,16 +176,21 @@ export default function NotificationFiltersDrawer({
</div>
))
) : (
<span className="text-muted-foreground text-sm">No filters added</span>
<span className="text-muted-foreground text-sm">
No filters added
</span>
)}
</div>
</div>
{/* Case Sensitive Filters */}
<div className="space-y-3">
<Label className="text-base font-medium">Case Sensitive Filters</Label>
<Label className="text-base font-medium">
Case Sensitive Filters
</Label>
<p className="text-sm text-muted-foreground">
Filters that match exactly as typed (e.g., "AMAZON" only matches "AMAZON")
Filters that match exactly as typed (e.g., "AMAZON" only matches
"AMAZON")
</p>
<div className="flex space-x-2">
@@ -181,7 +205,11 @@ export default function NotificationFiltersDrawer({
}
}}
/>
<Button type="button" onClick={addCaseSensitiveFilter} size="sm">
<Button
type="button"
onClick={addCaseSensitiveFilter}
size="sm"
>
<Plus className="h-4 w-4" />
</Button>
</div>
@@ -204,7 +232,9 @@ export default function NotificationFiltersDrawer({
</div>
))
) : (
<span className="text-muted-foreground text-sm">No filters added</span>
<span className="text-muted-foreground text-sm">
No filters added
</span>
)}
</div>
</div>

View File

@@ -10,7 +10,6 @@ import {
Edit2,
Check,
X,
Plus,
Bell,
MessageSquare,
Send,
@@ -35,6 +34,7 @@ import AccountsSkeleton from "./AccountsSkeleton";
import NotificationFiltersDrawer from "./NotificationFiltersDrawer";
import DiscordConfigDrawer from "./DiscordConfigDrawer";
import TelegramConfigDrawer from "./TelegramConfigDrawer";
import AddBankAccountDrawer from "./AddBankAccountDrawer";
import type {
Account,
Balance,
@@ -120,6 +120,11 @@ export default function Settings() {
queryFn: apiClient.getNotificationServices,
});
const { data: bankConnections } = useQuery({
queryKey: ["bankConnections"],
queryFn: apiClient.getBankConnectionsStatus,
});
// Account mutations
const updateAccountMutation = useMutation({
mutationFn: ({ id, display_name }: { id: string; display_name: string }) =>
@@ -143,6 +148,16 @@ export default function Settings() {
},
});
// Bank connection mutations
const deleteBankConnectionMutation = useMutation({
mutationFn: apiClient.deleteBankConnection,
onSuccess: () => {
queryClient.invalidateQueries({ queryKey: ["accounts"] });
queryClient.invalidateQueries({ queryKey: ["bankConnections"] });
queryClient.invalidateQueries({ queryKey: ["balances"] });
},
});
// Account handlers
const handleEditStart = (account: Account) => {
setEditingAccountId(account.id);
@@ -245,13 +260,6 @@ export default function Settings() {
<p className="text-muted-foreground mb-4">
Connect your first bank account to get started with Leggen.
</p>
<Button disabled className="flex items-center space-x-2">
<Plus className="h-4 w-4" />
<span>Add Bank Account</span>
</Button>
<p className="text-xs text-muted-foreground mt-2">
Coming soon: Add new bank connections
</p>
</CardContent>
) : (
<CardContent className="p-0">
@@ -288,8 +296,12 @@ export default function Settings() {
alt={`${account.institution_id} logo`}
className="w-6 h-6 sm:w-8 sm:h-8 object-contain"
onError={() => {
console.warn(`Failed to load bank logo for ${account.institution_id}: ${account.logo}`);
setFailedImages(prev => new Set([...prev, account.id]));
console.warn(
`Failed to load bank logo for ${account.institution_id}: ${account.logo}`,
);
setFailedImages(
(prev) => new Set([...prev, account.id]),
);
}}
/>
) : (
@@ -417,30 +429,110 @@ export default function Settings() {
)}
</Card>
{/* Add Bank Section (Future Feature) */}
{/* Bank Connections Status */}
<Card>
<CardHeader>
<CardTitle>Add New Bank Account</CardTitle>
<CardDescription>
Connect additional bank accounts to track all your finances in
one place
</CardDescription>
</CardHeader>
<CardContent className="p-6">
<div className="text-center space-y-4">
<div className="p-4 bg-muted rounded-lg">
<Plus className="h-8 w-8 text-muted-foreground mx-auto mb-2" />
<p className="text-sm text-muted-foreground">
Bank connection functionality is coming soon. Stay tuned for
updates!
</p>
<div className="flex items-center justify-between">
<div>
<CardTitle>Bank Connections</CardTitle>
<CardDescription>
Status of all bank connection requests and their
authorization state
</CardDescription>
</div>
<Button disabled variant="outline">
<Plus className="h-4 w-4 mr-2" />
Connect Bank Account
</Button>
<AddBankAccountDrawer />
</div>
</CardContent>
</CardHeader>
{!bankConnections || bankConnections.length === 0 ? (
<CardContent className="p-6 text-center">
<Building2 className="h-12 w-12 text-muted-foreground mx-auto mb-4" />
<h3 className="text-lg font-medium text-foreground mb-2">
No bank connections found
</h3>
<p className="text-muted-foreground">
Bank connection requests will appear here after you connect
accounts.
</p>
</CardContent>
) : (
<CardContent className="p-0">
<div className="divide-y divide-border">
{bankConnections.map((connection) => {
const statusColor =
connection.status.toLowerCase() === "ln"
? "bg-green-500"
: connection.status.toLowerCase() === "cr"
? "bg-amber-500"
: connection.status.toLowerCase() === "ex"
? "bg-red-500"
: "bg-muted-foreground";
return (
<div
key={connection.requisition_id}
className="p-4 sm:p-6 hover:bg-accent transition-colors"
>
<div className="flex items-center justify-between">
<div className="flex items-center space-x-4 min-w-0 flex-1">
<div className="flex-shrink-0 w-10 h-10 rounded-full bg-muted flex items-center justify-center">
<Building2 className="h-5 w-5 text-muted-foreground" />
</div>
<div className="flex-1 min-w-0">
<div className="flex items-center space-x-2">
<h4 className="text-base font-medium text-foreground truncate">
{connection.bank_name}
</h4>
<div
className={`w-3 h-3 rounded-full ${statusColor}`}
title={connection.status_display}
/>
</div>
<p className="text-sm text-muted-foreground">
{connection.status_display} {" "}
{connection.accounts_count} account
{connection.accounts_count !== 1 ? "s" : ""}
</p>
<p className="text-xs text-muted-foreground font-mono">
ID: {connection.requisition_id}
</p>
</div>
</div>
<div className="flex items-center space-x-2 flex-shrink-0">
<div className="text-right">
<p className="text-xs text-muted-foreground">
Created {formatDate(connection.created_at)}
</p>
</div>
<button
onClick={() => {
const isWorking =
connection.status.toLowerCase() === "ln";
const message = isWorking
? `Are you sure you want to disconnect "${connection.bank_name}"? This will stop syncing new transactions but keep your existing transaction history.`
: `Delete connection to ${connection.bank_name}?`;
if (confirm(message)) {
deleteBankConnectionMutation.mutate(
connection.requisition_id,
);
}
}}
disabled={deleteBankConnectionMutation.isPending}
className="p-1 text-muted-foreground hover:text-destructive transition-colors disabled:opacity-50 disabled:cursor-not-allowed"
title="Delete connection"
>
<Trash2 className="h-4 w-4" />
</button>
</div>
</div>
</div>
);
})}
</div>
</CardContent>
)}
</Card>
</TabsContent>
@@ -495,19 +587,21 @@ export default function Settings() {
{service.name}
</h4>
<div className="flex items-center space-x-2">
<div className={`w-2 h-2 rounded-full ${
service.enabled && service.configured
? 'bg-green-500'
: service.enabled
? 'bg-amber-500'
: 'bg-muted-foreground'
}`} />
<div
className={`w-2 h-2 rounded-full ${
service.enabled && service.configured
? "bg-green-500"
: service.enabled
? "bg-amber-500"
: "bg-muted-foreground"
}`}
/>
<span className="text-sm text-muted-foreground">
{service.enabled && service.configured
? 'Active'
? "Active"
: service.enabled
? 'Needs Configuration'
: 'Disabled'}
? "Needs Configuration"
: "Disabled"}
</span>
</div>
</div>
@@ -516,9 +610,15 @@ export default function Settings() {
<div className="flex items-center space-x-2">
{service.name.toLowerCase().includes("discord") ? (
<DiscordConfigDrawer settings={notificationSettings} />
) : service.name.toLowerCase().includes("telegram") ? (
<TelegramConfigDrawer settings={notificationSettings} />
<DiscordConfigDrawer
settings={notificationSettings}
/>
) : service.name
.toLowerCase()
.includes("telegram") ? (
<TelegramConfigDrawer
settings={notificationSettings}
/>
) : null}
<Button
@@ -560,17 +660,22 @@ export default function Settings() {
Case Insensitive Filters
</Label>
<div className="min-h-[2rem] flex flex-wrap gap-1">
{notificationSettings.filters.case_insensitive.length > 0 ? (
notificationSettings.filters.case_insensitive.map((filter, index) => (
<span
key={index}
className="inline-flex items-center px-2 py-1 bg-secondary text-secondary-foreground rounded text-xs"
>
{filter}
</span>
))
{notificationSettings.filters.case_insensitive
.length > 0 ? (
notificationSettings.filters.case_insensitive.map(
(filter, index) => (
<span
key={index}
className="inline-flex items-center px-2 py-1 bg-secondary text-secondary-foreground rounded text-xs"
>
{filter}
</span>
),
)
) : (
<p className="text-sm text-muted-foreground">None</p>
<p className="text-sm text-muted-foreground">
None
</p>
)}
</div>
</div>
@@ -580,25 +685,31 @@ export default function Settings() {
</Label>
<div className="min-h-[2rem] flex flex-wrap gap-1">
{notificationSettings.filters.case_sensitive &&
notificationSettings.filters.case_sensitive.length > 0 ? (
notificationSettings.filters.case_sensitive.map((filter, index) => (
<span
key={index}
className="inline-flex items-center px-2 py-1 bg-secondary text-secondary-foreground rounded text-xs"
>
{filter}
</span>
))
notificationSettings.filters.case_sensitive.length >
0 ? (
notificationSettings.filters.case_sensitive.map(
(filter, index) => (
<span
key={index}
className="inline-flex items-center px-2 py-1 bg-secondary text-secondary-foreground rounded text-xs"
>
{filter}
</span>
),
)
) : (
<p className="text-sm text-muted-foreground">None</p>
<p className="text-sm text-muted-foreground">
None
</p>
)}
</div>
</div>
</div>
</div>
<p className="text-sm text-muted-foreground">
Filters determine which transaction descriptions will trigger notifications.
Add terms to exclude transactions containing those words.
Filters determine which transaction descriptions will
trigger notifications. Add terms to exclude transactions
containing those words.
</p>
</div>
) : (
@@ -608,7 +719,8 @@ export default function Settings() {
No notification filters configured
</h3>
<p className="text-muted-foreground mb-4">
Set up filters to control which transactions trigger notifications.
Set up filters to control which transactions trigger
notifications.
</p>
<NotificationFiltersDrawer settings={notificationSettings} />
</div>

View File

@@ -30,8 +30,6 @@ export function SiteHeader() {
refetchInterval: 30000,
});
return (
<header className="flex h-16 shrink-0 items-center gap-2 border-b transition-[width,height] ease-linear pt-safe-top">
<div className="flex w-full items-center gap-1 px-4 lg:gap-2 lg:px-6">

View File

@@ -210,7 +210,8 @@ export default function System() {
: "Sync Failed"}
</h4>
<Badge variant="outline" className="text-xs">
{operation.trigger_type.charAt(0).toUpperCase() + operation.trigger_type.slice(1)}
{operation.trigger_type.charAt(0).toUpperCase() +
operation.trigger_type.slice(1)}
</Badge>
</div>
<div className="flex items-center space-x-4 mt-1 text-xs text-muted-foreground">
@@ -272,7 +273,8 @@ export default function System() {
: "Sync Failed"}
</h4>
<Badge variant="outline" className="text-xs mt-1">
{operation.trigger_type.charAt(0).toUpperCase() + operation.trigger_type.slice(1)}
{operation.trigger_type.charAt(0).toUpperCase() +
operation.trigger_type.slice(1)}
</Badge>
</div>
</div>
@@ -286,7 +288,9 @@ export default function System() {
{startedAt.toLocaleDateString()}{" "}
{startedAt.toLocaleTimeString()}
</span>
{duration && <span className="ml-2"> {duration}</span>}
{duration && (
<span className="ml-2"> {duration}</span>
)}
</div>
<div className="grid grid-cols-2 gap-2 text-xs">
@@ -296,7 +300,9 @@ export default function System() {
</div>
<div className="flex items-center space-x-1">
<TrendingUp className="h-3 w-3" />
<span>{operation.transactions_added} new transactions</span>
<span>
{operation.transactions_added} new transactions
</span>
</div>
</div>
</div>

View File

@@ -48,7 +48,10 @@ export default function TelegramConfigDrawer({
apiClient.updateNotificationSettings({
...settings,
telegram: telegramConfig,
filters: settings?.filters || { case_insensitive: [], case_sensitive: [] },
filters: settings?.filters || {
case_insensitive: [],
case_sensitive: [],
},
}),
onSuccess: () => {
queryClient.invalidateQueries({ queryKey: ["notificationSettings"] });
@@ -61,10 +64,12 @@ export default function TelegramConfigDrawer({
});
const testMutation = useMutation({
mutationFn: () => apiClient.testNotification({
service: "telegram",
message: "Test notification from Leggen - Telegram configuration is working!"
}),
mutationFn: () =>
apiClient.testNotification({
service: "telegram",
message:
"Test notification from Leggen - Telegram configuration is working!",
}),
onSuccess: () => {
console.log("Test Telegram notification sent successfully");
},
@@ -86,9 +91,7 @@ export default function TelegramConfigDrawer({
return (
<Drawer open={open} onOpenChange={setOpen}>
<DrawerTrigger asChild>
{trigger || <EditButton />}
</DrawerTrigger>
<DrawerTrigger asChild>{trigger || <EditButton />}</DrawerTrigger>
<DrawerContent>
<div className="mx-auto w-full max-w-md">
<DrawerHeader>
@@ -104,7 +107,9 @@ export default function TelegramConfigDrawer({
<form onSubmit={handleSubmit} className="p-4 space-y-6">
{/* Enable/Disable Toggle */}
<div className="flex items-center justify-between">
<Label className="text-base font-medium">Enable Telegram Notifications</Label>
<Label className="text-base font-medium">
Enable Telegram Notifications
</Label>
<Switch
checked={config.enabled}
onCheckedChange={(enabled) => setConfig({ ...config, enabled })}
@@ -119,7 +124,9 @@ export default function TelegramConfigDrawer({
type="password"
placeholder="123456789:ABCdefGHIjklMNOpqrsTUVwxyz"
value={config.token}
onChange={(e) => setConfig({ ...config, token: e.target.value })}
onChange={(e) =>
setConfig({ ...config, token: e.target.value })
}
disabled={!config.enabled}
/>
<p className="text-xs text-muted-foreground">
@@ -135,11 +142,18 @@ export default function TelegramConfigDrawer({
type="number"
placeholder="123456789"
value={config.chat_id || ""}
onChange={(e) => setConfig({ ...config, chat_id: parseInt(e.target.value) || 0 })}
onChange={(e) =>
setConfig({
...config,
chat_id: parseInt(e.target.value) || 0,
})
}
disabled={!config.enabled}
/>
<p className="text-xs text-muted-foreground">
Send a message to your bot and visit https://api.telegram.org/bot&lt;token&gt;/getUpdates to find your chat ID
Send a message to your bot and visit
https://api.telegram.org/bot&lt;token&gt;/getUpdates to find
your chat ID
</p>
</div>
@@ -147,23 +161,33 @@ export default function TelegramConfigDrawer({
{config.enabled && (
<div className="p-3 bg-muted rounded-md">
<div className="flex items-center space-x-2">
<div className={`w-2 h-2 rounded-full ${isConfigValid ? 'bg-green-500' : 'bg-red-500'}`} />
<div
className={`w-2 h-2 rounded-full ${isConfigValid ? "bg-green-500" : "bg-red-500"}`}
/>
<span className="text-sm font-medium">
{isConfigValid ? 'Configuration Valid' : 'Missing Token or Chat ID'}
{isConfigValid
? "Configuration Valid"
: "Missing Token or Chat ID"}
</span>
</div>
{!isConfigValid && (config.token.trim().length > 0 || config.chat_id !== 0) && (
<p className="text-xs text-muted-foreground mt-1">
Both bot token and chat ID are required
</p>
)}
{!isConfigValid &&
(config.token.trim().length > 0 || config.chat_id !== 0) && (
<p className="text-xs text-muted-foreground mt-1">
Both bot token and chat ID are required
</p>
)}
</div>
)}
<DrawerFooter className="px-0">
<div className="flex space-x-2">
<Button type="submit" disabled={updateMutation.isPending || !config.enabled}>
{updateMutation.isPending ? "Saving..." : "Save Configuration"}
<Button
type="submit"
disabled={updateMutation.isPending || !config.enabled}
>
{updateMutation.isPending
? "Saving..."
: "Save Configuration"}
</Button>
{config.enabled && isConfigValid && (
<Button

View File

@@ -15,7 +15,9 @@ export default function TimePeriodFilter({
className = "",
}: TimePeriodFilterProps) {
return (
<div className={`flex flex-col sm:flex-row sm:items-center gap-4 ${className}`}>
<div
className={`flex flex-col sm:flex-row sm:items-center gap-4 ${className}`}
>
<div className="flex items-center gap-2 text-foreground">
<Calendar size={20} />
<span className="font-medium">Time Period:</span>

View File

@@ -1,7 +1,7 @@
import * as React from "react"
import { Drawer as DrawerPrimitive } from "vaul"
import * as React from "react";
import { Drawer as DrawerPrimitive } from "vaul";
import { cn } from "@/lib/utils"
import { cn } from "@/lib/utils";
const Drawer = ({
shouldScaleBackground = true,
@@ -11,14 +11,14 @@ const Drawer = ({
shouldScaleBackground={shouldScaleBackground}
{...props}
/>
)
Drawer.displayName = "Drawer"
);
Drawer.displayName = "Drawer";
const DrawerTrigger = DrawerPrimitive.Trigger
const DrawerTrigger = DrawerPrimitive.Trigger;
const DrawerPortal = DrawerPrimitive.Portal
const DrawerPortal = DrawerPrimitive.Portal;
const DrawerClose = DrawerPrimitive.Close
const DrawerClose = DrawerPrimitive.Close;
const DrawerOverlay = React.forwardRef<
React.ElementRef<typeof DrawerPrimitive.Overlay>,
@@ -29,8 +29,8 @@ const DrawerOverlay = React.forwardRef<
className={cn("fixed inset-0 z-50 bg-black/80", className)}
{...props}
/>
))
DrawerOverlay.displayName = DrawerPrimitive.Overlay.displayName
));
DrawerOverlay.displayName = DrawerPrimitive.Overlay.displayName;
const DrawerContent = React.forwardRef<
React.ElementRef<typeof DrawerPrimitive.Content>,
@@ -42,7 +42,7 @@ const DrawerContent = React.forwardRef<
ref={ref}
className={cn(
"fixed inset-x-0 bottom-0 z-50 mt-24 flex h-auto flex-col rounded-t-[10px] border bg-background",
className
className,
)}
{...props}
>
@@ -50,8 +50,8 @@ const DrawerContent = React.forwardRef<
{children}
</DrawerPrimitive.Content>
</DrawerPortal>
))
DrawerContent.displayName = "DrawerContent"
));
DrawerContent.displayName = "DrawerContent";
const DrawerHeader = ({
className,
@@ -61,8 +61,8 @@ const DrawerHeader = ({
className={cn("grid gap-1.5 p-4 text-center sm:text-left", className)}
{...props}
/>
)
DrawerHeader.displayName = "DrawerHeader"
);
DrawerHeader.displayName = "DrawerHeader";
const DrawerFooter = ({
className,
@@ -72,8 +72,8 @@ const DrawerFooter = ({
className={cn("mt-auto flex flex-col gap-2 p-4", className)}
{...props}
/>
)
DrawerFooter.displayName = "DrawerFooter"
);
DrawerFooter.displayName = "DrawerFooter";
const DrawerTitle = React.forwardRef<
React.ElementRef<typeof DrawerPrimitive.Title>,
@@ -83,12 +83,12 @@ const DrawerTitle = React.forwardRef<
ref={ref}
className={cn(
"text-lg font-semibold leading-none tracking-tight",
className
className,
)}
{...props}
/>
))
DrawerTitle.displayName = DrawerPrimitive.Title.displayName
));
DrawerTitle.displayName = DrawerPrimitive.Title.displayName;
const DrawerDescription = React.forwardRef<
React.ElementRef<typeof DrawerPrimitive.Description>,
@@ -99,8 +99,8 @@ const DrawerDescription = React.forwardRef<
className={cn("text-sm text-muted-foreground", className)}
{...props}
/>
))
DrawerDescription.displayName = DrawerPrimitive.Description.displayName
));
DrawerDescription.displayName = DrawerPrimitive.Description.displayName;
export {
Drawer,
@@ -113,4 +113,4 @@ export {
DrawerFooter,
DrawerTitle,
DrawerDescription,
}
};

View File

@@ -7,7 +7,13 @@ interface EditButtonProps {
disabled?: boolean;
className?: string;
size?: "default" | "sm" | "lg" | "icon";
variant?: "default" | "destructive" | "outline" | "secondary" | "ghost" | "link";
variant?:
| "default"
| "destructive"
| "outline"
| "secondary"
| "ghost"
| "link";
children?: React.ReactNode;
}
@@ -28,7 +34,7 @@ export function EditButton({
variant={variant}
className={cn(
"h-8 px-3 text-muted-foreground hover:text-foreground transition-colors",
className
className,
)}
{...props}
>

View File

@@ -9,7 +9,7 @@ const ScrollArea = React.forwardRef<
ref={ref}
className={cn(
"relative overflow-auto scrollbar-thin scrollbar-thumb-gray-300 scrollbar-track-gray-100",
className
className,
)}
{...props}
>

View File

@@ -1,7 +1,7 @@
import * as React from "react"
import * as SwitchPrimitives from "@radix-ui/react-switch"
import * as React from "react";
import * as SwitchPrimitives from "@radix-ui/react-switch";
import { cn } from "@/lib/utils"
import { cn } from "@/lib/utils";
const Switch = React.forwardRef<
React.ElementRef<typeof SwitchPrimitives.Root>,
@@ -10,18 +10,18 @@ const Switch = React.forwardRef<
<SwitchPrimitives.Root
className={cn(
"peer inline-flex h-5 w-9 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent shadow-sm transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input",
className
className,
)}
{...props}
ref={ref}
>
<SwitchPrimitives.Thumb
className={cn(
"pointer-events-none block h-4 w-4 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-4 data-[state=unchecked]:translate-x-0"
"pointer-events-none block h-4 w-4 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-4 data-[state=unchecked]:translate-x-0",
)}
/>
</SwitchPrimitives.Root>
))
Switch.displayName = SwitchPrimitives.Root.displayName
));
Switch.displayName = SwitchPrimitives.Root.displayName;
export { Switch }
export { Switch };

View File

@@ -15,21 +15,23 @@ export function usePWA(): PWAUpdate {
const forceReload = async (): Promise<void> => {
try {
// Clear all caches
if ('caches' in window) {
if ("caches" in window) {
const cacheNames = await caches.keys();
await Promise.all(
cacheNames.map(cacheName => caches.delete(cacheName))
cacheNames.map((cacheName) => caches.delete(cacheName)),
);
console.log("All caches cleared");
}
// Unregister service worker
if ('serviceWorker' in navigator) {
if ("serviceWorker" in navigator) {
const registrations = await navigator.serviceWorker.getRegistrations();
await Promise.all(registrations.map(registration => registration.unregister()));
await Promise.all(
registrations.map((registration) => registration.unregister()),
);
console.log("All service workers unregistered");
}
// Force reload
window.location.reload();
} catch (error) {

View File

@@ -5,10 +5,7 @@ import { apiClient } from "../lib/api";
const VERSION_STORAGE_KEY = "leggen_app_version";
export function useVersionCheck(forceReload: () => Promise<void>) {
const {
data: healthStatus,
isSuccess: healthSuccess,
} = useQuery({
const { data: healthStatus, isSuccess: healthSuccess } = useQuery({
queryKey: ["health"],
queryFn: apiClient.getHealth,
refetchInterval: 30000,
@@ -20,14 +17,16 @@ export function useVersionCheck(forceReload: () => Promise<void>) {
if (healthSuccess && healthStatus?.version) {
const currentVersion = healthStatus.version;
const storedVersion = localStorage.getItem(VERSION_STORAGE_KEY);
if (storedVersion && storedVersion !== currentVersion) {
console.log(`Version mismatch detected: stored=${storedVersion}, current=${currentVersion}`);
console.log(
`Version mismatch detected: stored=${storedVersion}, current=${currentVersion}`,
);
console.log("Clearing cache and reloading...");
// Update stored version first
localStorage.setItem(VERSION_STORAGE_KEY, currentVersion);
// Force reload to clear cache
forceReload();
} else if (!storedVersion) {
@@ -37,4 +36,4 @@ export function useVersionCheck(forceReload: () => Promise<void>) {
}
}
}, [healthSuccess, healthStatus?.version, forceReload]);
}
}

View File

@@ -13,6 +13,10 @@ import type {
AccountUpdate,
TransactionStats,
SyncOperationsResponse,
BankInstitution,
BankConnectionStatus,
BankRequisition,
Country,
} from "../types/api";
// Use VITE_API_URL for development, relative URLs for production
@@ -168,8 +172,6 @@ export const apiClient = {
return response.data.data;
},
// Analytics endpoints
getTransactionStats: async (days?: number): Promise<TransactionStats> => {
const queryParams = new URLSearchParams();
@@ -231,6 +233,47 @@ export const apiClient = {
);
return response.data.data;
},
// Bank management endpoints
getBankInstitutions: async (country: string): Promise<BankInstitution[]> => {
const response = await api.get<ApiResponse<BankInstitution[]>>(
`/banks/institutions?country=${country}`,
);
return response.data.data;
},
getBankConnectionsStatus: async (): Promise<BankConnectionStatus[]> => {
const response =
await api.get<ApiResponse<BankConnectionStatus[]>>("/banks/status");
return response.data.data;
},
createBankConnection: async (
institutionId: string,
redirectUrl?: string,
): Promise<BankRequisition> => {
// If no redirect URL provided, construct it from current location
const finalRedirectUrl =
redirectUrl || `${window.location.origin}/bank-connected`;
const response = await api.post<ApiResponse<BankRequisition>>(
"/banks/connect",
{
institution_id: institutionId,
redirect_url: finalRedirectUrl,
},
);
return response.data.data;
},
deleteBankConnection: async (requisitionId: string): Promise<void> => {
await api.delete(`/banks/connections/${requisitionId}`);
},
getSupportedCountries: async (): Promise<Country[]> => {
const response = await api.get<ApiResponse<Country[]>>("/banks/countries");
return response.data.data;
},
};
export default apiClient;

View File

@@ -13,6 +13,7 @@ import { Route as TransactionsRouteImport } from './routes/transactions'
import { Route as SystemRouteImport } from './routes/system'
import { Route as SettingsRouteImport } from './routes/settings'
import { Route as NotificationsRouteImport } from './routes/notifications'
import { Route as BankConnectedRouteImport } from './routes/bank-connected'
import { Route as AnalyticsRouteImport } from './routes/analytics'
import { Route as IndexRouteImport } from './routes/index'
@@ -36,6 +37,11 @@ const NotificationsRoute = NotificationsRouteImport.update({
path: '/notifications',
getParentRoute: () => rootRouteImport,
} as any)
const BankConnectedRoute = BankConnectedRouteImport.update({
id: '/bank-connected',
path: '/bank-connected',
getParentRoute: () => rootRouteImport,
} as any)
const AnalyticsRoute = AnalyticsRouteImport.update({
id: '/analytics',
path: '/analytics',
@@ -50,6 +56,7 @@ const IndexRoute = IndexRouteImport.update({
export interface FileRoutesByFullPath {
'/': typeof IndexRoute
'/analytics': typeof AnalyticsRoute
'/bank-connected': typeof BankConnectedRoute
'/notifications': typeof NotificationsRoute
'/settings': typeof SettingsRoute
'/system': typeof SystemRoute
@@ -58,6 +65,7 @@ export interface FileRoutesByFullPath {
export interface FileRoutesByTo {
'/': typeof IndexRoute
'/analytics': typeof AnalyticsRoute
'/bank-connected': typeof BankConnectedRoute
'/notifications': typeof NotificationsRoute
'/settings': typeof SettingsRoute
'/system': typeof SystemRoute
@@ -67,6 +75,7 @@ export interface FileRoutesById {
__root__: typeof rootRouteImport
'/': typeof IndexRoute
'/analytics': typeof AnalyticsRoute
'/bank-connected': typeof BankConnectedRoute
'/notifications': typeof NotificationsRoute
'/settings': typeof SettingsRoute
'/system': typeof SystemRoute
@@ -77,6 +86,7 @@ export interface FileRouteTypes {
fullPaths:
| '/'
| '/analytics'
| '/bank-connected'
| '/notifications'
| '/settings'
| '/system'
@@ -85,6 +95,7 @@ export interface FileRouteTypes {
to:
| '/'
| '/analytics'
| '/bank-connected'
| '/notifications'
| '/settings'
| '/system'
@@ -93,6 +104,7 @@ export interface FileRouteTypes {
| '__root__'
| '/'
| '/analytics'
| '/bank-connected'
| '/notifications'
| '/settings'
| '/system'
@@ -102,6 +114,7 @@ export interface FileRouteTypes {
export interface RootRouteChildren {
IndexRoute: typeof IndexRoute
AnalyticsRoute: typeof AnalyticsRoute
BankConnectedRoute: typeof BankConnectedRoute
NotificationsRoute: typeof NotificationsRoute
SettingsRoute: typeof SettingsRoute
SystemRoute: typeof SystemRoute
@@ -138,6 +151,13 @@ declare module '@tanstack/react-router' {
preLoaderRoute: typeof NotificationsRouteImport
parentRoute: typeof rootRouteImport
}
'/bank-connected': {
id: '/bank-connected'
path: '/bank-connected'
fullPath: '/bank-connected'
preLoaderRoute: typeof BankConnectedRouteImport
parentRoute: typeof rootRouteImport
}
'/analytics': {
id: '/analytics'
path: '/analytics'
@@ -158,6 +178,7 @@ declare module '@tanstack/react-router' {
const rootRouteChildren: RootRouteChildren = {
IndexRoute: IndexRoute,
AnalyticsRoute: AnalyticsRoute,
BankConnectedRoute: BankConnectedRoute,
NotificationsRoute: NotificationsRoute,
SettingsRoute: SettingsRoute,
SystemRoute: SystemRoute,

View File

@@ -8,7 +8,7 @@ import { SidebarInset, SidebarProvider } from "../components/ui/sidebar";
function RootLayout() {
const { updateAvailable, updateSW, forceReload } = usePWA();
// Check for version mismatches and force reload if needed
useVersionCheck(forceReload);

View File

@@ -0,0 +1,57 @@
import { createFileRoute, useSearch } from "@tanstack/react-router";
import { CheckCircle, ArrowLeft } from "lucide-react";
import { Button } from "../components/ui/button";
import {
Card,
CardContent,
CardHeader,
CardTitle,
} from "../components/ui/card";
function BankConnected() {
const search = useSearch({ from: "/bank-connected" });
return (
<div className="min-h-screen flex items-center justify-center bg-background p-4">
<Card className="w-full max-w-md">
<CardHeader className="text-center pb-2">
<div className="mx-auto mb-4">
<CheckCircle className="h-16 w-16 text-green-500" />
</div>
<CardTitle className="text-2xl">Account Connected!</CardTitle>
</CardHeader>
<CardContent className="text-center space-y-4">
<p className="text-muted-foreground">
Your bank account has been successfully connected to Leggen. We'll
start syncing your transactions shortly.
</p>
{search?.bank && (
<p className="text-sm text-muted-foreground">
Connected to: <strong>{search.bank}</strong>
</p>
)}
<div className="pt-4">
<Button
onClick={() => (window.location.href = "/settings")}
className="w-full"
>
<ArrowLeft className="h-4 w-4 mr-2" />
Go to Settings
</Button>
</div>
</CardContent>
</Card>
</div>
);
}
export const Route = createFileRoute("/bank-connected")({
component: BankConnected,
validateSearch: (search: Record<string, unknown>) => {
return {
bank: (search.bank as string) || undefined,
};
},
});

View File

@@ -242,3 +242,38 @@ export interface SyncOperationsResponse {
operations: SyncOperation[];
count: number;
}
// Bank-related types
export interface BankInstitution {
id: string;
name: string;
bic?: string;
transaction_total_days: number;
countries: string[];
logo?: string;
}
export interface BankRequisition {
id: string;
institution_id: string;
status: string;
status_display?: string;
created: string;
link: string;
accounts: string[];
}
export interface BankConnectionStatus {
bank_id: string;
bank_name: string;
status: string;
status_display: string;
created_at: string;
requisition_id: string;
accounts_count: number;
}
export interface Country {
code: string;
name: string;
}

View File

@@ -1,3 +1,4 @@
import httpx
from fastapi import APIRouter, HTTPException, Query
from loguru import logger
@@ -22,7 +23,11 @@ async def get_bank_institutions(
"""Get available bank institutions for a country"""
try:
institutions_response = await gocardless_service.get_institutions(country)
institutions_data = institutions_response.get("results", [])
# Handle both list and dict responses
if isinstance(institutions_response, list):
institutions_data = institutions_response
else:
institutions_data = institutions_response.get("results", [])
institutions = [
BankInstitution(
@@ -122,13 +127,36 @@ async def get_bank_connections_status() -> APIResponse:
async def delete_bank_connection(requisition_id: str) -> APIResponse:
"""Delete a bank connection"""
try:
# This would need to be implemented in GoCardlessService
# For now, return success
# Delete the requisition from GoCardless
result = await gocardless_service.delete_requisition(requisition_id)
# GoCardless returns different responses for successful deletes
# We should check if the operation was actually successful
logger.info(f"GoCardless delete response for {requisition_id}: {result}")
return APIResponse(
success=True,
message=f"Bank connection {requisition_id} deleted successfully",
)
except httpx.HTTPStatusError as http_err:
logger.error(
f"HTTP error deleting bank connection {requisition_id}: {http_err}"
)
if http_err.response.status_code == 404:
raise HTTPException(
status_code=404, detail=f"Bank connection {requisition_id} not found"
) from http_err
elif http_err.response.status_code == 400:
raise HTTPException(
status_code=400,
detail=f"Invalid request to delete connection {requisition_id}",
) from http_err
else:
raise HTTPException(
status_code=http_err.response.status_code,
detail=f"GoCardless API error: {http_err}",
) from http_err
except Exception as e:
logger.error(f"Failed to delete bank connection {requisition_id}: {e}")
raise HTTPException(

View File

@@ -144,6 +144,12 @@ class GoCardlessService:
"GET", f"{self.base_url}/requisitions/"
)
async def delete_requisition(self, requisition_id: str) -> Dict[str, Any]:
"""Delete a requisition"""
return await self._make_authenticated_request(
"DELETE", f"{self.base_url}/requisitions/{requisition_id}/"
)
async def get_account_details(self, account_id: str) -> Dict[str, Any]:
"""Get account details"""
return await self._make_authenticated_request(