Package com.skava.oms.flow.util
Class AccountUtil
java.lang.Object
com.skava.oms.flow.util.AccountUtil
This class handles account budget calculation and validations.
- Since:
- 20-Aug-2018
-
Method Summary
Modifier and TypeMethodDescriptionstatic BigDecimal
calculateOrderTotalValues
(List<OrderItem> orderItemList, BigDecimal totalValue, boolean isNegative) This method is used to calculate the order total values.static BigDecimal
doubleToBigDecimal
(double value) static PreProcessAccountEvent
getAccountBudgetEvent
(Order order, String accountsCollectionId, AccountBudget budget, Events eventName) This method is used to get account budget event.static AccountBudget
getAccountBudgetValue
(org.camunda.bpm.engine.delegate.DelegateExecution execution, Order order, String accountsCollectionId, String value) This method is used to get account budget value.static String
getAuthToken
(UserTracking usertracking, long businessId, OrderProcessFlowService orderService, long authExpiryTimeMins) This method is used to get auth token.static void
triggerAccountEvent
(org.camunda.bpm.engine.delegate.DelegateExecution execution, OrderProcessData orderProcessData, Order order, String accountsCollectionId, AccountBudget budget, OrderProcessFlowService orderService, long authExpiryTimeMins) This method will trigger account event.
-
Method Details
-
calculateOrderTotalValues
public static BigDecimal calculateOrderTotalValues(List<OrderItem> orderItemList, BigDecimal totalValue, boolean isNegative) This method is used to calculate the order total values.- Parameters:
orderItemList
- Contains orderitem list for calculating the order values.totalValue
- the order total value.isNegative
- holds true or false value.- Returns:
- the Order total value.
-
getAccountBudgetValue
public static AccountBudget getAccountBudgetValue(org.camunda.bpm.engine.delegate.DelegateExecution execution, Order order, String accountsCollectionId, String value) This method is used to get account budget value.- Parameters:
execution
- Contains DelegateExecution object.order
- Refers order object.accountsCollectionId
- Contains accounts collection id.value
- contains order values.- Returns:
- The account budget object.
-
getAccountBudgetEvent
public static PreProcessAccountEvent getAccountBudgetEvent(Order order, String accountsCollectionId, AccountBudget budget, Events eventName) This method is used to get account budget event.- Parameters:
order
- Refers the order objectaccountsCollectionId
- accounts collection idbudget
- Refers accountbudget objecteventName
- Refers the event name- Returns:
- The PreProcessAccountEvent
-
triggerAccountEvent
public static void triggerAccountEvent(org.camunda.bpm.engine.delegate.DelegateExecution execution, OrderProcessData orderProcessData, Order order, String accountsCollectionId, AccountBudget budget, OrderProcessFlowService orderService, long authExpiryTimeMins) This method will trigger account event.- Parameters:
execution
- Contains DelegateExecution object.orderProcessData
- Refers OrderProcessData object.order
- Contains order object for sending event.accountsCollectionId
- the account collection idbudget
- Refers AccountBudget values.orderService
- Refers OrderProcessFlowService object.
-
getAuthToken
public static String getAuthToken(UserTracking usertracking, long businessId, OrderProcessFlowService orderService, long authExpiryTimeMins) This method is used to get auth token.- Parameters:
usertracking
- usertracking object for loading userid.businessId
- the business id.orderService
- The orderservice object.l
-- Returns:
- The valid auth token.
-
doubleToBigDecimal
-