/**
  * Convenience method to find a pricing field by name.
  *
  * @param fields pricing fields
  * @param fieldName name
  * @return found pricing field or null if no field found.
  */
 public static PricingField find(List<PricingField> fields, String fieldName) {
   if (fields != null) {
     for (PricingField field : fields) {
       if (field.getName().equals(fieldName)) return field;
     }
   }
   return null;
 }
 public ValidatePurchaseWS validatePurchase(Integer userId, Integer itemId, PricingField[] fields)
     throws JbillingAPIException {
   try {
     return session.validatePurchase(userId, itemId, PricingField.setPricingFieldsValue(fields));
   } catch (Exception e) {
     throw new JbillingAPIException(e);
   }
 }
 public ItemDTOEx getItem(Integer itemId, Integer userId, PricingField[] fields)
     throws JbillingAPIException {
   try {
     return session.getItem(itemId, userId, PricingField.setPricingFieldsValue(fields));
   } catch (Exception e) {
     throw new JbillingAPIException(e);
   }
 }
 public OrderWS updateCurrentOrder(
     Integer userId,
     OrderLineWS[] lines,
     PricingField[] fields,
     Date date,
     String eventDescription)
     throws JbillingAPIException {
   try {
     return session.updateCurrentOrder(
         userId, lines, PricingField.setPricingFieldsValue(fields), date, eventDescription);
   } catch (Exception e) {
     throw new JbillingAPIException(e);
   }
 }
 public ValidatePurchaseWS validateMultiPurchase(
     Integer userId, Integer[] itemIds, PricingField[][] fields) throws JbillingAPIException {
   try {
     String[] pricingFields = null;
     if (fields != null) {
       pricingFields = new String[fields.length];
       for (int i = 0; i < pricingFields.length; i++) {
         pricingFields[i] = PricingField.setPricingFieldsValue(fields[i]);
       }
     }
     return session.validateMultiPurchase(userId, itemIds, pricingFields);
   } catch (Exception e) {
     throw new JbillingAPIException(e);
   }
 }