use of org.folio.rest.acq.model.finance.Transaction.TransactionType in project mod-invoice by folio-org.
the class InvoiceCancelServiceTest method setupEncumbranceQuery.
private void setupEncumbranceQuery(List<PurchaseOrder> orders, List<PoLine> poLines, List<Transaction> transactions) {
List<PoLine> selectedPoLines = poLines.stream().filter(line -> orders.stream().anyMatch(order -> order.getId().equals(line.getPurchaseOrderId()) && order.getWorkflowStatus().equals(WorkflowStatus.OPEN))).collect(toList());
String poLineIdsQuery = selectedPoLines.stream().map(PoLine::getId).collect(joining(" or "));
String transactionQuery = "transactionType==Encumbrance and encumbrance.sourcePoLineId==(" + poLineIdsQuery + ")";
TransactionCollection transactionCollection = new TransactionCollection().withTransactions(transactions).withTotalRecords(transactions.size());
RequestEntry requestEntry = new RequestEntry(TRANSACTIONS_ENDPOINT).withQuery(transactionQuery).withOffset(0).withLimit(selectedPoLines.size());
doReturn(completedFuture(transactionCollection)).when(restClient).get(argThat(re -> sameRequestEntry(requestEntry, re)), eq(requestContextMock), eq(TransactionCollection.class));
}
Aggregations