use of io.github.zutherb.appstash.shop.service.order.model.OrderInfo in project the-app by devops-dojo.
the class CheckoutPage method submitOrderLink.
private Component submitOrderLink() {
return new SubmitLink("submitOrder") {
private static final long serialVersionUID = 5203227218130238529L;
@Override
protected void onBeforeRender() {
setVisible(!isReadOnly() && getAuthenticationService().isAuthorized());
super.onBeforeRender();
}
@Override
public void onSubmit() {
OrderInfo submittedOrder = orderService.submitOrder(orderInfoModel.getObject(), getSession().getId());
trackingService.trackPurchase(submittedOrder);
getSession().info(CheckoutPage.this.getString("order.submitted"));
setResponsePage(new OrderConfirmationPage(Model.of(submittedOrder)));
}
};
}
use of io.github.zutherb.appstash.shop.service.order.model.OrderInfo in project the-app by devops-dojo.
the class OrderServiceImpl method submitOrder.
@Override
public OrderInfo submitOrder(OrderInfo orderInfo, String sessionId) {
Long orderId = orderIdProvider.nextVal();
OrderInfo orderInfoToSave = new OrderInfo(orderId, sessionId, orderInfo);
save(orderInfoToSave);
logger.info(String.format("Order %d was submited", orderInfoToSave.getOrderId()));
cart.clear();
return orderInfoToSave;
}
use of io.github.zutherb.appstash.shop.service.order.model.OrderInfo in project the-app by devops-dojo.
the class DeliveryAdressEditPanel method deliveryAdressEditForm.
private Component deliveryAdressEditForm() {
Form<OrderInfo> deliveryAdressEditForm = new Form<>("deliveryAdressEditForm");
deliveryAdressEditForm.add(new TextField<>("firstname", new PropertyModel<>(orderModel, "deliveryAddress.firstname")).setRequired(true));
deliveryAdressEditForm.add(new TextField<>("lastname", new PropertyModel<>(orderModel, "deliveryAddress.lastname")).setRequired(true));
deliveryAdressEditForm.add(new TextField<>("street", new PropertyModel<>(orderModel, "deliveryAddress.street")).setRequired(true));
deliveryAdressEditForm.add(new TextField<>("zip", new PropertyModel<>(orderModel, "deliveryAddress.zip")).setRequired(true));
deliveryAdressEditForm.add(new TextField<>("city", new PropertyModel<>(orderModel, "deliveryAddress.city")).setRequired(true));
deliveryAdressEditForm.add(new SubmitLink("deliveryAdressEditFormSubmit") {
private static final long serialVersionUID = 8821619700889289116L;
@Override
public void onSubmit() {
deliveryAdressEditFormSubmit();
}
});
return deliveryAdressEditForm;
}
use of io.github.zutherb.appstash.shop.service.order.model.OrderInfo in project the-app by devops-dojo.
the class OrderServiceImpl method mapSourceEntityToDestinationEntity.
@Override
protected OrderInfo mapSourceEntityToDestinationEntity(Order sourceEntity) {
OrderInfo orderInfo = super.mapSourceEntityToDestinationEntity(sourceEntity);
orderInfo.setUser(userService.findById(sourceEntity.getUserId()));
return orderInfo;
}
Aggregations