use of org.folio.rest.RestConstants.EN in project mod-orders by folio-org.
the class PurchaseOrderHelper method validateVendor.
private CompletableFuture<List<Error>> validateVendor(CompositePurchaseOrder compPO, RequestContext requestContext) {
if (compPO.getWorkflowStatus() == WorkflowStatus.OPEN) {
HttpClientInterface httpClient = AbstractHelper.getHttpClient(requestContext.getHeaders(), true);
VendorHelper vendorHelper = new VendorHelper(httpClient, requestContext.getHeaders(), requestContext.getContext(), EN);
List<Error> combinedErrors = new ArrayList<>();
return vendorHelper.validateVendor(compPO).thenAccept(aErrors -> combinedErrors.addAll(aErrors.getErrors())).thenCompose(errors -> fetchCompositePoLines(compPO, requestContext).thenCompose(vendorHelper::validateAccessProviders).thenAccept(aErrors -> combinedErrors.addAll(aErrors.getErrors())).thenApply(v -> combinedErrors));
}
return completedFuture(Collections.emptyList());
}
Aggregations