Search in sources :

Example 1 with ProductInfo

use of io.github.zutherb.appstash.shop.service.product.model.ProductInfo in project the-app by devops-dojo.

the class ProductItemListPanel method productList.

private DataView<ProductInfo> productList(final String parentTag) {
    DataView<ProductInfo> productsView = new DataView<ProductInfo>("products", productsProvider()) {

        @Override
        protected void populateItem(Item<ProductInfo> item) {
            item.add(newProductItemPanel("product", parentTag, item.getModel()));
        }
    };
    productsView.add(new HighLightBehavior());
    return productsView;
}
Also used : ProductInfo(io.github.zutherb.appstash.shop.service.product.model.ProductInfo) DataView(org.apache.wicket.markup.repeater.data.DataView) Item(org.apache.wicket.markup.repeater.Item) HighLightBehavior(io.github.zutherb.appstash.shop.ui.panel.base.HighLightBehavior)

Example 2 with ProductInfo

use of io.github.zutherb.appstash.shop.service.product.model.ProductInfo in project the-app by devops-dojo.

the class InMemoryCartFulfillmentProviderImplTest method setUp.

@Before
public void setUp() throws Exception {
    cart = new InMemoryCartFulfillmentProviderImpl();
    cart.addItem(new ProductInfo(new ObjectId().toString(), "A1", "Salami", SeoUtils.urlFriendly("Salami"), "", ProductType.HANDY, 10.0, "category"));
}
Also used : ProductInfo(io.github.zutherb.appstash.shop.service.product.model.ProductInfo) ObjectId(org.bson.types.ObjectId) Before(org.junit.Before)

Example 3 with ProductInfo

use of io.github.zutherb.appstash.shop.service.product.model.ProductInfo in project the-app by devops-dojo.

the class DirectBuyRequestCycleListener method onBeginRequest.

@Override
public void onBeginRequest(RequestCycle cycle) {
    StringValue directBuyParameterValue = cycle.getRequest().getRequestParameters().getParameterValue(DIRECT_BUY_PARAMETER);
    if (!directBuyParameterValue.isEmpty()) {
        try {
            ProductInfo productInfo = productService.findByQuery(ProductQuery.create().withUrlname(directBuyParameterValue.toString()));
            if (productInfo != null) {
                cart.addItem(productInfo);
            } else {
                ShopSession.get().error(String.format("Das Product '%s' konnte nicht gefunden werden.", directBuyParameterValue));
            }
            Url urlWithoutDirectBuy = removeDirectBuyFromUrl(cycle);
            redirectTo(cycle, urlWithoutDirectBuy);
        } catch (Exception e) {
            ShopSession.get().error(DIRECT_BUY_PROCESSING_FAILED_MESSAGE);
            LOGGER.error(DIRECT_BUY_PROCESSING_FAILED_MESSAGE, e);
        }
    }
}
Also used : ProductInfo(io.github.zutherb.appstash.shop.service.product.model.ProductInfo) StringValue(org.apache.wicket.util.string.StringValue) Url(org.apache.wicket.request.Url)

Aggregations

ProductInfo (io.github.zutherb.appstash.shop.service.product.model.ProductInfo)3 HighLightBehavior (io.github.zutherb.appstash.shop.ui.panel.base.HighLightBehavior)1 Item (org.apache.wicket.markup.repeater.Item)1 DataView (org.apache.wicket.markup.repeater.data.DataView)1 Url (org.apache.wicket.request.Url)1 StringValue (org.apache.wicket.util.string.StringValue)1 ObjectId (org.bson.types.ObjectId)1 Before (org.junit.Before)1