Long fulfillmentGroupId,
FulfillmentGroupItemWrapper wrapper,
boolean priceOrder) {
Order cart = CartState.getCart();
if (cart != null) {
FulfillmentGroupItemRequest fulfillmentGroupItemRequest = wrapper.unwrap(request, context);
if (fulfillmentGroupItemRequest.getOrderItem() != null) {
FulfillmentGroup fulfillmentGroup = null;
OrderItem orderItem = null;
for (FulfillmentGroup fg : cart.getFulfillmentGroups()) {
if (fg.getId().equals(fulfillmentGroupId)) {
fulfillmentGroup = fg;
}
}
fulfillmentGroupItemRequest.setFulfillmentGroup(fulfillmentGroup);
for (OrderItem oi : cart.getOrderItems()) {
if (oi.getId().equals(fulfillmentGroupItemRequest.getOrderItem().getId())) {
orderItem = oi;
}
}
fulfillmentGroupItemRequest.setOrderItem(orderItem);
if (fulfillmentGroup != null && orderItem != null) {
try {
FulfillmentGroup fg = fulfillmentGroupService.addItemToFulfillmentGroup(fulfillmentGroupItemRequest, priceOrder);
FulfillmentGroupWrapper fulfillmentGroupWrapper = (FulfillmentGroupWrapper) context.getBean(FulfillmentGroupWrapper.class.getName());