Compare commits
1 Commits
6a373d835c
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| 722699f5d0 |
@@ -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);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user