This page is intended to be the root of cookbooks and/or FAQ (work in progress FAQ and cookbook will perhaps be separated later)
[Changing a field type in Derby|*field type in Derby]*
[Use cvv codes in OFBiz|*cvv codes]*
----
Changing a field type in Derby
- Export the table to xml
- Drop the table
- Start OFBiz - table recreated with new structure
- Import xml data from #1
Advice from Adrian Crum.
----
Use cvv codes in OFBiz
The code is already written in the OrderPaymentPreference.securityCode field and then removed by the sysytem alter the transaction is done.
One quick way to enable it is this:
1) add the following input field to the billsettings.ftl file (order component):
<input type="text" size="4" class="inputBox" name="securityCode_$
" value=""/>
2) add the following code to the CheckOutEvents.getSelectedPaymentMethods(...):
String securityCode = request.getParameter("securityCode_" + paymentMethods[i]);
if (securityCode != null && securityCode.length() > 0)
the trick here is that you'll have to change the paymentMethodInfo from a list to a map
3) in CheckOutHelper.setCheckOutPaymentInternal(...) you'll have to retrieve the cvv value from the above map; here is the method from an older modified version of OFBiz:
public List setCheckOutPaymentInternal(Map selectedPaymentMethods, List singleUsePayments, String billingAccountId, Double billingAccountAmt)
// set the payment method option
if (selectedPaymentMethods != null && selectedPaymentMethods.size() > 0)
else if ("NA".equals(billingAccountId))
// TODO: the following code needs some review (JAC20061213)
// if checkoutPaymentId == EXT_BILLACT, then we have billing account only, so make sure we have enough credit
if (selectedPaymentMethods.containsKey("EXT_BILLACT") && selectedPaymentMethods.size() == 1)
else
// check that the amount to use is enough to fulfill the order
double grandTotal = cart.getGrandTotal();
if (grandTotal > amountToUse)
else
// associate the cart billing account amount and EXT_BILLACT selected payment method with whatever amount we have now
// XXX: Note that this step is critical for the billing account to be charged correctly
if (amountToUse > 0)
}
Set paymentMethods = selectedPaymentMethods.keySet();
Iterator i = paymentMethods.iterator();
while (i.hasNext())
boolean singleUse = singleUsePayments.contains(checkOutPaymentId);
cart.addPaymentAmount(checkOutPaymentId, paymentAmount, singleUse);
ShoppingCart.CartPaymentInfo cpi = cart.getPaymentInfo(cart.selectedPayments() - 1);
cpi.securityCode = securityCode;
}
} else if (cart.getGrandTotal() != 0.00)
return errorMessages;
}
Jacopo Cappellato [28/févr./07 11:52 PM]