Class PreProcessUtil

java.lang.Object
com.skava.oms.util.PreProcessUtil

@Component public final class PreProcessUtil extends Object
The class PreProcessUtil
Author:
Infosys Equinox
  • Field Details

    • KEY_LOYALTY_EVENT_NAME

      public static final String KEY_LOYALTY_EVENT_NAME
      The constant KEY_LOYALTY_EVENT_NAME
      See Also:
    • KEY_LOYALTY_QUEUE_NAME

      public static final String KEY_LOYALTY_QUEUE_NAME
      The constant KEY_LOYALTY_QUEUE_NAME
      See Also:
    • KEY_LOYALTY_ATTRIBUTE_NAME

      public static final String KEY_LOYALTY_ATTRIBUTE_NAME
      The constant KEY_LOYALTY_ATTRIBUTE_NAME
      See Also:
    • MESSAGE_TYPE_GET_REWARDS

      public static final String MESSAGE_TYPE_GET_REWARDS
      The constant MESSAGE_TYPE_GET_REWARDS
      See Also:
    • KEY_PROCESS_ID

      public static final String KEY_PROCESS_ID
      The constant KEY_PROCESS_ID
      See Also:
    • KEY_PV_VALUE

      public static final String KEY_PV_VALUE
      The constant KEY_PV_VALUE
      See Also:
    • KEY_IS_SUBSCRIPTION_ITEM

      public static final String KEY_IS_SUBSCRIPTION_ITEM
      The constant KEY_IS_SUBSCRIPTION_ORDER
      See Also:
    • authProps

      @Autowired public com.skava.core.properties.AuthorizationProperties authProps
      auth properties
    • authTokenHandler

      @Autowired public com.skava.core.auth.AuthTokenHandler authTokenHandler
      Auth token Handler
  • Constructor Details

    • PreProcessUtil

      public PreProcessUtil()
  • Method Details

    • getEffectiveOrderDate

      public static long getEffectiveOrderDate(Order order)
      Fetches effective order date
      Parameters:
      order -
      Returns:
    • getIsBackDateOrder

      public static boolean getIsBackDateOrder(Order order)
      Fetches isBackDate order or not
      Parameters:
      order -
      Returns:
    • isStarterKitItemAvailable

      public static boolean isStarterKitItemAvailable(Order order)
      Parameters:
      order -
      Returns:
    • audit

      public static void audit(com.skava.core.event.Message<PreProcessLoyaltyEventRequestPayload> omsMessage)
      Audit logs the given loyalty message.
      Parameters:
      omsMessage -
    • eligibleForLoyalty

      public static boolean eligibleForLoyalty(Order order)
      Checks if the given order is eligible for loyalty transaction
      Parameters:
      order -
      Returns:
    • hasValidValue

      public static boolean hasValidValue(Map<String,String> props, String key)
      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

      public static Map<String,Object> getHeaders(OrderProcessData orderProcessData)
      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

      public String getAuthToken(String userId)
      Fetches the authToken with super admin privileges and given userId
      Parameters:
      userId -
      Returns:
    • getLoyaltyRequestParams

      public static PreProcessLoyaltyEventParams getLoyaltyRequestParams(Order order, String processMode)
      Fetches the request params for loyalty event payload
      Parameters:
      order -
      Returns:
    • getUserName

      public static String getUserName(Order order)
      Get the userName for loyalty event payload
      Parameters:
      order -
      Returns:
    • getLoyaltyUserDetails

      public static void getLoyaltyUserDetails(Order order, LoyaltyDetailsRequest loyaltyRequest)
      Get the userName for loyalty event payload
      Parameters:
      order - contains order details.
      loyaltyRequest - contains loyaltyRequest.
    • maskUserData

      public static String maskUserData(String eventPayload)
      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

      public static String getParentTransactionId(LoyaltyDetails loyaltyDetails)
      This method is used to get parentTransactionId.
      Parameters:
      loyaltyDetails - holds loyaltDetail
      Returns:
      parentTransactionId String value.
    • getVoucherRedemptionIds

      public static List<String> getVoucherRedemptionIds(LoyaltyDetails loyaltyDetails)
      This method is used to get VoucherRedemptionIds.
      Parameters:
      loyaltyDetails - holds loyaltDetail
      Returns:
      VoucherRedemptionIds list value.
    • maskShippingAddress

      public static String maskShippingAddress(String itemShippedStr)
      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.