Class DefaultOrderFulfillmentItemService<P extends com.broadleafcommerce.order.client.domain.OrderFulfillmentItem>

    • Constructor Detail

      • DefaultOrderFulfillmentItemService

        public DefaultOrderFulfillmentItemService​(OrderFulfillmentService<com.broadleafcommerce.order.client.domain.OrderFulfillment> orderFulfillmentService,
                                                  ReturnAuthorizationService<com.broadleafcommerce.order.client.domain.ReturnAuthorization> returnAuthorizationService)
    • Method Detail

      • readAllReturnableFulfillmentItemsForOrder

        public List<P> readAllReturnableFulfillmentItemsForOrder​(String orderId,
                                                                 @Nullable
                                                                 com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
        Description copied from interface: OrderFulfillmentItemService
        Returns a list of all OrderFulfillmentItems for which a ReturnAuthorization can be made, i.e., those whose parent OrderFulfillments have a status of OrderFulfillmentStatus.FULFILLED and are not already in a return. This will also update the quantities on the items if any have been partially returned.
        Specified by:
        readAllReturnableFulfillmentItemsForOrder in interface OrderFulfillmentItemService<P extends com.broadleafcommerce.order.client.domain.OrderFulfillmentItem>
        Parameters:
        orderId - ID of the parent Order
        contextInfo - Additional sandbox and tenant info
        Returns:
        Returns a list of all OrderFulfillmentItems for which a ReturnAuthorization can be made, i.e., those whose parent OrderFulfillments have a status of OrderFulfillmentStatus.FULFILLED and are not already in a return.
      • readAllReturnableFulfillmentItemsForGroup

        public List<P> readAllReturnableFulfillmentItemsForGroup​(String orderId,
                                                                 String orderFulfillmentId,
                                                                 @Nullable
                                                                 com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
        Description copied from interface: OrderFulfillmentItemService
        Returns a list of all OrderFulfillmentItems in the specified OrderFulfillment for which a ReturnAuthorization can be made, i.e., those whose parent OrderFulfillment has a status of OrderFulfillmentStatus.FULFILLED and are not already in a return. This will also update the quantities on the items if any have been partially returned.
        Specified by:
        readAllReturnableFulfillmentItemsForGroup in interface OrderFulfillmentItemService<P extends com.broadleafcommerce.order.client.domain.OrderFulfillmentItem>
        Parameters:
        orderId - ID of the parent Order
        orderFulfillmentId - ID of the parent OrderFulfillment
        contextInfo - Additional sandbox and tenant info
        Returns:
        Returns a list of all OrderFulfillmentItems in the specified OrderFulfillment for which a ReturnAuthorization can be made, i.e., those whose parent OrderFulfillment has a status of OrderFulfillmentStatus.FULFILLED and are not already in a return.
      • getItemsAlreadyInReturn

        protected Map<String,​Integer> getItemsAlreadyInReturn​(String orderId,
                                                                    @Nullable
                                                                    com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
        Returns a map of the IDs of items already included in a ReturnAuthorization along with the quantity being returned since it may be a partial return.
        Parameters:
        orderId - ID of the parent order
        contextInfo - Additional sandbox and tenant info
        Returns:
        Returns a map of the IDs of items already included in a ReturnAuthorization along with the quantity being returned since it may be a partial return.
      • findReturnableItems

        protected List<P> findReturnableItems​(Map<String,​Integer> itemsAlreadyInReturn,
                                              Stream<P> items)
        Returns a list of OrderFulfillmentItems that can be returned with their quantities adjusted to the amount that can still be returned in the case of partial returns already existing.
        Parameters:
        itemsAlreadyInReturn - Returns a map of the IDs of items already included in a ReturnAuthorization along with the quantity being returned
        items - List of candidate items from an entire Order or a single OrderFulfillment
        Returns:
        Returns a list of OrderFulfillmentItems that can be returned with their quantities adjusted to the amount that can still be returned.
      • getOrderFulfillmentService

        protected OrderFulfillmentService<com.broadleafcommerce.order.client.domain.OrderFulfillment> getOrderFulfillmentService()
      • getReturnAuthorizationService

        protected ReturnAuthorizationService<com.broadleafcommerce.order.client.domain.ReturnAuthorization> getReturnAuthorizationService()