class TppDataUploaderController implements TppDataUploaderRestApi {

    @Override
    public ResponseEntity<Resource> generateData(boolean generatePayments, String currency) {
        log.info("Request to create test data received");

        byte[] bytes = generationService.generate(generatePayments, Currency.getInstance(currency));

        InputStreamResource resource = new InputStreamResource(new ByteArrayInputStream(bytes));
        HttpHeaders headers = getExportFileHttpHeaders();
        return ResponseEntity.ok()
                   .headers(headers)
                   .contentLength(bytes.length)
                   .contentType(MediaType.APPLICATION_OCTET_STREAM)
                   .body(resource);
    }

}