Interface CommerceItemService

    • Method Detail

      • calculateTotalPrice

        java.math.BigDecimal calculateTotalPrice​(java.util.Collection<CommerceItem> items)
        Sums prices of commerce items.
        Parameters:
        items - items
        Returns:
        sum.
      • mapItems

        java.util.List<CommerceItemDTO> mapItems​(java.util.Collection<CommerceItem> items)
        Maps items to DTOs.
        Parameters:
        items - commerce items
        Returns:
        list of dto
      • extractSpecs

        java.util.Map<java.lang.String,​java.lang.Object> extractSpecs​(SellerSKU sellerSKU)
        Extracting specs of sku to list of maps.
        Parameters:
        sellerSKU - sellerSKU
        Returns:
        map of specs
      • removeCommerceItem

        void removeCommerceItem​(java.lang.String id)
        Removes a commerce item based on its id.
        Parameters:
        id - the id of the commerce item to be removed
      • removeCommerceItems

        void removeCommerceItems​(java.util.List<java.lang.String> ids)
        Removes multiple commerce items based on an array of ids.
        Parameters:
        ids - an collection of ids of the commerce items to be removed
      • updateInventoriesLockedQuantity

        boolean updateInventoriesLockedQuantity​(java.util.Map<CommerceItem,​Inventory> map,
                                                boolean increase)
        Updates the locked quantity in the inventories based on the map of commerce items and their corresponding inventory objects. If increase is true, the locked quantity will be increased; if increase is false, the locked quantity will be decreased.
        Parameters:
        map - A map of CommerceItem objects and their corresponding Inventory objects
        increase - A boolean value to indicate whether to increase or decrease the locked quantity
        Returns:
        true if the locked quantity was successfully updated, false otherwise
      • obtainItemToInventoryMap

        java.util.Map<CommerceItem,​Inventory> obtainItemToInventoryMap​(java.util.List<CommerceItem> items)
        This method creates a mapping between each CommerceItem and its corresponding Inventory.
        Parameters:
        items - the list of CommerceItems for which the mapping needs to be created
        Returns:
        a Map containing the CommerceItem as the key and its corresponding Inventory as the value
      • refundCommerceItems

        void refundCommerceItems​(Order order)
        Refunds all commerce items in the given order.
        Parameters:
        order - the order containing the commerce items to be refunded