Class SubscriptionProcessUtil
java.lang.Object
com.skava.subscription.orchestration.processor.SubscriptionProcessUtil
SubscriptionProcessUtil
This class is used to convert values
- Author:
- Infosys Equinox
-
Method Summary
Modifier and TypeMethodDescriptionstatic void
arrangeMainSkuAtTopcalculateAvailableMonths
(SubscriptionResponse subscription, Map<Long, String> itemLevelFrequencyMap, boolean isFirstTimeSubscription, String storeTimeZone) This method is used to calculate available months of itemcalculateMonthsBackward
(int nextOrderMonth, long frequency, SortedSet<Integer> availMonth, int lastOrderProcessedMonth, boolean isCurrentMonthSubscription) calculateMonthsForward
(int nextOrderMonth, long frequency, SortedSet<Integer> availMonth, int lastOrderProcessedMonth, boolean isCurrentMonthSubscription) 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 monthsstatic void
calculateNextProcessingMonths
(int month, int frequency, SortedSet<Integer> monthsToBeProcessed, int lastOrderProcessedMonth, boolean isCurrentMonthSubscription) This method is used to calculate processing months for the itemstatic 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 frequencystatic void
constructItemsSkus
(ItemResponse item, SubscriptionResponse subscription, String storeId, List<SFItem> sfItems, Map<String, List<ItemResponse>> failedItemsMap, boolean includeFailedItemsCheck) constructItemsSkusstatic int
getLastOrderMonth
(SubscriptionResponse subscription, String storeTimeZone) This method is used to calculate subscription's last order month valuestatic int
getNextProcessingMonth
(SubscriptionResponse subscription, String storeTimeZone) This method is used to get next order processing monthstatic BigDecimal
getOrderValue
(Order orderResponse) This method is used to get the total order valuestatic String
getSelectedMonth
(org.apache.camel.Exchange exchange, String storeTimeZone) This method returns the selected month valuestatic boolean
isActiveSku
(SkuResponse sku) isActiveSkustatic boolean
isInventoryAvailstatic boolean
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 subscriptionstatic boolean
isSkippedItem
(SubscriptionResponse subscription, ItemResponse item) isSkippedItemstatic boolean
isValidNextOrderCreationDate
(String storeTimeZone, String nextOrderCreationDate) This method is used to check if the nextOrderCreationDate is valid or notstatic void
parseFailedItems
(ItemResponse item, Map<String, List<ItemResponse>> failedItemsMap, boolean isInventoryAvail, boolean isActiveSku, boolean isSkippedItem) parseFailedItemsstatic void
parseItemsAndAddToCart
(ItemResponse item, SubscriptionResponse subscription, String storeId, List<SFItem> sfItems, List<SkuOrchestration> sfSkus) parseItemsAndAddToCartstatic void
setAccountId
(OrderDetails orders, String accountId) This method is used to set account idstatic void
setPropertiesMap
(SFItem sfItem) setPropertiesMap
-
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 objectitemLevelFrequencyMap
- - holds the map of item level frequenciesisFirstTimeSubscription
- - flag to indicate the future date subscriptionstoreTimeZone
- - holds the timezone value of store- Returns:
- availableMonthsMap
-
isOneTimeSubscriptionItem
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 objectstoreTimeZone
- - refers to the store timeZoneitem
- - holds the cart item objectmonthsToBeProcessed
- - holds the set of processing monthsfrequency
- - 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 storenextOrderCreationDate
- - 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 monthfrequency
- - refers to the frequency of itemmonthsToBeProcessed
- - holds the set of processing monthslastOrderProcessedMonth
- - holds the last order processed monthisCurrentMonthSubscription
- - 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 monthfrequency
- - refers to the frequency of the itemavailMonth
- - holds the list of available monthslastOrderProcessedMonth
- - holds the last order processed monthisCurrentMonthSubscription
- - 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 monthfrequency
- - refers to the frequency of the itemavailMonth
- - holds the list of available monthslastOrderProcessedMonth
- - holds the last order processed monthisCurrentMonthSubscription
- - flag to check whether items are available to process for current month- Returns:
- list of available months
-
getLastOrderMonth
This method is used to calculate subscription's last order month value- Parameters:
subscription
- - holds the subscription objectstoreTimeZone
- - holds the timeZone value of store- Returns:
- lastOrderMonth
-
getNextProcessingMonth
This method is used to get next order processing month- Parameters:
subscription
- - holds the subscription objectstoreTimeZone
- - 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 objectsubscription
- - holds the subscription objectstoreId
- - refers to the store idsfItems
- - holds the cart item objectfailedItemsMap
- - holds the map of failed itemsavailableMonthsMap
- - holds the list of processing months for each item
-
getSelectedMonth
This method returns the selected month value- Parameters:
exchange
- - refers to the exchange objectstoreTimeZone
- - 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 itemssubscription
- -SubscriptionResponse
subscription datastoreId
- - store IDsfItems
- -SFItem
SF cart itemsfailedItemsMap
- -Map
failed items MapincludeFailedItemsCheck
- -includeFailedItemsCheck
-
parseFailedItems
public static void parseFailedItems(ItemResponse item, Map<String, List<ItemResponse>> failedItemsMap, boolean isInventoryAvail, boolean isActiveSku, boolean isSkippedItem) parseFailedItems- Parameters:
item
- itemfailedItemsMap
- failedItemsMapisInventoryAvail
- isInventoryAvailisActiveSku
- isActiveSkuisSkippedItem
- isSkippedItem
-
parseItemsAndAddToCart
public static void parseItemsAndAddToCart(ItemResponse item, SubscriptionResponse subscription, String storeId, List<SFItem> sfItems, List<SkuOrchestration> sfSkus) parseItemsAndAddToCart- Parameters:
item
- itemsubscription
- subscriptionstoreId
- storeIdsfItems
- sfItemssfSkus
- sfSkus
-
isActiveSku
isActiveSku
Method isActiveSku
- Parameters:
sku
- -SkuResponse
SKU response- Returns:
Boolean
isActiveSku
-
isInventoryAvail
isInventoryAvail
Method isInventoryAvail to check inventory avail or not
- Parameters:
sku
- -SkuResponse
SKU response- Returns:
Boolean
isInventoryAvail
-
arrangeMainSkuAtTop
arrangeMainSkuAtTop
This method is to arrange main SKU at top
- Parameters:
item
- -ItemResponse
Subscribed Item
-
setPropertiesMap
setPropertiesMap- Parameters:
sfItem
- sfItem
-
isSkippedItem
isSkippedItem
Method isSkippedItem
- Parameters:
subscription
- -SubscriptionResponse
Subscription Responseitem
- -ItemResponse
item response- Returns:
Boolean
isSkippedItem
-
setAccountId
This method is used to set account id- Parameters:
orders
- - holds the order detailsaccountId
- - accountId
-
getOrderValue
This method is used to get the total order value- Parameters:
orderResponse
- - holds the order response- Returns:
- total order value
-