use of org.folio.rest.acq.model.finance.OrderTransactionSummary in project mod-orders by folio-org.
the class TransactionSummariesService method createOrderTransactionSummary.
public CompletableFuture<OrderTransactionSummary> createOrderTransactionSummary(String id, int number, RequestContext requestContext) {
OrderTransactionSummary summary = new OrderTransactionSummary().withId(id).withNumTransactions(number);
RequestEntry requestEntry = new RequestEntry(ENDPOINT);
return restClient.post(requestEntry, summary, requestContext, OrderTransactionSummary.class);
}
use of org.folio.rest.acq.model.finance.OrderTransactionSummary in project mod-orders by folio-org.
the class TransactionSummariesService method updateOrderTransactionSummary.
public CompletableFuture<Void> updateOrderTransactionSummary(String orderId, int number, RequestContext requestContext) {
if (number > 0) {
OrderTransactionSummary summary = new OrderTransactionSummary().withId(orderId).withNumTransactions(number);
RequestEntry requestEntry = new RequestEntry(BY_ID_ENDPOINT).withId(orderId);
return restClient.put(requestEntry, summary, requestContext);
} else {
return CompletableFuture.completedFuture(null);
}
}
use of org.folio.rest.acq.model.finance.OrderTransactionSummary in project mod-orders by folio-org.
the class TransactionSummariesServiceTest method testShouldCreateTransactionSummaryInStorageTransactions.
@Test
void testShouldCreateTransactionSummaryInStorageTransactions() {
// given
String uuid = UUID.randomUUID().toString();
Response response = new Response();
response.setBody(new JsonObject("{\"id\": \"" + uuid + "\"}"));
response.setCode(201);
doReturn(completedFuture(response)).when(restClient).post(any(), any(), any(), any());
// When
OrderTransactionSummary summary = transactionSummariesService.createOrderTransactionSummary(uuid, 2, requestContext).join();
// Then
assertEquals(uuid, summary.getId());
verify(restClient).post(any(), any(), any(), any());
}
use of org.folio.rest.acq.model.finance.OrderTransactionSummary in project mod-invoice by folio-org.
the class InvoiceCancelServiceTest method setupUpdateOrderTransactionSummary.
private void setupUpdateOrderTransactionSummary(PurchaseOrder order) {
RequestEntry requestEntry = new RequestEntry(ORDER_TRANSACTION_SUMMARIES_BY_ID_ENDPOINT).withPathParameter("id", order.getId());
OrderTransactionSummary summary = new OrderTransactionSummary().withId(order.getId()).withNumTransactions(1);
doReturn(completedFuture(null)).when(restClient).put(argThat(re -> sameRequestEntry(requestEntry, re)), eq(summary), eq(requestContextMock));
}
Aggregations