Oracle ATG – How to remove creditcard from Order?

Oracle ATG – How to remove creditcard from ATG Order?

  1. Pass the Order to the method from which the credit card payment group has to be removed
  2. Get the OrderManger (To be be injected into the component)
  3. Get the credit card  using the OrderManager passing the order
  4. Get the PaymentGroupManager using the OrderManager
  5. Using the PaymentGroupManager  removePaymentGroupFromOrder() remove the credit card payment group by passing the order and credit card id.

request

Sample Code

private void removeCreditCards(Order order) throws CommerceException
{
  boolean exception = false;
  TSOrderManager orderManager = (TSOrderManager)getOrderManager();
 
  if (isLoggingDebug()) 
  {
     logDebug("Inside removeCreditCards");
  }
 
  while (orderManager.getCreditCard(order) != null)
  {
     CreditCard cc = orderManager.getCreditCard(order);
     if (isLoggingDebug())
     { 
        logDebug("Removing Credit Card payment group: " + cc.getId());
     }
 
     PaymentGroupManager 
             payGroupManager = orderManager.getPaymentGroupManager();
     payGroupManager.removePaymentGroupFromOrder(order, cc.getId());
  }
}

 

2,432 total views, 5 views today

1 Comment

  1. Abdullah Ahmad

    February 26, 2015

    Thanks for the post, I hav 2 questions:

    1- What is the class TSOrderManager. Is it your custmization class as I can’t find this method in it: getCreditCard(order)

    2- Is the credit card payment group added by default with the order & why?

    Reply

Add comment