Search in sources :

Example 16 with SKU

use of org.rembx.jeeshop.catalog.model.SKU in project jeeshop by remibantos.

the class SKUsCT method modify_ShouldModify_for_store_admin.

@Test
public void modify_ShouldModify_for_store_admin() {
    tester.setStoreAdminUser();
    SKU sku = new SKU(tester.getFixtures().aVisibleSKU().getId(), "New name");
    tester.test_modify(sku);
    Assertions.assertThat(sku.getName()).isEqualTo("New name");
}
Also used : SKU(org.rembx.jeeshop.catalog.model.SKU) Test(org.junit.jupiter.api.Test)

Example 17 with SKU

use of org.rembx.jeeshop.catalog.model.SKU in project jeeshop by remibantos.

the class DefaultPaymentTransactionEngine method updateSkusQuantities.

protected void updateSkusQuantities(Order order) {
    order.getItems().forEach(orderItem -> {
        SKU sku = catalogEntityManager.find(SKU.class, (orderItem).getSkuId());
        sku.setQuantity(sku.getQuantity() - (orderItem).getQuantity());
    });
}
Also used : SKU(org.rembx.jeeshop.catalog.model.SKU)

Aggregations

SKU (org.rembx.jeeshop.catalog.model.SKU)17 Test (org.junit.jupiter.api.Test)12 WebApplicationException (org.rembx.jeeshop.rest.WebApplicationException)4 Date (java.util.Date)3 OrderItem (org.rembx.jeeshop.order.model.OrderItem)3 HashSet (java.util.HashSet)2 Test (org.junit.Test)2 Order (org.rembx.jeeshop.order.model.Order)2 Discount (org.rembx.jeeshop.catalog.model.Discount)1 Product (org.rembx.jeeshop.catalog.model.Product)1 User (org.rembx.jeeshop.user.model.User)1