Feedback edits

This commit is contained in:
echerniak 2021-11-25 11:07:10 +03:00
parent 7d4e188a3c
commit 17c0be59d7
No known key found for this signature in database
GPG Key ID: 7D79B3A9CB749B36

View File

@ -57,11 +57,8 @@ public class ReportsApiDelegateService implements ReportsApiDelegate {
String shopID, String paymentInstitutionRealm) {
log.info("-> Req: xRequestID={}", xRequestID);
checkDeadline(xRequestDeadline, xRequestID);
if (shopID != null) {
accessService.getAccessibleShops("CreateReport", partyID, List.of(shopID), paymentInstitutionRealm);
} else {
accessService.getAccessibleShops("CreateReport", partyID, paymentInstitutionRealm);
}
var shops = shopID != null ? List.of(shopID) : null;
accessService.getAccessibleShops("CreateReport", partyID, shops, paymentInstitutionRealm);
var request = getReportRequest(partyID, shopID, fromTime, toTime);
var reportId = reporterService.createReport(request, reportType);
var response = reporterService.getReport(reportId);
@ -69,16 +66,6 @@ public class ReportsApiDelegateService implements ReportsApiDelegate {
return ResponseEntity.status(HttpStatus.CREATED).body(response);
}
private ReportRequest getReportRequest(String partyId, String shopId, OffsetDateTime fromTime,
OffsetDateTime toTime) {
return new ReportRequest()
.setPartyId(partyId)
.setShopId(shopId)
.setTimeRange(new ReportTimeRange()
.setFromTime(fromTime.toString())
.setToTime(toTime.toString()));
}
@PreAuthorize("hasAuthority('party:read')")
@Override
public ResponseEntity<ReportLink> downloadFile(String xRequestID, String partyID, Long reportID, String fileID,
@ -130,6 +117,16 @@ public class ReportsApiDelegateService implements ReportsApiDelegate {
return ResponseEntity.ok(response);
}
private ReportRequest getReportRequest(String partyId, String shopId, OffsetDateTime fromTime,
OffsetDateTime toTime) {
return new ReportRequest()
.setPartyId(partyId)
.setShopId(shopId)
.setTimeRange(new ReportTimeRange()
.setFromTime(fromTime.toString())
.setToTime(toTime.toString()));
}
private StatReportRequest getStatReportRequest(String partyId, String shopId, OffsetDateTime fromTime,
OffsetDateTime toTime, Integer limit,
List<String> reportTypes, String continuationToken) {