Class UpdateOrderPaymentDelegate

java.lang.Object
com.skava.oms.flow.AbstractOrderSynchronousProcessFlowAdapter
com.skava.oms.flow.adapter.UpdateOrderPaymentDelegate
All Implemented Interfaces:
org.camunda.bpm.engine.delegate.JavaDelegate

@Component public class UpdateOrderPaymentDelegate extends AbstractOrderSynchronousProcessFlowAdapter
This class UpdateOrderPaymentDelegate defines the flow for pre-process payment
Since:
Aug 2024
Author:
Infosys Equinox
  • Field Details

    • REDEEM_LOYALTY_PROPERTY

      public static final String REDEEM_LOYALTY_PROPERTY
      The Constant PROP_REDEEM_LOYALTY_PROPERTY
      See Also:
    • PROP_PAY_BY_LOYALTY_POINTS

      public static final String PROP_PAY_BY_LOYALTY_POINTS
      The Constant PROP_PAY_BY_LOYALTY_POINTS
      See Also:
    • CONST_PAYMENT_TYPE_LOYALTY

      public static final String CONST_PAYMENT_TYPE_LOYALTY
      Payment type - LOYALTY
      See Also:
    • BIG_DECIMAL_SCALE

      public static final int BIG_DECIMAL_SCALE
      The Constant BIG_DECIMAL_SCALE.
      See Also:
    • PROP_ELIGIBLE_POINTS_TO_PAY

      public static final String PROP_ELIGIBLE_POINTS_TO_PAY
      The Constant PROP_ELIGIBLE_POINTS_TO_PAY
      See Also:
    • TRUE

      protected static final String TRUE
      The Constant TRUE
      See Also:
    • FALSE

      protected static final String FALSE
      The Constant FALSE
      See Also:
    • CONST_PAYMENT_TYPE_NONCASH

      public static final String CONST_PAYMENT_TYPE_NONCASH
      Payment type - NON CASH
      See Also:
  • Constructor Details

    • UpdateOrderPaymentDelegate

      public UpdateOrderPaymentDelegate()
  • Method Details

    • updatePayload

      public com.skava.core.event.Message<PreProcessPaymentPayload> updatePayload(com.skava.core.event.Message<PreProcessPaymentPayload> messagePayload, Order order)
      Updates the original payload with required additional data
      Parameters:
      messagePayload - holds the message payload
      order - holds the order details
      Returns:
      Message
    • process

      public void process(org.camunda.bpm.engine.delegate.DelegateExecution execution, OrderProcessData orderProcessData, Order order)
      Description copied from class: AbstractOrderSynchronousProcessFlowAdapter
      Every adapter should override this method
      Specified by:
      process in class AbstractOrderSynchronousProcessFlowAdapter
      Parameters:
      execution - - Execution of the BPMN
      orderProcessData - - contains the order data
      order - - order object in current process
    • updateOrderItems

      public static void updateOrderItems(Order orderOms)
      This method is used to update the ordered items.
      Parameters:
      orderOms - Indicates a Order, contains the order information
      sfCart - Indicates a SFCart, contains the entire cart of the customer
      binName - Indicates a name of the bin
      productPropertyToEarnRewards - Indicates the reward value product property
      enableZeroCheckout - Indicates the Zero checkout property value
      isB2B2C - Indicates the store type.
    • updateOrderItem

      public static OrderItem updateOrderItem(OrderItem sfItem, Order order, List<Payment> nonCashPayments, List<Payment> cashPayments, Map<String,BigDecimal> paymentBalanceMap, Map<String,String> commonVar)
      This method is used to update an order item.
      Parameters:
      sfItem - Indicates a SFItem, contains the item details that can be placed in a cart
      sfCart - Indicates a SFCart, contains the entire cart of the customer
      nonCashPayments - Indicates the identifier of the payment in order to calculate the order shipping item
      cashPayments - Indicates the identifier of the payment in order to calculate the order shipping item
      commonVar - Contains binName and enableZeroCheckout
      paymentBalanceMap - Indicates a paymentBalanceMap
      Returns:
      Returns a OrderItem, contains the order item details
    • setPaymentIdForShipping

      public static Math[] setPaymentIdForShipping(Math[] orderShippingItemMath, List<Payment> nonCashPayments)
      This method is to set paymentId for shipping
      Parameters:
      orderShippingItemMath - Indicates the Math value
      nonCashPayments - Indicates a list of Payment information
      Returns:
      List of Math information
    • updatePaymentBalanceMap

      public static void updatePaymentBalanceMap(Map<String,BigDecimal> paymentBalanceMap, BigDecimal totalSaleWithTax, Payment cashPayment, PaymentItem paymentItem, BigDecimal value, String isB2B2C)
      This method is to update payment balance map based on payment type.
      Parameters:
      paymentBalanceMap - Indicates the payment balance map information
      totalSaleWithTax - Indicates the total sale value with tax
      cashPayment - Indicates the cash payment information
      paymentItem - Indicates the Payment item information
      value - Indicates the payment value
      isB2B2C - isB2B2C
    • getTotalPriceForEligibleItems

      public static BigDecimal getTotalPriceForEligibleItems(Order order)
      This method is used to get sum of price of all eligible items for redemption
      Parameters:
      sfCart - Indicates a SFCart, contains the entire cart of the customer
      Returns:
      the corresponding BigDecimal value
    • isLastItemForNonCashPayment

      public static Boolean isLastItemForNonCashPayment(Order order, OrderItem sfItem)
      This method is used to check if the item is last item in the list for loyalty payment
      Parameters:
      sfCart - Indicates a SFCart, contains the entire cart of the customer
      sfItem - Indicates a SFItem, contains the item details that can be placed in a cart
      Returns:
      the corresponding Boolean value
    • checkItemForNonCashPayment

      public static Boolean checkItemForNonCashPayment(OrderItem sfItem)
      This method is used to check if a product is eligible for Non Cash payment or not
      Parameters:
      sfItem - refers to Cart product
      Returns:
      toRet
    • setPaymentForFullDiscountItem

      public static Math[] setPaymentForFullDiscountItem(Math itemMath, List<Payment> nonCashPayments, List<Payment> cashPayments)
      This method is used to set the payment for the item with full discounts or totalSale is zero.
      Parameters:
      itemMath - indicates the math of the item
      nonCashPayments - indicates the list of non-cash payments.
      cashPayments - indicated the list of cash payments.
      Returns:
      List of Math information
    • setPaymentIdForShipping

      public static List<Math> setPaymentIdForShipping(Math orderShippingItemMath, List<Payment> nonCashPayments)
      This method is to set paymentId for shipping
      Parameters:
      orderShippingItemMath - Indicates the Math value
      nonCashPayments - Indicates a list of Payment information
      Returns:
      List of Math information