public List<FulfillmentOption> getFulfillmentOptions() { return fulfillmentOptionService.readAllFulfillmentOptions(); }
@Cacheable(key="#type?.type ?: '_null_'") public Map<? extends FulfillmentOption, Money> readFulfillmentOptionsWithPricesAvailableByFulfillmentType(FulfillmentType type) throws FulfillmentPriceException { final List<FulfillmentOption> fulfillmentOptions = type != null ? fulfillmentOptionService.readAllFulfillmentOptionsByFulfillmentType(type) : fulfillmentOptionService.readAllFulfillmentOptions(); return fulfillmentPricingService.estimateCostForFulfillmentGroup( createTemporaryFulfillmentGroup(), new HashSet(fulfillmentOptions) ).getFulfillmentOptionPrices(); }
@Override public List<OrderMultishipOption> getOrderMultishipOptionsFromDTOs(Order order, List<OrderMultishipOptionDTO> optionDtos) { List<OrderMultishipOption> orderMultishipOptions = new ArrayList<OrderMultishipOption>(); for (OrderMultishipOptionDTO optionDto : optionDtos) { OrderMultishipOption option = new OrderMultishipOptionImpl(); if (optionDto.getAddressId() != null) { option.setAddress(addressService.readAddressById(optionDto.getAddressId())); } if (optionDto.getFulfillmentOptionId() != null) { option.setFulfillmentOption(fulfillmentOptionService.readFulfillmentOptionById(optionDto.getFulfillmentOptionId())); } option.setId(optionDto.getId()); option.setOrder(order); option.setOrderItem(orderItemService.readOrderItemById(optionDto.getOrderItemId())); orderMultishipOptions.add(option); } return orderMultishipOptions; }
option.setFulfillmentOption(fulfillmentOptionService.readFulfillmentOptionById(dto.getFulfillmentOptionId())); } else { option.setFulfillmentOption(null);
/** * A helper method to retrieve all fulfillment options for the cart and estimate the cost of applying * fulfillment options on the first shippable fulfillment group. * */ protected void populateFulfillmentOptionsAndEstimationOnModel(Map<String, Object> localVars) { List<FulfillmentOption> fulfillmentOptions = fulfillmentOptionService.readAllFulfillmentOptions(); Order cart = CartState.getCart(); if (!(cart instanceof NullOrderImpl) && cart.getFulfillmentGroups().size() > 0 && hasPopulatedShippingAddress(cart)) { Set<FulfillmentOption> options = new HashSet<>(); options.addAll(fulfillmentOptions); FulfillmentEstimationResponse estimateResponse = null; try { estimateResponse = fulfillmentPricingService.estimateCostForFulfillmentGroup(fulfillmentGroupService.getFirstShippableFulfillmentGroup(cart), options); } catch (FulfillmentPriceException e) { } localVars.put("estimateResponse", estimateResponse); } localVars.put("fulfillmentOptions", fulfillmentOptions); }
shippableFulfillmentGroup.setPersonalMessage(shippingForm.getPersonalMessage()); shippableFulfillmentGroup.setDeliveryInstruction(shippingForm.getDeliveryMessage()); FulfillmentOption fulfillmentOption = fulfillmentOptionService.readFulfillmentOptionById(shippingForm.getFulfillmentOptionId()); shippableFulfillmentGroup.setFulfillmentOption(fulfillmentOption);
public FulfillmentEstimationResponse getFulfillmentEstimateResponse() { Order cart = CartState.getCart(); if (!isNullOrder(cart) && cart.getFulfillmentGroups().size() > 0 && cartStateService.cartHasPopulatedShippingAddress()) { try { List<FulfillmentOption> fulfillmentOptions = fulfillmentOptionService.readAllFulfillmentOptions(); FulfillmentGroup firstShippableFulfillmentGroup = fulfillmentGroupService.getFirstShippableFulfillmentGroup(cart); return fulfillmentPricingService.estimateCostForFulfillmentGroup(firstShippableFulfillmentGroup, new HashSet<>(fulfillmentOptions)); } catch (FulfillmentPriceException e) { // do nothing } } return null; }
/** * Renders the multiship page. This page is used by the user when shipping items * to different locations (or with different FulfillmentOptions) is desired. * * Note that the default Broadleaf implementation will require the user to input * an Address and FulfillmentOption for each quantity of each DiscreteOrderItem. * * @param request * @param response * @param model * @return the return path */ public String showMultiship(HttpServletRequest request, HttpServletResponse response, Model model) { Customer customer = CustomerState.getCustomer(); Order cart = CartState.getCart(); model.addAttribute("orderMultishipOptions", orderMultishipOptionService.getOrGenerateOrderMultishipOptions(cart)); model.addAttribute("customerAddresses", customerAddressService.readActiveCustomerAddressesByCustomerId(customer.getId())); model.addAttribute("fulfillmentOptions", fulfillmentOptionService.readAllFulfillmentOptions()); return getMultishipView(); }
public Set<FulfillmentOption> findFulfillmentOptionsForProductsInFulfillmentGroup(FulfillmentGroup fulfillmentGroup) { Set<FulfillmentOption> fulfillmentOptions = new HashSet<>(fulfillmentOptionService.readAllFulfillmentOptions()); for (DiscreteOrderItem item : fulfillmentGroup.getDiscreteOrderItems()) { Optional.of(item.getSku()) .map(Sku::getFulfillmentType) .map(fulfillmentOptionService::readAllFulfillmentOptionsByFulfillmentType) .ifPresent(fulfillmentOptions::retainAll); Optional.of(item.getSku()) .map(Sku::getExcludedFulfillmentOptions) .ifPresent(fulfillmentOptions::removeAll); Optional.of(item.getSku()) .map(Sku::getProduct) .map(Product::getDefaultSku) .map(Sku::getExcludedFulfillmentOptions) .ifPresent(fulfillmentOptions::removeAll); } return fulfillmentOptions; }