Class SubscriptionProcessUtil

java.lang.Object
com.skava.subscription.orchestration.processor.SubscriptionProcessUtil

public class SubscriptionProcessUtil extends Object

SubscriptionProcessUtil

This class is used to convert values

Author:
Infosys Equinox
  • Method Details

    • calculateAvailableMonths

      public static Map<Long,SortedSet<Integer>> calculateAvailableMonths(SubscriptionResponse subscription, Map<Long,String> itemLevelFrequencyMap, boolean isFirstTimeSubscription, String storeTimeZone)
      This method is used to calculate available months of item
      Parameters:
      subscription - - refers to the subscription object
      itemLevelFrequencyMap - - holds the map of item level frequencies
      isFirstTimeSubscription - - flag to indicate the future date subscription
      storeTimeZone - - holds the timezone value of store
      Returns:
      availableMonthsMap
    • isOneTimeSubscriptionItem

      public static boolean isOneTimeSubscriptionItem(ItemResponse item)
      This method is used to check whether the item is one time subscription item or not isOneTimeSubscriptionItem returns true if the item is one time subscription
      Parameters:
      item - - refers to the subscription item
      Returns:
      isOneTimeSubscriptionItem
    • calculateNextOrderProcessingMonths

      public static void calculateNextOrderProcessingMonths(SubscriptionResponse subscription, String storeTimeZone, ItemResponse item, SortedSet<Integer> monthsToBeProcessed, int frequency, boolean isFirstTimeSubscription)
      This method is used to calculate next order processing months
      Parameters:
      subscription - - holds the subscription object
      storeTimeZone - - refers to the store timeZone
      item - - holds the cart item object
      monthsToBeProcessed - - holds the set of processing months
      frequency - - refers to the frequency of item
    • isValidNextOrderCreationDate

      public static boolean isValidNextOrderCreationDate(String storeTimeZone, String nextOrderCreationDate)
      This method is used to check if the nextOrderCreationDate is valid or not
      Parameters:
      storeTimeZone - - holds the timezone value of the store
      nextOrderCreationDate - - holds the nextOrderCreationDate value
      Returns:
      returns boolean value
    • calculateNextProcessingMonths

      public static void calculateNextProcessingMonths(int month, int frequency, SortedSet<Integer> monthsToBeProcessed, int lastOrderProcessedMonth, boolean isCurrentMonthSubscription)
      This method is used to calculate processing months for the item
      Parameters:
      month - - refers to the next order processing month
      frequency - - refers to the frequency of item
      monthsToBeProcessed - - holds the set of processing months
      lastOrderProcessedMonth - - holds the last order processed month
      isCurrentMonthSubscription - - flag to check whether items are available to process for current month
    • calculateMonthsForward

      public static SortedSet<Integer> calculateMonthsForward(int nextOrderMonth, long frequency, SortedSet<Integer> availMonth, int lastOrderProcessedMonth, boolean isCurrentMonthSubscription)
      Parameters:
      nextOrderMonth - - holds the next order processing month
      frequency - - refers to the frequency of the item
      availMonth - - holds the list of available months
      lastOrderProcessedMonth - - holds the last order processed month
      isCurrentMonthSubscription - - flag to check whether items are available to process for current month
      Returns:
      list of available months
    • calculateMonthsBackward

      public static SortedSet<Integer> calculateMonthsBackward(int nextOrderMonth, long frequency, SortedSet<Integer> availMonth, int lastOrderProcessedMonth, boolean isCurrentMonthSubscription)
      Parameters:
      nextOrderMonth - - holds the next order processing month
      frequency - - refers to the frequency of the item
      availMonth - - holds the list of available months
      lastOrderProcessedMonth - - holds the last order processed month
      isCurrentMonthSubscription - - flag to check whether items are available to process for current month
      Returns:
      list of available months
    • getLastOrderMonth

      public static int getLastOrderMonth(SubscriptionResponse subscription, String storeTimeZone)
      This method is used to calculate subscription's last order month value
      Parameters:
      subscription - - holds the subscription object
      storeTimeZone - - holds the timeZone value of store
      Returns:
      lastOrderMonth
    • getNextProcessingMonth

      public static int getNextProcessingMonth(SubscriptionResponse subscription, String storeTimeZone)
      This method is used to get next order processing month
      Parameters:
      subscription - - holds the subscription object
      storeTimeZone - - holds the timeZone of the store
      Returns:
      next order processing month
    • constructItemsBasedOnFrequency

      public static void constructItemsBasedOnFrequency(org.apache.camel.Exchange exchange, SubscriptionResponse subscription, String storeId, List<SFItem> sfItems, Map<String,List<ItemResponse>> failedItemsMap, Map<Long,SortedSet<Integer>> availableMonthsMap)
      This method is used to construct cart items based on frequency
      Parameters:
      exchange - - holds the exchange object
      subscription - - holds the subscription object
      storeId - - refers to the store id
      sfItems - - holds the cart item object
      failedItemsMap - - holds the map of failed items
      availableMonthsMap - - holds the list of processing months for each item
    • getSelectedMonth

      public static String getSelectedMonth(org.apache.camel.Exchange exchange, String storeTimeZone)
      This method returns the selected month value
      Parameters:
      exchange - - refers to the exchange object
      storeTimeZone - - refers to the timezone value of store
      Returns:
      selectedMonth
    • constructItemsSkus

      public static void constructItemsSkus(ItemResponse item, SubscriptionResponse subscription, String storeId, List<SFItem> sfItems, Map<String,List<ItemResponse>> failedItemsMap, boolean includeFailedItemsCheck)

      constructItemsSkus

      This method is to construct item SKUs

      Parameters:
      item - - ItemResponse - subscription items
      subscription - - SubscriptionResponse subscription data
      storeId - - store ID
      sfItems - - SFItem SF cart items
      failedItemsMap - - Map failed items Map
      includeFailedItemsCheck - -includeFailedItemsCheck
    • parseFailedItems

      public static void parseFailedItems(ItemResponse item, Map<String,List<ItemResponse>> failedItemsMap, boolean isInventoryAvail, boolean isActiveSku, boolean isSkippedItem)
      parseFailedItems
      Parameters:
      item - item
      failedItemsMap - failedItemsMap
      isInventoryAvail - isInventoryAvail
      isActiveSku - isActiveSku
      isSkippedItem - isSkippedItem
    • parseItemsAndAddToCart

      public static void parseItemsAndAddToCart(ItemResponse item, SubscriptionResponse subscription, String storeId, List<SFItem> sfItems, List<SkuOrchestration> sfSkus)
      parseItemsAndAddToCart
      Parameters:
      item - item
      subscription - subscription
      storeId - storeId
      sfItems - sfItems
      sfSkus - sfSkus
    • isActiveSku

      public static boolean isActiveSku(SkuResponse sku)

      isActiveSku

      Method isActiveSku

      Parameters:
      sku - - SkuResponse SKU response
      Returns:
      Boolean isActiveSku
    • isInventoryAvail

      public static boolean isInventoryAvail(SkuResponse sku)

      isInventoryAvail

      Method isInventoryAvail to check inventory avail or not

      Parameters:
      sku - - SkuResponse SKU response
      Returns:
      Boolean isInventoryAvail
    • arrangeMainSkuAtTop

      public static void arrangeMainSkuAtTop(ItemResponse item)

      arrangeMainSkuAtTop

      This method is to arrange main SKU at top

      Parameters:
      item - - ItemResponse Subscribed Item
    • setPropertiesMap

      public static void setPropertiesMap(SFItem sfItem)
      setPropertiesMap
      Parameters:
      sfItem - sfItem
    • isSkippedItem

      public static boolean isSkippedItem(SubscriptionResponse subscription, ItemResponse item)

      isSkippedItem

      Method isSkippedItem

      Parameters:
      subscription - - SubscriptionResponse Subscription Response
      item - - ItemResponse item response
      Returns:
      Boolean isSkippedItem
    • setAccountId

      public static void setAccountId(OrderDetails orders, String accountId)
      This method is used to set account id
      Parameters:
      orders - - holds the order details
      accountId - - accountId
    • getOrderValue

      public static BigDecimal getOrderValue(Order orderResponse)
      This method is used to get the total order value
      Parameters:
      orderResponse - - holds the order response
      Returns:
      total order value