Compare commits

...

1 Commits

Author SHA1 Message Date
722699f5d0 Sign-Endpoint liefert HTTP 422 bei ungültiger Rechnung, ZIP in beiden Fällen
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-13 17:45:51 +02:00

View File

@@ -60,6 +60,11 @@ public class InvoiceSigningController {
this.validator = validator; this.validator = validator;
} }
/**
* Erzeugt aus PDF und Metadaten eine ZUGFeRD-Rechnung als ZIP (PDF + Prüfbericht).
* HTTP 200 bei gültiger, HTTP 422 bei ungültiger Rechnung; das ZIP wird in
* beiden Fällen geliefert.
*/
@PostMapping(value = "/sign", consumes = MediaType.MULTIPART_FORM_DATA_VALUE) @PostMapping(value = "/sign", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
public ResponseEntity<byte[]> sign(@RequestPart("file") MultipartFile file, public ResponseEntity<byte[]> sign(@RequestPart("file") MultipartFile file,
@RequestPart("metadata") String metadataJson) throws IOException { @RequestPart("metadata") String metadataJson) throws IOException {
@@ -70,7 +75,8 @@ public class InvoiceSigningController {
headers.setContentType(MediaType.parseMediaType("application/zip")); headers.setContentType(MediaType.parseMediaType("application/zip"));
headers.setContentDisposition(ContentDisposition.attachment().filename(result.zipFileName()).build()); headers.setContentDisposition(ContentDisposition.attachment().filename(result.zipFileName()).build());
headers.set(VALIDATION_HEADER, String.valueOf(result.valid())); headers.set(VALIDATION_HEADER, String.valueOf(result.valid()));
return new ResponseEntity<>(result.zip(), headers, HttpStatus.OK); return new ResponseEntity<>(result.zip(), headers,
result.valid() ? HttpStatus.OK : HttpStatus.UNPROCESSABLE_ENTITY);
} }
/** /**