Package com.skava.oms.util
Class PreProcessUtil
java.lang.Object
com.skava.oms.util.PreProcessUtil
The class PreProcessUtil
- Author:
- Infosys Equinox
-
Field Summary
FieldsModifier and TypeFieldDescriptioncom.skava.core.properties.AuthorizationProperties
auth propertiescom.skava.core.auth.AuthTokenHandler
Auth token Handlerstatic final String
The constant KEY_IS_SUBSCRIPTION_ORDERstatic final String
The constant KEY_LOYALTY_ATTRIBUTE_NAMEstatic final String
The constant KEY_LOYALTY_EVENT_NAMEstatic final String
The constant KEY_LOYALTY_QUEUE_NAMEstatic final String
The constant KEY_PROCESS_IDstatic final String
The constant KEY_PV_VALUEstatic final String
The constant MESSAGE_TYPE_GET_REWARDS -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic void
audit
(com.skava.core.event.Message<PreProcessLoyaltyEventRequestPayload> omsMessage) Audit logs the given loyalty message.static boolean
eligibleForLoyalty
(Order order) Checks if the given order is eligible for loyalty transactiongetAuthToken
(String userId) Fetches the authToken with super admin privileges and given userIdstatic long
getEffectiveOrderDate
(Order order) Fetches effective order dategetHeaders
(OrderProcessData orderProcessData) Fetches headers for loyalty transactionstatic boolean
getIsBackDateOrder
(Order order) Fetches isBackDate order or notstatic PreProcessLoyaltyEventParams
getLoyaltyRequestParams
(Order order, String processMode) Fetches the request params for loyalty event payloadstatic void
getLoyaltyRequestPayload
(Order order, Map<String, BigDecimal> paymentValues, List<LoyaltyDetailsRequest> loyaltyDetailsRequest, PreProcessLoyaltyEventRequestPayload payload) This method is used to construct the request message.static void
getLoyaltyUserDetails
(Order order, LoyaltyDetailsRequest loyaltyRequest) Get the userName for loyalty event payloadstatic String
getParentTransactionId
(LoyaltyDetails loyaltyDetails) This method is used to get parentTransactionId.static String
getUserName
(Order order) Get the userName for loyalty event payloadgetVoucherRedemptionIds
(LoyaltyDetails loyaltyDetails) This method is used to get VoucherRedemptionIds.static boolean
hasValidValue
(Map<String, String> props, String key) Checks for given order has a valid value for the given keystatic boolean
isStarterKitItemAvailable
(Order order) static String
maskShippingAddress
(String itemShippedStr) Masks shipping address within the provided string.static String
maskUserData
(String eventPayload) Masks user data within the provided event payload.static boolean
propertyValidation
(org.camunda.bpm.engine.delegate.DelegateExecution execution) static void
setLoyaltyRequest
(Order order, List<LoyaltyDetailsRequest> loyaltyDetailsRequest, PreProcessLoyaltyEventRequestPayload payload) void
triggerLoyaltyProcess
(org.camunda.bpm.engine.delegate.DelegateExecution execution, OrderProcessData orderProcessData, Order order, String loyaltyCollectionId, Map<String, Object> headers, PreProcessLoyaltyEventRequestPayload eventPayload, OrderProcessFlowService orderService)
-
Field Details
-
KEY_LOYALTY_EVENT_NAME
The constant KEY_LOYALTY_EVENT_NAME- See Also:
-
KEY_LOYALTY_QUEUE_NAME
The constant KEY_LOYALTY_QUEUE_NAME- See Also:
-
KEY_LOYALTY_ATTRIBUTE_NAME
The constant KEY_LOYALTY_ATTRIBUTE_NAME- See Also:
-
MESSAGE_TYPE_GET_REWARDS
The constant MESSAGE_TYPE_GET_REWARDS- See Also:
-
KEY_PROCESS_ID
The constant KEY_PROCESS_ID- See Also:
-
KEY_PV_VALUE
The constant KEY_PV_VALUE- See Also:
-
KEY_IS_SUBSCRIPTION_ITEM
The constant KEY_IS_SUBSCRIPTION_ORDER- See Also:
-
authProps
@Autowired public com.skava.core.properties.AuthorizationProperties authPropsauth properties -
authTokenHandler
@Autowired public com.skava.core.auth.AuthTokenHandler authTokenHandlerAuth token Handler
-
-
Constructor Details
-
PreProcessUtil
public PreProcessUtil()
-
-
Method Details
-
getEffectiveOrderDate
Fetches effective order date- Parameters:
order
-- Returns:
-
getIsBackDateOrder
Fetches isBackDate order or not- Parameters:
order
-- Returns:
-
isStarterKitItemAvailable
- Parameters:
order
-- Returns:
-
audit
public static void audit(com.skava.core.event.Message<PreProcessLoyaltyEventRequestPayload> omsMessage) Audit logs the given loyalty message.- Parameters:
omsMessage
-
-
eligibleForLoyalty
Checks if the given order is eligible for loyalty transaction- Parameters:
order
-- Returns:
-
hasValidValue
Checks for given order has a valid value for the given key- Parameters:
props
-key
-- Returns:
-
propertyValidation
public static boolean propertyValidation(org.camunda.bpm.engine.delegate.DelegateExecution execution) - Parameters:
execution
-- Returns:
- true if required properties exists
-
getHeaders
Fetches headers for loyalty transaction- Parameters:
orderProcessData
-- Returns:
-
triggerLoyaltyProcess
public void triggerLoyaltyProcess(org.camunda.bpm.engine.delegate.DelegateExecution execution, OrderProcessData orderProcessData, Order order, String loyaltyCollectionId, Map<String, Object> headers, PreProcessLoyaltyEventRequestPayload eventPayload, OrderProcessFlowService orderService) - Parameters:
execution
-orderProcessData
-order
-loyaltyCollectionId
-headers
-eventPayload
-orderService
-
-
getAuthToken
Fetches the authToken with super admin privileges and given userId- Parameters:
userId
-- Returns:
-
getLoyaltyRequestParams
Fetches the request params for loyalty event payload- Parameters:
order
-- Returns:
-
getUserName
Get the userName for loyalty event payload- Parameters:
order
-- Returns:
-
getLoyaltyUserDetails
Get the userName for loyalty event payload- Parameters:
order
- contains order details.loyaltyRequest
- contains loyaltyRequest.
-
maskUserData
Masks user data within the provided event payload. Specifically, it replaces the 'userId' and 'userName' with 'XXXXXX'.- Parameters:
eventPayload
- contains the model for Loyalty event.- Returns:
- the masked eventPayload.
-
getLoyaltyRequestPayload
public static void getLoyaltyRequestPayload(Order order, Map<String, BigDecimal> paymentValues, List<LoyaltyDetailsRequest> loyaltyDetailsRequest, PreProcessLoyaltyEventRequestPayload payload) This method is used to construct the request message.- Parameters:
order
-paymentValues
-loyaltyDetailsRequest
-payload
-
-
setLoyaltyRequest
public static void setLoyaltyRequest(Order order, List<LoyaltyDetailsRequest> loyaltyDetailsRequest, PreProcessLoyaltyEventRequestPayload payload) - Parameters:
order
-loyaltyDetailsRequest
-payload
-
-
getParentTransactionId
This method is used to get parentTransactionId.- Parameters:
loyaltyDetails
- holds loyaltDetail- Returns:
- parentTransactionId String value.
-
getVoucherRedemptionIds
This method is used to get VoucherRedemptionIds.- Parameters:
loyaltyDetails
- holds loyaltDetail- Returns:
- VoucherRedemptionIds list value.
-
maskShippingAddress
Masks shipping address within the provided string. For eg. specifically, it replaces the 'firstname' with 'XXXXXX'.- Parameters:
itemShippedStr
- contains details of the Order Items.- Returns:
- the masked itemShippedStr.
-