Package com.skava.oms.flow.adapter
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 Summary
FieldsModifier and TypeFieldDescriptionstatic final int
The Constant BIG_DECIMAL_SCALE.static final String
Payment type - LOYALTYstatic final String
Payment type - NON CASHprotected static final String
The Constant FALSEstatic final String
The Constant PROP_ELIGIBLE_POINTS_TO_PAYstatic final String
The Constant PROP_PAY_BY_LOYALTY_POINTSstatic final String
The Constant PROP_REDEEM_LOYALTY_PROPERTYprotected static final String
The Constant TRUEFields inherited from class com.skava.oms.flow.AbstractOrderSynchronousProcessFlowAdapter
omsEventService, orderService
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic Boolean
checkItemForNonCashPayment
(OrderItem sfItem) This method is used to check if a product is eligible for Non Cash payment or notstatic BigDecimal
This method is used to get sum of price of all eligible items for redemptionstatic Boolean
isLastItemForNonCashPayment
(Order order, OrderItem sfItem) This method is used to check if the item is last item in the list for loyalty paymentvoid
process
(org.camunda.bpm.engine.delegate.DelegateExecution execution, OrderProcessData orderProcessData, Order order) Every adapter should override this methodstatic 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.static Math[]
setPaymentIdForShipping
(Math[] orderShippingItemMath, List<Payment> nonCashPayments) This method is to set paymentId for shippingsetPaymentIdForShipping
(Math orderShippingItemMath, List<Payment> nonCashPayments) This method is to set paymentId for shippingstatic 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.static void
updateOrderItems
(Order orderOms) This method is used to update the ordered items.com.skava.core.event.Message<PreProcessPaymentPayload>
updatePayload
(com.skava.core.event.Message<PreProcessPaymentPayload> messagePayload, Order order) Updates the original payload with required additional datastatic 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.Methods inherited from class com.skava.oms.flow.AbstractOrderSynchronousProcessFlowAdapter
execute
-
Field Details
-
REDEEM_LOYALTY_PROPERTY
The Constant PROP_REDEEM_LOYALTY_PROPERTY- See Also:
-
PROP_PAY_BY_LOYALTY_POINTS
The Constant PROP_PAY_BY_LOYALTY_POINTS- See Also:
-
CONST_PAYMENT_TYPE_LOYALTY
Payment type - LOYALTY- See Also:
-
BIG_DECIMAL_SCALE
public static final int BIG_DECIMAL_SCALEThe Constant BIG_DECIMAL_SCALE.- See Also:
-
PROP_ELIGIBLE_POINTS_TO_PAY
The Constant PROP_ELIGIBLE_POINTS_TO_PAY- See Also:
-
TRUE
The Constant TRUE- See Also:
-
FALSE
The Constant FALSE- See Also:
-
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 payloadorder
- 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 classAbstractOrderSynchronousProcessFlowAdapter
- Parameters:
execution
- - Execution of the BPMNorderProcessData
- - contains the order dataorder
- - order object in current process
-
updateOrderItems
This method is used to update the ordered items.- Parameters:
orderOms
- Indicates aOrder
, contains the order informationsfCart
- Indicates aSFCart
, contains the entire cart of the customerbinName
- Indicates a name of the binproductPropertyToEarnRewards
- Indicates the reward value product propertyenableZeroCheckout
- Indicates the Zero checkout property valueisB2B2C
- 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 aSFItem
, contains the item details that can be placed in a cartsfCart
- Indicates aSFCart
, contains the entire cart of the customernonCashPayments
- Indicates the identifier of the payment in order to calculate the order shipping itemcashPayments
- Indicates the identifier of the payment in order to calculate the order shipping itemcommonVar
- Contains binName and enableZeroCheckoutpaymentBalanceMap
- 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 valuenonCashPayments
- 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 informationtotalSaleWithTax
- Indicates the total sale value with taxcashPayment
- Indicates the cash payment informationpaymentItem
- Indicates the Payment item informationvalue
- Indicates the payment valueisB2B2C
- isB2B2C
-
getTotalPriceForEligibleItems
This method is used to get sum of price of all eligible items for redemption- Parameters:
sfCart
- Indicates aSFCart
, contains the entire cart of the customer- Returns:
- the corresponding BigDecimal value
-
isLastItemForNonCashPayment
This method is used to check if the item is last item in the list for loyalty payment- Parameters:
sfCart
- Indicates aSFCart
, contains the entire cart of the customersfItem
- Indicates aSFItem
, contains the item details that can be placed in a cart- Returns:
- the corresponding Boolean value
-
checkItemForNonCashPayment
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 itemnonCashPayments
- 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 valuenonCashPayments
- Indicates a list of Payment information- Returns:
- List of Math information
-