Package com.skava.oms.flow.util
Class PaymentUtil
java.lang.Object
com.skava.oms.flow.util.PaymentUtil
This class handles event triggering to external services during order / item cancellation
- Since:
- 20-Aug-2018 This class contains the delegate for Cancel Order or Items
- Author:
- Infosys Equinox
-
Method Summary
Modifier and TypeMethodDescriptionstatic List<PaymentServiceTransaction>
authorizeOrder
(Order order) This method will set the type ,status and payment itemId for the payLoad.static List<PaymentServiceTransaction>
buildTrasactionForPayment
(Order order, Map<String, BigDecimal> paymentValues, PaymentStatus[] staus, boolean isChargeTrans) static void
checkAndSetTransaction
(Payment[] payments, PaymentServiceTransaction transaction, String createBy) This method checks the payment and the payment item and it sets the transactionsstatic Map<String,
BigDecimal> getLoyaltyPaymentValues
(Map<String, BigDecimal> loyaltyPaymentValues) Used to handle payments for loyalty voucher used casesstatic String
getPaymentCollectionId
(Order order) This method return payment collection id form orderstatic Map<String,
BigDecimal> getPaymentValues
(List<OrderItem> mapReturns, boolean forReturn) This method return payment items for refund or charge amount.static void
payloadWithError
(Order order, Object payloadVar, String paymentResponse) This method will add transaction to the payment and order, when payment fails.static void
processPayload
(Order order, Object payloadVar, String response) Payload process get it from inventory services This method process the payload and adds transaction to every orderitemstatic void
processPayload
(org.camunda.bpm.engine.delegate.DelegateExecution execution, Order order, Object payloadVar) Payload process get it from inventory services This method process the payload and adds transaction to every orderitemstatic List<PaymentServiceTransaction>
unAuthorizeOrder
(Order order) This method will set the status of the payment service from the payment flowstatic void
updateLoyaltyTransaction
(LoyaltyServiceTransaction transaction, LoyaltyDetails[] loyaltyDetails) Update the LoyaltyTransaction for loyalty event payload
-
Method Details
-
buildTrasactionForPayment
public static List<PaymentServiceTransaction> buildTrasactionForPayment(Order order, Map<String, BigDecimal> paymentValues, PaymentStatus[] staus, boolean isChargeTrans) - Parameters:
order
- - To get payementpaymentValues
- - Value to process for paymentstaus
- - Which payment item going to performisChargeTrans
- - Boolean flag to payment are charge or reverse- Returns:
- - List of payment transaction Debug logger has been added to this method.
-
checkAndSetTransaction
public static void checkAndSetTransaction(Payment[] payments, PaymentServiceTransaction transaction, String createBy) This method checks the payment and the payment item and it sets the transactions- Parameters:
payments
- - Add transaction to the paymentstransaction
- - transaction object in the current process.createBy
- - which delegate triggers this method Debug logger has been added to this method.
-
getPaymentValues
public static Map<String,BigDecimal> getPaymentValues(List<OrderItem> mapReturns, boolean forReturn) This method return payment items for refund or charge amount.- Parameters:
mapReturns
- - list of items which are going to ship or unable to shipforReturn
- - indicates whether item is for return or not- Returns:
- - Payment values for each payment id Debug logger has been added to this method.
-
getLoyaltyPaymentValues
public static Map<String,BigDecimal> getLoyaltyPaymentValues(Map<String, BigDecimal> loyaltyPaymentValues) Used to handle payments for loyalty voucher used cases- Parameters:
loyaltyPaymentValues
-
-
getPaymentCollectionId
This method return payment collection id form order- Parameters:
order
- - To get collection id- Returns:
- payment collection id
-
unAuthorizeOrder
This method will set the status of the payment service from the payment flow- Parameters:
order
- - order to be unauthorized- Returns:
- - the payLoad payment with changed status Debug logger has been added to this method.
-
authorizeOrder
This method will set the type ,status and payment itemId for the payLoad.- Parameters:
order
- - order to be authorized- Returns:
- - the changed status and other properties. Debug logger has been added to this method.
-
payloadWithError
This method will add transaction to the payment and order, when payment fails.- Parameters:
order
- - order to be updated.paymentResponse
- - payment response message from every servicepayloadVar
- - payload from payment event.
-
processPayload
Payload process get it from inventory services This method process the payload and adds transaction to every orderitem- Parameters:
order
- order to be processedpayloadVar
- contains the payload variableresponse
- contains response information
-
updateLoyaltyTransaction
public static void updateLoyaltyTransaction(LoyaltyServiceTransaction transaction, LoyaltyDetails[] loyaltyDetails) Update the LoyaltyTransaction for loyalty event payload- Parameters:
transaction
- - holds loyalty transaction response messgage.loyaltyDetails
- - contains order loyaltyDetails.
-
processPayload
public static void processPayload(org.camunda.bpm.engine.delegate.DelegateExecution execution, Order order, Object payloadVar) Payload process get it from inventory services This method process the payload and adds transaction to every orderitem- Parameters:
execution
-order
- - placed order objectpayloadVar
- - payload object to undo the payment process- Throws:
JsonProcessingException
- - when there is an error in JSON
-