Class PaymentUtil

java.lang.Object
com.skava.oms.flow.util.PaymentUtil

public final class PaymentUtil extends Object
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 Details

    • buildTrasactionForPayment

      public static List<PaymentServiceTransaction> buildTrasactionForPayment(Order order, Map<String,BigDecimal> paymentValues, PaymentStatus[] staus, boolean isChargeTrans)
      Parameters:
      order - - To get payement
      paymentValues - - Value to process for payment
      staus - - Which payment item going to perform
      isChargeTrans - - 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 payments
      transaction - - 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 ship
      forReturn - - 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

      public static String getPaymentCollectionId(Order order)
      This method return payment collection id form order
      Parameters:
      order - - To get collection id
      Returns:
      payment collection id
    • unAuthorizeOrder

      public static List<PaymentServiceTransaction> unAuthorizeOrder(Order order)
      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

      public static List<PaymentServiceTransaction> authorizeOrder(Order order)
      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

      public static void payloadWithError(Order order, Object payloadVar, String paymentResponse)
      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 service
      payloadVar - - payload from payment event.
    • processPayload

      public 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 orderitem
      Parameters:
      order - order to be processed
      payloadVar - contains the payload variable
      response - 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 object
      payloadVar - - payload object to undo the payment process
      Throws:
      JsonProcessingException - - when there is an error in JSON