Skip to content

Instantly share code, notes, and snippets.

@obedmhg
Created May 19, 2016 14:40
Show Gist options
  • Save obedmhg/05faaaeb19529271ae8b8bcc41f745a6 to your computer and use it in GitHub Desktop.
Save obedmhg/05faaaeb19529271ae8b8bcc41f745a6 to your computer and use it in GitHub Desktop.
package com.mycompany.commerce.order;
import atg.commerce.order.OrderImpl;
import atg.commerce.order.CreditCard;
import atg.commerce.order.GiftCertificate;
import com.sparkred.paypal.PayPalPaymentGroup;
public class MyCompanyOrderImpl extends OrderImpl {
/** serialVersionUID. */
private static final long serialVersionUID = -5384547034115301944L;
public String getPaymentType() {
String paymentType = null;
for (Object pgObject : getPaymentGroups()) {
if(pgObject instanceof CreditCard) {
CreditCard cc = (CreditCard)pgObject;
paymentType = cc.getCreditCardType();
break;
} else if(pgObject instanceof PayPalPaymentGroup) {
paymentType = "paypal";
break;
} else if(pgObject instanceof GiftCertificate) {
paymentType = "giftCard";
}
}
return paymentType;
}
}
beanNameToItemDescriptorMap-=\
   atg.commerce.order.OrderImpl=order
beanNameToItemDescriptorMap+=\
   com.mycompany.commerce.order.MyCompanyOrderImpl=order
 
orderTypeClassMap+=\
   shoppingcart=com.mycompany.commerce.order.MyCompanyOrderImpl,\
   default=com.mycompany.commerce.order.MyCompanyOrderImpl
   
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment