feat: add manual bank transaction entry page#1041
Conversation
Add a form-based alternative to XML file upload for creating bank transactions. The form generates a CAMT.053 XML and submits it via the existing POST /bankTx endpoint. Admin-only access enforced via useAdminGuard() on frontend and RoleGuard(BANKING_BOT) on API.
- Fix escapeXml crash on undefined values for optional address fields - Extract escapeXml, buildPartyXml, buildCamt053Xml outside component - Break long inline XML strings into readable multi-line structure - Only emit address XML tags for fields that have values
Code ReviewKritisch1. Hardcoded Bankdaten im Frontend ( const ACCOUNT_IBAN = 'CH7780808002608614092';
const ACCOUNT_OWNER = 'DFX AG';
const ACCOUNT_BANK = 'Raiffeisenbank Waldkirch';Echte IBAN und Bankdaten sind direkt im Frontend-Code. Auch wenn der Screen admin-geschützt ist: Das landet im JS-Bundle und ist für jeden im Browser-DevTools einsehbar. Diese Werte sollten vom Backend kommen oder zumindest aus einer Environment-Config. 2. Fehlende IBAN-Validierung ( Die IBAN wird nur mit // Ist:
iban: [Validations.Required],
// Sollte:
iban: [Validations.Required, Validations.Iban(...)],3. Diese Felder werden direkt ins XML eingesetzt ohne Hoch4.
5.
6. Komponente überschreitet 250-Zeilen-Limit (369 Zeilen) Die XML-Builder-Logik (Zeilen 47-217, ~170 Zeilen) sollte in eine eigene Utility-Datei extrahiert werden, z.B. Mittel7. Duplizierter Code zwischen Folgende Patterns sind quasi identisch kopiert:
Ein Custom Hook 8. Schwache
9. Freitext-Eingabe für einen ISO 3166-1 Alpha-2 Country Code. Ein Dropdown mit gültigen Ländercodes oder zumindest eine Längen-/Format-Validierung wäre sicherer. Niedrig10. Button-Label "Next" unpassend ( Der Submit-Button sagt "Next", aber es gibt keinen nächsten Schritt — es ist ein direkter Upload. "Upload" oder "Submit" wäre treffender. |
…urable - Rename buildingNumber→houseNumber, postalCode→zip to match codebase - Use StyledHorizontalStack for Street+Nr and ZIP+City rows - Replace plain Country input with StyledSearchDropdown<Country> - Add autocomplete attributes matching existing screens - Replace hardcoded ACCOUNT_IBAN/OWNER/BANK with form fields - Fix amount formatting to 2 decimal places - Remove unused async from onSubmit
- Extract XML builder to src/util/camt053-builder.ts (#6) - Add IBAN validation via Validations.Iban for both IBAN fields (#2) - Escape bookingDate/valueDate/currency in XML output (#3) - Add NaN guard for parseFloat on amount (#5) - Use crypto.randomUUID() for AcctSvcrRef (#8) - Change button label from "Next" to "Upload" (#10)
🤖 PR Review Bot❌ Security: 1 critical vulnerabilitiesThis is an automated review. Please address the issues above. |
davidleomay
left a comment
There was a problem hiding this comment.
It would be easier to add a JSON endpoint to create bank transactions to the API instead of adding a CAMT053 builder here 😁
Summary
/sepapage linking to/sepa/manuell/sepa/manuellfor manual bank transaction entry with fields: booking date, value date, amount, currency, direction (CRDT/DBIT), counterparty details (name, address, IBAN), and remittance infoPOST /bankTxendpointuseAdminGuard()on frontend,RoleGuard(BANKING_BOT)on API (ADMIN role inherits BANKING_BOT access)Test plan
/sepaand verify "Manual entry" button appears/sepa/manuell/sepa/manuell