Search in sources :

Example 1 with OrderInvoiceRelationship

use of org.folio.rest.acq.model.orders.OrderInvoiceRelationship in project mod-invoice by folio-org.

the class OrderServiceTest method shouldDeleteOrderInvoiceRelationshipByInvoiceIdAndLineIdIfRelationExist.

@Test
void shouldDeleteOrderInvoiceRelationshipByInvoiceIdAndLineIdIfRelationExist() {
    String invoiceId = UUID.randomUUID().toString();
    String poLineId = UUID.randomUUID().toString();
    String orderId = UUID.randomUUID().toString();
    CompositePoLine poLine = new CompositePoLine().withId(poLineId).withPurchaseOrderId(orderId);
    OrderInvoiceRelationship relationship = new OrderInvoiceRelationship().withInvoiceId(invoiceId).withPurchaseOrderId(orderId);
    OrderInvoiceRelationshipCollection relationships = new OrderInvoiceRelationshipCollection().withOrderInvoiceRelationships(List.of(relationship)).withTotalRecords(1);
    doReturn(completedFuture(poLine)).when(restClient).get(any(RequestEntry.class), eq(requestContextMock), eq(CompositePoLine.class));
    doReturn(completedFuture(relationships)).when(restClient).get(any(RequestEntry.class), eq(requestContextMock), eq(OrderInvoiceRelationshipCollection.class));
    doReturn(completedFuture(null)).when(restClient).delete(any(RequestEntry.class), eq(requestContextMock));
    doReturn(completedFuture(poLine)).when(orderLineService).getPoLine(poLineId, requestContextMock);
    orderService.deleteOrderInvoiceRelationshipByInvoiceIdAndLineId(invoiceId, poLineId, requestContextMock).join();
    verify(restClient).delete(any(RequestEntry.class), eq(requestContextMock));
}
Also used : OrderInvoiceRelationshipCollection(org.folio.rest.acq.model.orders.OrderInvoiceRelationshipCollection) CompositePoLine(org.folio.rest.acq.model.orders.CompositePoLine) OrderInvoiceRelationship(org.folio.rest.acq.model.orders.OrderInvoiceRelationship) RequestEntry(org.folio.rest.core.models.RequestEntry) Test(org.junit.jupiter.api.Test)

Example 2 with OrderInvoiceRelationship

use of org.folio.rest.acq.model.orders.OrderInvoiceRelationship in project mod-invoice by folio-org.

the class OrderServiceTest method shouldDeleteOrderInvoiceRelationshipByInvoiceIdIfRelationExist.

@Test
void shouldDeleteOrderInvoiceRelationshipByInvoiceIdIfRelationExist() {
    String invoiceId = UUID.randomUUID().toString();
    String orderId = UUID.randomUUID().toString();
    OrderInvoiceRelationship relationship = new OrderInvoiceRelationship().withInvoiceId(invoiceId).withPurchaseOrderId(orderId);
    OrderInvoiceRelationshipCollection relationships = new OrderInvoiceRelationshipCollection().withOrderInvoiceRelationships(List.of(relationship)).withTotalRecords(1);
    doReturn(completedFuture(relationships)).when(restClient).get(any(RequestEntry.class), eq(requestContextMock), eq(OrderInvoiceRelationshipCollection.class));
    doReturn(completedFuture(null)).when(restClient).delete(any(RequestEntry.class), eq(requestContextMock));
    orderService.deleteOrderInvoiceRelationshipByInvoiceId(invoiceId, requestContextMock).join();
    verify(restClient).delete(any(RequestEntry.class), eq(requestContextMock));
}
Also used : OrderInvoiceRelationshipCollection(org.folio.rest.acq.model.orders.OrderInvoiceRelationshipCollection) OrderInvoiceRelationship(org.folio.rest.acq.model.orders.OrderInvoiceRelationship) RequestEntry(org.folio.rest.core.models.RequestEntry) Test(org.junit.jupiter.api.Test)

Aggregations

OrderInvoiceRelationship (org.folio.rest.acq.model.orders.OrderInvoiceRelationship)2 OrderInvoiceRelationshipCollection (org.folio.rest.acq.model.orders.OrderInvoiceRelationshipCollection)2 RequestEntry (org.folio.rest.core.models.RequestEntry)2 Test (org.junit.jupiter.api.Test)2 CompositePoLine (org.folio.rest.acq.model.orders.CompositePoLine)1