Author: jleroux
Date: Tue Aug 24 07:24:46 2010
New Revision: 988411
URL:
http://svn.apache.org/viewvc?rev=988411&view=revLog:
Adds a new ShoppingCart.CartPaymentInfo public method which uses and set an authCode. This is like PosTransaction.java.setPaymentRefNum method in POS but allows to add an authcode without having already a payment info in place, ie when creating an order at the same time.
Modified:
ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCart.java
Modified: ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCart.java
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCart.java?rev=988411&r1=988410&r2=988411&view=diff==============================================================================
--- ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCart.java (original)
+++ ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCart.java Tue Aug 24 07:24:46 2010
@@ -1519,6 +1519,22 @@ public class ShoppingCart implements Ite
return inf;
}
+ /** Creates a CartPaymentInfo object with a possible authCode (may be null) */
+ public CartPaymentInfo makePaymentInfo(String id, String refNum, String authCode, BigDecimal amount) {
+ CartPaymentInfo inf = new CartPaymentInfo();
+ inf.refNum[0] = refNum;
+ inf.refNum[1] = authCode;
+ inf.amount = amount;
+
+ if (!isPaymentMethodType(id)) {
+ inf.paymentMethodTypeId = this.getPaymentMethodTypeId(id);
+ inf.paymentMethodId = id;
+ } else {
+ inf.paymentMethodTypeId = id;
+ }
+ return inf;
+ }
+
/** Locates the index of an existing CartPaymentInfo object or -1 if none found */
public int getPaymentInfoIndex(String id, String refNum) {
CartPaymentInfo thisInf = this.makePaymentInfo(id, refNum, null);
@@ -1561,7 +1577,7 @@ public class ShoppingCart implements Ite
/** Locates an existing (or creates a new) CartPaymentInfo object */
public CartPaymentInfo getPaymentInfo(String id, String refNum, String authCode, BigDecimal amount, boolean update) {
- CartPaymentInfo thisInf = this.makePaymentInfo(id, refNum, amount);
+ CartPaymentInfo thisInf = this.makePaymentInfo(id, refNum, authCode, amount);
Iterator i = paymentInfo.iterator();
while (i.hasNext()) {
CartPaymentInfo inf = (CartPaymentInfo) i.next();