You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by jl...@apache.org on 2009/11/19 18:26:04 UTC
svn commit: r882210 [2/2] - in
/ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting: ./ invoice/
payment/ period/ tax/ test/ thirdparty/clearcommerce/
thirdparty/gosoftware/ thirdparty/valuelink/ util/
Modified: ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/thirdparty/gosoftware/RitaServices.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/thirdparty/gosoftware/RitaServices.java?rev=882210&r1=882209&r2=882210&view=diff
==============================================================================
--- ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/thirdparty/gosoftware/RitaServices.java (original)
+++ ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/thirdparty/gosoftware/RitaServices.java Thu Nov 19 17:26:03 2009
@@ -18,31 +18,30 @@
*******************************************************************************/
package org.ofbiz.accounting.thirdparty.gosoftware;
-import java.util.Map;
-import java.util.Properties;
-import java.util.List;
import java.io.IOException;
import java.math.BigDecimal;
-import java.text.DecimalFormat;
import java.sql.Timestamp;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
-import org.ofbiz.service.DispatchContext;
-import org.ofbiz.service.ServiceUtil;
-import org.ofbiz.service.LocalDispatcher;
-import org.ofbiz.service.GenericServiceException;
-import org.ofbiz.base.util.GeneralException;
+import org.ofbiz.accounting.payment.PaymentGatewayServices;
import org.ofbiz.base.util.Debug;
-import org.ofbiz.base.util.UtilMisc;
+import org.ofbiz.base.util.GeneralException;
import org.ofbiz.base.util.StringUtil;
+import org.ofbiz.base.util.UtilDateTime;
+import org.ofbiz.base.util.UtilMisc;
import org.ofbiz.base.util.UtilNumber;
-import org.ofbiz.base.util.UtilValidate;
import org.ofbiz.base.util.UtilProperties;
-import org.ofbiz.base.util.UtilDateTime;
-import org.ofbiz.entity.GenericValue;
+import org.ofbiz.base.util.UtilValidate;
import org.ofbiz.entity.Delegator;
import org.ofbiz.entity.GenericEntityException;
+import org.ofbiz.entity.GenericValue;
import org.ofbiz.entity.util.EntityUtil;
-import org.ofbiz.accounting.payment.PaymentGatewayServices;
+import org.ofbiz.service.DispatchContext;
+import org.ofbiz.service.GenericServiceException;
+import org.ofbiz.service.LocalDispatcher;
+import org.ofbiz.service.ServiceUtil;
public class RitaServices {
@@ -51,7 +50,7 @@
private static int decimals = UtilNumber.getBigDecimalScale("invoice.decimals");
private static int rounding = UtilNumber.getBigDecimalRoundingMode("invoice.rounding");
- public static Map ccAuth(DispatchContext dctx, Map context) {
+ public static Map<String, Object> ccAuth(DispatchContext dctx, Map<String, Object> context) {
Properties props = buildPccProperties(context);
RitaApi api = getApi(props, "CREDIT");
if (api == null) {
@@ -91,7 +90,7 @@
}
if (out != null) {
- Map result = ServiceUtil.returnSuccess();
+ Map<String, Object> result = ServiceUtil.returnSuccess();
String resultCode = out.get(RitaApi.RESULT);
boolean passed = false;
if ("CAPTURED".equals(resultCode)) {
@@ -135,7 +134,7 @@
}
}
- public static Map ccCapture(DispatchContext dctx, Map context) {
+ public static Map<String, Object> ccCapture(DispatchContext dctx, Map<String, Object> context) {
GenericValue orderPaymentPreference = (GenericValue) context.get("orderPaymentPreference");
//lets see if there is a auth transaction already in context
@@ -172,7 +171,7 @@
}
if (out != null) {
- Map result = ServiceUtil.returnSuccess();
+ Map<String, Object> result = ServiceUtil.returnSuccess();
String resultCode = out.get(RitaApi.RESULT);
if ("CAPTURED".equals(resultCode)) {
result.put("captureResult", Boolean.TRUE);
@@ -191,15 +190,15 @@
}
}
- public static Map ccVoidRelease(DispatchContext dctx, Map context) {
+ public static Map<String, Object> ccVoidRelease(DispatchContext dctx, Map<String, Object> context) {
return ccVoid(dctx, context, false);
}
- public static Map ccVoidRefund(DispatchContext dctx, Map context) {
+ public static Map<String, Object> ccVoidRefund(DispatchContext dctx, Map<String, Object> context) {
return ccVoid(dctx, context, true);
}
- private static Map ccVoid(DispatchContext dctx, Map context, boolean isRefund) {
+ private static Map<String, Object> ccVoid(DispatchContext dctx, Map<String, Object> context, boolean isRefund) {
GenericValue orderPaymentPreference = (GenericValue) context.get("orderPaymentPreference");
//lets see if there is a auth transaction already in context
@@ -242,7 +241,7 @@
}
if (out != null) {
- Map result = ServiceUtil.returnSuccess();
+ Map<String, Object> result = ServiceUtil.returnSuccess();
String resultCode = out.get(RitaApi.RESULT);
if ("VOIDED".equals(resultCode)) {
result.put(isRefund ? "refundResult" : "releaseResult", Boolean.TRUE);
@@ -261,7 +260,7 @@
}
}
- public static Map ccCreditRefund(DispatchContext dctx, Map context) {
+ public static Map<String, Object> ccCreditRefund(DispatchContext dctx, Map<String, Object> context) {
GenericValue orderPaymentPreference = (GenericValue) context.get("orderPaymentPreference");
//lets see if there is a auth transaction already in context
@@ -306,7 +305,7 @@
}
if (out != null) {
- Map result = ServiceUtil.returnSuccess();
+ Map<String, Object> result = ServiceUtil.returnSuccess();
String resultCode = out.get(RitaApi.RESULT);
if ("CAPTURED".equals(resultCode)) {
result.put("refundResult", Boolean.TRUE);
@@ -325,7 +324,7 @@
}
}
- public static Map ccRefund(DispatchContext dctx, Map context) {
+ public static Map<String, Object> ccRefund(DispatchContext dctx, Map<String, Object> context) {
LocalDispatcher dispatcher = dctx.getDispatcher();
Delegator delegator = dctx.getDelegator();
GenericValue orderPaymentPreference = (GenericValue) context.get("orderPaymentPreference");
@@ -344,7 +343,7 @@
Timestamp orderDate = orderHeader.getTimestamp("orderDate");
GenericValue terminalState = null;
try {
- List states = delegator.findByAnd("PosTerminalState", UtilMisc.toMap("posTerminalId", terminalId));
+ List<GenericValue> states = delegator.findByAnd("PosTerminalState", UtilMisc.toMap("posTerminalId", terminalId));
states = EntityUtil.filterByDate(states, UtilDateTime.nowTimestamp(), "openedDate", "closedDate", true);
terminalState = EntityUtil.getFirst(states);
} catch (GenericEntityException e) {
@@ -362,7 +361,7 @@
}
}
- Map refundResp = null;
+ Map<String, Object> refundResp = null;
try {
if (isVoid) {
refundResp = dispatcher.runSync("ritaCCVoidRefund", context);
@@ -379,14 +378,14 @@
}
}
- private static void setCreditCardInfo(RitaApi api, Delegator delegator, Map context) throws GeneralException {
+ private static void setCreditCardInfo(RitaApi api, Delegator delegator, Map<String, Object> context) throws GeneralException {
GenericValue orderPaymentPreference = (GenericValue) context.get("orderPaymentPreference");
GenericValue creditCard = (GenericValue) context.get("creditCard");
if (creditCard == null) {
creditCard = delegator.findByPrimaryKey("CreditCard", UtilMisc.toMap("paymentMethodId", orderPaymentPreference.getString("paymentMethodId")));
}
if (creditCard != null) {
- List expDateList = StringUtil.split(creditCard.getString("expireDate"), "/");
+ List<String> expDateList = StringUtil.split(creditCard.getString("expireDate"), "/");
String month = (String) expDateList.get(0);
String year = (String) expDateList.get(1);
String y2d = year.substring(2);
@@ -483,7 +482,7 @@
return api;
}
- private static Properties buildPccProperties(Map context) {
+ private static Properties buildPccProperties(Map<String, Object> context) {
String configString = (String) context.get("paymentConfig");
if (configString == null) {
configString = "payment.properties";
@@ -527,7 +526,7 @@
return props;
}
- private static String getAmountString(Map context, String amountField) {
+ private static String getAmountString(Map<String, Object> context, String amountField) {
BigDecimal processAmount = (BigDecimal) context.get(amountField);
return processAmount.setScale(decimals, rounding).toPlainString();
}
Modified: ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/thirdparty/valuelink/ValueLinkApi.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/thirdparty/valuelink/ValueLinkApi.java?rev=882210&r1=882209&r2=882210&view=diff
==============================================================================
--- ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/thirdparty/valuelink/ValueLinkApi.java (original)
+++ ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/thirdparty/valuelink/ValueLinkApi.java Thu Nov 19 17:26:03 2009
@@ -30,8 +30,6 @@
import java.security.PrivateKey;
import java.security.PublicKey;
import java.security.spec.InvalidKeySpecException;
-import java.text.DecimalFormat;
-import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
@@ -62,8 +60,8 @@
import org.ofbiz.base.util.HttpClient;
import org.ofbiz.base.util.HttpClientException;
import org.ofbiz.base.util.StringUtil;
+import org.ofbiz.base.util.UtilGenerics;
import org.ofbiz.base.util.UtilMisc;
-import org.ofbiz.base.util.UtilProperties;
import org.ofbiz.entity.Delegator;
import org.ofbiz.entity.GenericEntityException;
import org.ofbiz.entity.GenericValue;
@@ -76,7 +74,7 @@
public static final String module = ValueLinkApi.class.getName();
// static object cache
- private static Map objectCache = new HashMap();
+ private static Map<String, ValueLinkApi> objectCache = new HashMap<String, ValueLinkApi>();
// instance variables
protected Delegator delegator = null;
@@ -120,10 +118,10 @@
throw new IllegalArgumentException("Properties cannot be null");
}
- ValueLinkApi api = (ValueLinkApi) objectCache.get(merchantId);
+ ValueLinkApi api = objectCache.get(merchantId);
if (api == null || reload) {
synchronized(ValueLinkApi.class) {
- api = (ValueLinkApi) objectCache.get(merchantId);
+ api = objectCache.get(merchantId);
if (api == null || reload) {
api = new ValueLinkApi(delegator, props);
objectCache.put(merchantId, api);
@@ -233,7 +231,7 @@
* @return Map of response parameters
* @throws HttpClientException
*/
- public Map send(Map request) throws HttpClientException {
+ public Map<String, Object> send(Map<String, Object> request) throws HttpClientException {
return send((String) props.get("payment.valuelink.url"), request);
}
@@ -244,7 +242,7 @@
* @return Map of response parameters
* @throws HttpClientException
*/
- public Map send(String url, Map request) throws HttpClientException {
+ public Map<String, Object> send(String url, Map<String, Object> request) throws HttpClientException {
if (debug) {
Debug.log("Request : " + url + " / " + request, module);
}
@@ -697,8 +695,8 @@
* Note: For 2010 (assign working key) transaction, the EncryptID will need to be adjusted
* @return Map containing the inital request values
*/
- public Map getInitialRequestMap(Map context) {
- Map request = new HashMap();
+ public Map<String, Object> getInitialRequestMap(Map<String, Object> context) {
+ Map<String, Object> request = new HashMap<String, Object>();
// merchant information
request.put("MerchID", merchantId + terminalId);
@@ -905,7 +903,7 @@
return StringUtil.fromHexString(this.getGenericValue().getString("privateKey"));
}
- protected Map parseResponse(String response) {
+ protected Map<String, Object> parseResponse(String response) {
if (debug) {
Debug.log("Raw Response : " + response, module);
}
@@ -918,7 +916,7 @@
// check for a history table
String history = null;
- List historyMapList = null;
+ List<Map<String, String>> historyMapList = null;
if (subResponse.indexOf("<table") > -1) {
int startHistory = subResponse.indexOf("<table");
int endHistory = subResponse.indexOf("</table>") + 8;
@@ -943,7 +941,7 @@
subResponse = StringUtil.replaceString(subResponse, "</td>", "");
// make the map
- Map responseMap = StringUtil.strToMap(subResponse, true);
+ Map<String, Object> responseMap = UtilGenerics.cast(StringUtil.strToMap(subResponse, true));
// add the raw html back in just in case we need it later
responseMap.put("_rawHtmlResponse", response);
@@ -961,7 +959,7 @@
return responseMap;
}
- private List parseHistoryResponse(String response) {
+ private List<Map<String, String>> parseHistoryResponse(String response) {
if (debug) {
Debug.log("Raw History : " + response, module);
}
@@ -995,12 +993,12 @@
// split sets of values up
values = StringUtil.replaceString(values, "|</tr><tr>", "&");
- List valueList = StringUtil.split(values, "&");
+ List<String> valueList = StringUtil.split(values, "&");
// create a List of Maps for each set of values
- List valueMap = new ArrayList();
+ List<Map<String, String>> valueMap = new ArrayList<Map<String, String>>();
for (int i = 0; i < valueList.size(); i++) {
- valueMap.add(StringUtil.createMap(StringUtil.split(keys, "|"), StringUtil.split((String) valueList.get(i), "|")));
+ valueMap.add(StringUtil.createMap(StringUtil.split(keys, "|"), StringUtil.split(valueList.get(i), "|")));
}
if (debug) {
Modified: ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/thirdparty/valuelink/ValueLinkServices.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/thirdparty/valuelink/ValueLinkServices.java?rev=882210&r1=882209&r2=882210&view=diff
==============================================================================
--- ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/thirdparty/valuelink/ValueLinkServices.java (original)
+++ ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/thirdparty/valuelink/ValueLinkServices.java Thu Nov 19 17:26:03 2009
@@ -56,7 +56,7 @@
public static final String module = ValueLinkServices.class.getName();
// generate/display new public/private/kek keys
- public static Map createKeys(DispatchContext dctx, Map context) {
+ public static Map<String, Object> createKeys(DispatchContext dctx, Map<String, Object> context) {
Delegator delegator = dctx.getDelegator();
Properties props = getProperties(context);
ValueLinkApi vl = ValueLinkApi.getInstance(delegator, props);
@@ -70,13 +70,13 @@
String output = buf.toString();
Debug.log(":: Key Generation Output ::\n\n" + output, module);
- Map result = ServiceUtil.returnSuccess();
+ Map<String, Object> result = ServiceUtil.returnSuccess();
result.put("output", output);
return result;
}
// test the KEK encryption
- public static Map testKekEncryption(DispatchContext dctx, Map context) {
+ public static Map<String, Object> testKekEncryption(DispatchContext dctx, Map<String, Object> context) {
Delegator delegator = dctx.getDelegator();
//GenericValue userLogin = (GenericValue) context.get("userLogin");
Properties props = getProperties(context);
@@ -120,13 +120,13 @@
String output = buf.toString();
Debug.log(":: KEK Test Output ::\n\n" + output, module);
- Map result = ServiceUtil.returnSuccess();
+ Map<String, Object> result = ServiceUtil.returnSuccess();
result.put("output", output);
return result;
}
// change working key service
- public static Map assignWorkingKey(DispatchContext dctx, Map context) {
+ public static Map<String, Object> assignWorkingKey(DispatchContext dctx, Map<String, Object> context) {
Delegator delegator = dctx.getDelegator();
GenericValue userLogin = (GenericValue) context.get("userLogin");
Properties props = getProperties(context);
@@ -150,13 +150,13 @@
String mwkHex = StringUtil.toHexString(vl.encryptViaKek(mwk));
// build the request
- Map request = vl.getInitialRequestMap(context);
+ Map<String, Object> request = vl.getInitialRequestMap(context);
request.put("Interface", "Encrypt");
request.put("EncryptKey", mwkHex);
request.put("EncryptID", Long.valueOf(vl.getWorkingKeyIndex().longValue() + 1));
// send the request
- Map response = null;
+ Map<String, Object> response = null;
try {
response = vl.send(request);
} catch (HttpClientException e) {
@@ -191,7 +191,7 @@
}
}
- public static Map activate(DispatchContext dctx, Map context) {
+ public static Map<String, Object> activate(DispatchContext dctx, Map<String, Object> context) {
Delegator delegator = dctx.getDelegator();
Properties props = getProperties(context);
String vlPromoCode = (String) context.get("vlPromoCode");
@@ -207,7 +207,7 @@
// get an api instance
ValueLinkApi vl = ValueLinkApi.getInstance(delegator, props);
- Map request = vl.getInitialRequestMap(context);
+ Map<String, Object> request = vl.getInitialRequestMap(context);
request.put("Interface", iFace != null ? iFace : "Activate");
if (vlPromoCode != null && vlPromoCode.length() > 0) {
request.put("PromoCode", vlPromoCode);
@@ -236,7 +236,7 @@
setTimeoutReversal(dctx, context, request);
// send the request
- Map response = null;
+ Map<String, Object> response = null;
try {
response = vl.send(request);
} catch (HttpClientException e) {
@@ -246,7 +246,7 @@
if (response != null) {
String responseCode = (String) response.get("responsecode");
- Map result = ServiceUtil.returnSuccess();
+ Map<String, Object> result = ServiceUtil.returnSuccess();
if (responseCode.equals("00")) {
result.put("processResult", Boolean.TRUE);
result.put("pin", vl.decryptPin((String) response.get("pin")));
@@ -268,7 +268,7 @@
}
}
- public static Map linkPhysicalCard(DispatchContext dctx, Map context) {
+ public static Map<String, Object> linkPhysicalCard(DispatchContext dctx, Map<String, Object> context) {
Delegator delegator = dctx.getDelegator();
Properties props = getProperties(context);
String virtualCard = (String) context.get("virtualCard");
@@ -279,7 +279,7 @@
// get an api instance
ValueLinkApi vl = ValueLinkApi.getInstance(delegator, props);
- Map request = vl.getInitialRequestMap(context);
+ Map<String, Object> request = vl.getInitialRequestMap(context);
request.put("Interface", "Link");
request.put("VCardNo", virtualCard);
request.put("VPIN", vl.encryptPin(virtualPin));
@@ -292,7 +292,7 @@
}
// send the request
- Map response = null;
+ Map<String, Object> response = null;
try {
response = vl.send(request);
} catch (HttpClientException e) {
@@ -302,7 +302,7 @@
if (response != null) {
String responseCode = (String) response.get("responsecode");
- Map result = ServiceUtil.returnSuccess("Activation of physical card complete.");
+ Map<String, Object> result = ServiceUtil.returnSuccess("Activation of physical card complete.");
if (responseCode.equals("00")) {
result.put("processResult", Boolean.TRUE);
@@ -322,7 +322,7 @@
}
}
- public static Map disablePin(DispatchContext dctx, Map context) {
+ public static Map<String, Object> disablePin(DispatchContext dctx, Map<String, Object> context) {
Delegator delegator = dctx.getDelegator();
Properties props = getProperties(context);
String cardNumber = (String) context.get("cardNumber");
@@ -333,7 +333,7 @@
// get an api instance
ValueLinkApi vl = ValueLinkApi.getInstance(delegator, props);
- Map request = vl.getInitialRequestMap(context);
+ Map<String, Object> request = vl.getInitialRequestMap(context);
request.put("Interface", "Disable");
request.put("CardNo", cardNumber);
request.put("PIN", vl.encryptPin(pin));
@@ -350,7 +350,7 @@
}
// send the request
- Map response = null;
+ Map<String, Object> response = null;
try {
response = vl.send(request);
} catch (HttpClientException e) {
@@ -360,7 +360,7 @@
if (response != null) {
String responseCode = (String) response.get("responsecode");
- Map result = ServiceUtil.returnSuccess("PIN disabled.");
+ Map<String, Object> result = ServiceUtil.returnSuccess("PIN disabled.");
if (responseCode.equals("00")) {
result.put("processResult", Boolean.TRUE);
} else {
@@ -378,7 +378,7 @@
}
}
- public static Map redeem(DispatchContext dctx, Map context) {
+ public static Map<String, Object> redeem(DispatchContext dctx, Map<String, Object> context) {
Delegator delegator = dctx.getDelegator();
Properties props = getProperties(context);
String cardNumber = (String) context.get("cardNumber");
@@ -393,7 +393,7 @@
// get an api instance
ValueLinkApi vl = ValueLinkApi.getInstance(delegator, props);
- Map request = vl.getInitialRequestMap(context);
+ Map<String, Object> request = vl.getInitialRequestMap(context);
request.put("Interface", iFace != null ? iFace : "Redeem");
request.put("CardNo", cardNumber);
request.put("PIN", vl.encryptPin(pin));
@@ -414,7 +414,7 @@
setTimeoutReversal(dctx, context, request);
// send the request
- Map response = null;
+ Map<String, Object> response = null;
try {
response = vl.send(request);
} catch (HttpClientException e) {
@@ -424,7 +424,7 @@
if (response != null) {
String responseCode = (String) response.get("responsecode");
- Map result = ServiceUtil.returnSuccess();
+ Map<String, Object> result = ServiceUtil.returnSuccess();
if (responseCode.equals("00")) {
result.put("processResult", Boolean.TRUE);
} else {
@@ -445,7 +445,7 @@
}
}
- public static Map reload(DispatchContext dctx, Map context) {
+ public static Map<String, Object> reload(DispatchContext dctx, Map<String, Object> context) {
Delegator delegator = dctx.getDelegator();
Properties props = getProperties(context);
String cardNumber = (String) context.get("cardNumber");
@@ -460,7 +460,7 @@
// get an api instance
ValueLinkApi vl = ValueLinkApi.getInstance(delegator, props);
- Map request = vl.getInitialRequestMap(context);
+ Map<String, Object> request = vl.getInitialRequestMap(context);
request.put("Interface", iFace != null ? iFace : "Reload");
request.put("CardNo", cardNumber);
request.put("PIN", vl.encryptPin(pin));
@@ -481,7 +481,7 @@
setTimeoutReversal(dctx, context, request);
// send the request
- Map response = null;
+ Map<String, Object> response = null;
try {
response = vl.send(request);
} catch (HttpClientException e) {
@@ -491,7 +491,7 @@
if (response != null) {
String responseCode = (String) response.get("responsecode");
- Map result = ServiceUtil.returnSuccess();
+ Map<String, Object> result = ServiceUtil.returnSuccess();
if (responseCode.equals("00")) {
result.put("processResult", Boolean.TRUE);
} else {
@@ -511,7 +511,7 @@
}
}
- public static Map balanceInquire(DispatchContext dctx, Map context) {
+ public static Map<String, Object> balanceInquire(DispatchContext dctx, Map<String, Object> context) {
Delegator delegator = dctx.getDelegator();
Properties props = getProperties(context);
String cardNumber = (String) context.get("cardNumber");
@@ -522,7 +522,7 @@
// get an api instance
ValueLinkApi vl = ValueLinkApi.getInstance(delegator, props);
- Map request = vl.getInitialRequestMap(context);
+ Map<String, Object> request = vl.getInitialRequestMap(context);
request.put("Interface", "Balance");
request.put("CardNo", cardNumber);
request.put("PIN", vl.encryptPin(pin));
@@ -539,7 +539,7 @@
}
// send the request
- Map response = null;
+ Map<String, Object> response = null;
try {
response = vl.send(request);
} catch (HttpClientException e) {
@@ -549,7 +549,7 @@
if (response != null) {
String responseCode = (String) response.get("responsecode");
- Map result = ServiceUtil.returnSuccess();
+ Map<String, Object> result = ServiceUtil.returnSuccess();
if (responseCode.equals("00")) {
result.put("processResult", Boolean.TRUE);
} else {
@@ -567,7 +567,7 @@
}
}
- public static Map transactionHistory(DispatchContext dctx, Map context) {
+ public static Map<String, Object> transactionHistory(DispatchContext dctx, Map<String, Object> context) {
Delegator delegator = dctx.getDelegator();
Properties props = getProperties(context);
String cardNumber = (String) context.get("cardNumber");
@@ -577,7 +577,7 @@
// get an api instance
ValueLinkApi vl = ValueLinkApi.getInstance(delegator, props);
- Map request = vl.getInitialRequestMap(context);
+ Map<String, Object> request = vl.getInitialRequestMap(context);
request.put("Interface", "History");
request.put("CardNo", cardNumber);
request.put("PIN", vl.encryptPin(pin));
@@ -593,7 +593,7 @@
}
// send the request
- Map response = null;
+ Map<String, Object> response = null;
try {
response = vl.send(request);
} catch (HttpClientException e) {
@@ -603,7 +603,7 @@
if (response != null) {
String responseCode = (String) response.get("responsecode");
- Map result = ServiceUtil.returnSuccess();
+ Map<String, Object> result = ServiceUtil.returnSuccess();
if (responseCode.equals("00")) {
result.put("processResult", Boolean.TRUE);
} else {
@@ -622,7 +622,7 @@
}
}
- public static Map refund(DispatchContext dctx, Map context) {
+ public static Map<String, Object> refund(DispatchContext dctx, Map<String, Object> context) {
Delegator delegator = dctx.getDelegator();
Properties props = getProperties(context);
String cardNumber = (String) context.get("cardNumber");
@@ -637,7 +637,7 @@
// get an api instance
ValueLinkApi vl = ValueLinkApi.getInstance(delegator, props);
- Map request = vl.getInitialRequestMap(context);
+ Map<String, Object> request = vl.getInitialRequestMap(context);
request.put("Interface", iFace != null ? iFace : "Refund");
request.put("CardNo", cardNumber);
request.put("PIN", vl.encryptPin(pin));
@@ -658,7 +658,7 @@
setTimeoutReversal(dctx, context, request);
// send the request
- Map response = null;
+ Map<String, Object> response = null;
try {
response = vl.send(request);
} catch (HttpClientException e) {
@@ -668,7 +668,7 @@
if (response != null) {
String responseCode = (String) response.get("responsecode");
- Map result = ServiceUtil.returnSuccess();
+ Map<String, Object> result = ServiceUtil.returnSuccess();
if (responseCode.equals("00")) {
result.put("processResult", Boolean.TRUE);
} else {
@@ -688,27 +688,27 @@
}
}
- public static Map voidRedeem(DispatchContext dctx, Map context) {
+ public static Map<String, Object> voidRedeem(DispatchContext dctx, Map<String, Object> context) {
context.put("Interface", "Redeem/Void");
return redeem(dctx, context);
}
- public static Map voidRefund(DispatchContext dctx, Map context) {
+ public static Map<String, Object> voidRefund(DispatchContext dctx, Map<String, Object> context) {
context.put("Interface", "Refund/Void");
return refund(dctx, context);
}
- public static Map voidReload(DispatchContext dctx, Map context) {
+ public static Map<String, Object> voidReload(DispatchContext dctx, Map<String, Object> context) {
context.put("Interface", "Reload/Void");
return reload(dctx, context);
}
- public static Map voidActivate(DispatchContext dctx, Map context) {
+ public static Map<String, Object> voidActivate(DispatchContext dctx, Map<String, Object> context) {
context.put("Interface", "Activate/Void");
return activate(dctx, context);
}
- public static Map timeOutReversal(DispatchContext dctx, Map context) {
+ public static Map<String, Object> timeOutReversal(DispatchContext dctx, Map<String, Object> context) {
String vlInterface = (String) context.get("Interface");
Debug.log("704 Interface : " + vlInterface, module);
if (vlInterface != null) {
@@ -730,10 +730,10 @@
}
// 0704 Timeout Reversal (Supports - Activate/Void, Redeem, Redeem/Void, Reload, Reload/Void, Refund, Refund/Void)
- private static void setTimeoutReversal(DispatchContext dctx, Map ctx, Map request) {
+ private static void setTimeoutReversal(DispatchContext dctx, Map<String, Object> ctx, Map<String, Object> request) {
String vlInterface = (String) request.get("Interface");
// clone the context
- Map context = new HashMap(ctx);
+ Map<String, Object> context = new HashMap<String, Object>(ctx);
// append the rollback interface
if (!vlInterface.endsWith("Rollback")) {
@@ -762,7 +762,7 @@
}
}
- private static Properties getProperties(Map context) {
+ private static Properties getProperties(Map<String, Object> context) {
String paymentProperties = (String) context.get("paymentConfig");
if (paymentProperties == null) {
paymentProperties = "payment.properties";
@@ -773,7 +773,7 @@
// payment processing wrappers (process/release/refund)
- public static Map giftCardProcessor(DispatchContext dctx, Map context) {
+ public static Map<String, Object> giftCardProcessor(DispatchContext dctx, Map<String, Object> context) {
LocalDispatcher dispatcher = dctx.getDispatcher();
GenericValue userLogin = (GenericValue) context.get("userLogin");
@@ -789,7 +789,7 @@
currency = UtilProperties.getPropertyValue("general.properties", "currency.uom.id.default", "USD");
}
- Map redeemCtx = new HashMap();
+ Map<String, Object> redeemCtx = new HashMap<String, Object>();
redeemCtx.put("userLogin", userLogin);
redeemCtx.put("paymentConfig", paymentConfig);
redeemCtx.put("cardNumber", giftCard.get("cardNumber"));
@@ -800,7 +800,7 @@
redeemCtx.put("amount", amount);
// invoke the redeem service
- Map redeemResult = null;
+ Map<String, Object> redeemResult = null;
try {
redeemResult = dispatcher.runSync("redeemGiftCard", redeemCtx);
} catch (GenericServiceException e) {
@@ -808,7 +808,7 @@
return ServiceUtil.returnError("Redeem service failed");
}
- Map result = ServiceUtil.returnSuccess();
+ Map<String, Object> result = ServiceUtil.returnSuccess();
if (redeemResult != null) {
Boolean processResult = (Boolean) redeemResult.get("processResult");
// confirm the amount redeemed; since VL does not error in insufficient funds
@@ -821,7 +821,7 @@
Debug.logInfo("Redeemed (" + amount + "): " + redeemed + " / " + previous + " : " + current, module);
if (redeemed.compareTo(amount) < 0) {
// we didn't redeem enough void the transaction and return false
- Map voidResult = null;
+ Map<String, Object> voidResult = null;
try {
voidResult = dispatcher.runSync("voidRedeemGiftCard", redeemCtx);
} catch (GenericServiceException e) {
@@ -848,7 +848,7 @@
return result;
}
- public static Map giftCardRelease(DispatchContext dctx, Map context) {
+ public static Map<String, Object> giftCardRelease(DispatchContext dctx, Map<String, Object> context) {
LocalDispatcher dispatcher = dctx.getDispatcher();
GenericValue userLogin = (GenericValue) context.get("userLogin");
@@ -878,7 +878,7 @@
currency = UtilProperties.getPropertyValue("general.properties", "currency.uom.id.default", "USD");
}
- Map redeemCtx = new HashMap();
+ Map<String, Object> redeemCtx = new HashMap<String, Object>();
redeemCtx.put("userLogin", userLogin);
redeemCtx.put("paymentConfig", paymentConfig);
redeemCtx.put("cardNumber", giftCard.get("cardNumber"));
@@ -888,7 +888,7 @@
redeemCtx.put("amount", amount);
// invoke the void redeem service
- Map redeemResult = null;
+ Map<String, Object> redeemResult = null;
try {
redeemResult = dispatcher.runSync("voidRedeemGiftCard", redeemCtx);
} catch (GenericServiceException e) {
@@ -896,7 +896,7 @@
return ServiceUtil.returnError("Redeem service failed");
}
- Map result = ServiceUtil.returnSuccess();
+ Map<String, Object> result = ServiceUtil.returnSuccess();
if (redeemResult != null) {
Boolean processResult = (Boolean) redeemResult.get("processResult");
result.put("releaseAmount", redeemResult.get("amount"));
@@ -909,7 +909,7 @@
return result;
}
- public static Map giftCardRefund(DispatchContext dctx, Map context) {
+ public static Map<String, Object> giftCardRefund(DispatchContext dctx, Map<String, Object> context) {
LocalDispatcher dispatcher = dctx.getDispatcher();
GenericValue userLogin = (GenericValue) context.get("userLogin");
@@ -939,7 +939,7 @@
currency = UtilProperties.getPropertyValue("general.properties", "currency.uom.id.default", "USD");
}
- Map refundCtx = new HashMap();
+ Map<String, Object> refundCtx = new HashMap<String, Object>();
refundCtx.put("userLogin", userLogin);
refundCtx.put("paymentConfig", paymentConfig);
refundCtx.put("cardNumber", giftCard.get("cardNumber"));
@@ -949,7 +949,7 @@
refundCtx.put("amount", amount);
// invoke the refund service
- Map redeemResult = null;
+ Map<String, Object> redeemResult = null;
try {
redeemResult = dispatcher.runSync("refundGiftCard", refundCtx);
} catch (GenericServiceException e) {
@@ -957,7 +957,7 @@
return ServiceUtil.returnError("Refund service failed");
}
- Map result = ServiceUtil.returnSuccess();
+ Map<String, Object> result = ServiceUtil.returnSuccess();
if (redeemResult != null) {
Boolean processResult = (Boolean) redeemResult.get("processResult");
result.put("refundAmount", redeemResult.get("amount"));
@@ -972,7 +972,7 @@
// item fulfillment wrappers (purchase/reload)
- public static Map giftCardPurchase(DispatchContext dctx, Map context) {
+ public static Map<String, Object> giftCardPurchase(DispatchContext dctx, Map<String, Object> context) {
// this service should always be called via FULFILLMENT_EXTASYNC
LocalDispatcher dispatcher = dctx.getDispatcher();
Delegator delegator = dctx.getDelegator();
@@ -1047,9 +1047,9 @@
// get the productFeature type TYPE (VL promo code)
GenericValue typeFeature = null;
try {
- Map fields = UtilMisc.toMap("productId", product.get("productId"), "productFeatureTypeId", "TYPE");
- List order = UtilMisc.toList("-fromDate");
- List featureAppls = delegator.findByAndCache("ProductFeatureAndAppl", fields, order);
+ Map<String, Object> fields = UtilMisc.toMap("productId", product.get("productId"), "productFeatureTypeId", "TYPE");
+ List<String> order = UtilMisc.toList("-fromDate");
+ List<GenericValue> featureAppls = delegator.findByAndCache("ProductFeatureAndAppl", fields, order);
featureAppls = EntityUtil.filterByDate(featureAppls);
typeFeature = EntityUtil.getFirst(featureAppls);
} catch (GenericEntityException e) {
@@ -1072,9 +1072,9 @@
// get the survey response
GenericValue surveyResponse = null;
try {
- Map fields = UtilMisc.toMap("orderId", orderId, "orderItemSeqId", orderItem.get("orderItemSeqId"), "surveyId", surveyId);
- List order = UtilMisc.toList("-responseDate");
- List responses = delegator.findByAnd("SurveyResponse", fields, order);
+ Map<String, Object> fields = UtilMisc.toMap("orderId", orderId, "orderItemSeqId", orderItem.get("orderItemSeqId"), "surveyId", surveyId);
+ List<String> order = UtilMisc.toList("-responseDate");
+ List<GenericValue> responses = delegator.findByAnd("SurveyResponse", fields, order);
// there should be only one
surveyResponse = EntityUtil.getFirst(responses);
} catch (GenericEntityException e) {
@@ -1083,7 +1083,7 @@
}
// get the response answers
- List responseAnswers = null;
+ List<GenericValue> responseAnswers = null;
try {
responseAnswers = surveyResponse.getRelated("SurveyResponseAnswer");
} catch (GenericEntityException e) {
@@ -1092,11 +1092,11 @@
}
// make a map of answer info
- Map answerMap = new HashMap();
+ Map<String, Object> answerMap = new HashMap<String, Object>();
if (responseAnswers != null) {
- Iterator rai = responseAnswers.iterator();
+ Iterator<GenericValue> rai = responseAnswers.iterator();
while (rai.hasNext()) {
- GenericValue answer = (GenericValue) rai.next();
+ GenericValue answer = rai.next();
GenericValue question = null;
try {
question = answer.getRelatedOne("SurveyQuestion");
@@ -1126,7 +1126,7 @@
int qtyLoop = quantity.intValue();
for (int i = 0; i < qtyLoop; i++) {
// activate a gift card
- Map activateCtx = new HashMap();
+ Map<String, Object> activateCtx = new HashMap<String, Object>();
activateCtx.put("paymentConfig", paymentConfig);
activateCtx.put("vlPromoCode", promoCode);
activateCtx.put("currency", currency);
@@ -1136,7 +1136,7 @@
activateCtx.put("userLogin", userLogin);
boolean failure = false;
- Map activateResult = null;
+ Map<String, Object> activateResult = null;
try {
activateResult = dispatcher.runSync("activateGiftCard", activateCtx);
} catch (GenericServiceException e) {
@@ -1163,7 +1163,7 @@
}
// create the fulfillment record
- Map vlFulFill = new HashMap();
+ Map<String, Object> vlFulFill = new HashMap<String, Object>();
vlFulFill.put("typeEnumId", "GC_ACTIVATE");
vlFulFill.put("merchantId", UtilProperties.getPropertyValue(paymentConfig, "payment.valuelink.merchantId"));
vlFulFill.put("partyId", partyId);
@@ -1220,7 +1220,7 @@
}
}
- Map emailCtx = new HashMap();
+ Map<String, Object> emailCtx = new HashMap<String, Object>();
String bodyScreenLocation = productStoreEmail.getString("bodyScreenLocation");
if (UtilValidate.isEmpty(bodyScreenLocation)) {
bodyScreenLocation = ProductStoreWorker.getDefaultProductStoreEmailScreenLocation(emailType);
@@ -1249,7 +1249,7 @@
return ServiceUtil.returnSuccess();
}
- public static Map giftCardReload(DispatchContext dctx, Map context) {
+ public static Map<String, Object> giftCardReload(DispatchContext dctx, Map<String, Object> context) {
// this service should always be called via FULFILLMENT_EXTSYNC
LocalDispatcher dispatcher = dctx.getDispatcher();
Delegator delegator = dctx.getDelegator();
@@ -1315,9 +1315,9 @@
// get the survey response
GenericValue surveyResponse = null;
try {
- Map fields = UtilMisc.toMap("orderId", orderId, "orderItemSeqId", orderItem.get("orderItemSeqId"), "surveyId", surveyId);
- List order = UtilMisc.toList("-responseDate");
- List responses = delegator.findByAnd("SurveyResponse", fields, order);
+ Map<String, Object> fields = UtilMisc.toMap("orderId", orderId, "orderItemSeqId", orderItem.get("orderItemSeqId"), "surveyId", surveyId);
+ List<String> order = UtilMisc.toList("-responseDate");
+ List<GenericValue> responses = delegator.findByAnd("SurveyResponse", fields, order);
// there should be only one
surveyResponse = EntityUtil.getFirst(responses);
} catch (GenericEntityException e) {
@@ -1326,7 +1326,7 @@
}
// get the response answers
- List responseAnswers = null;
+ List<GenericValue> responseAnswers = null;
try {
responseAnswers = surveyResponse.getRelated("SurveyResponseAnswer");
} catch (GenericEntityException e) {
@@ -1335,12 +1335,10 @@
}
// make a map of answer info
- Map answerMap = new HashMap();
+ Map<String, Object> answerMap = new HashMap<String, Object>();
if (responseAnswers != null) {
- Iterator rai = responseAnswers.iterator();
- while (rai.hasNext()) {
- GenericValue answer = (GenericValue) rai.next();
- GenericValue question = null;
+ for (GenericValue answer: responseAnswers) {
+ GenericValue question = null;
try {
question = answer.getRelatedOne("SurveyQuestion");
} catch (GenericEntityException e) {
@@ -1361,7 +1359,7 @@
String pinNumber = (String) answerMap.get(pinNumberKey);
// reload the gift card
- Map reloadCtx = new HashMap();
+ Map<String, Object> reloadCtx = new HashMap<String, Object>();
reloadCtx.put("paymentConfig", paymentConfig);
reloadCtx.put("currency", currency);
reloadCtx.put("partyId", partyId);
@@ -1371,7 +1369,7 @@
reloadCtx.put("amount", amount);
reloadCtx.put("userLogin", userLogin);
- Map reloadResult = null;
+ Map<String, Object> reloadResult = null;
try {
reloadResult = dispatcher.runSync("reloadGiftCard", reloadCtx);
} catch (GenericServiceException e) {
@@ -1380,7 +1378,7 @@
}
// create the fulfillment record
- Map vlFulFill = new HashMap();
+ Map<String, Object> vlFulFill = new HashMap<String, Object>();
vlFulFill.put("typeEnumId", "GC_RELOAD");
vlFulFill.put("merchantId", UtilProperties.getPropertyValue(paymentConfig, "payment.valuelink.merchantId"));
vlFulFill.put("partyId", partyId);
@@ -1407,7 +1405,7 @@
// process the return
try {
- Map refundCtx = UtilMisc.toMap("orderItem", orderItem, "partyId", partyId, "userLogin", userLogin);
+ Map<String, Object> refundCtx = UtilMisc.toMap("orderItem", orderItem, "partyId", partyId, "userLogin", userLogin);
dispatcher.runAsync("refundGcPurchase", refundCtx, null, true, 300, true);
} catch (GenericServiceException e) {
Debug.logError(e, "ERROR! Unable to call create refund service; this failed reload will NOT be refunded", module);
@@ -1443,7 +1441,7 @@
if (productStoreEmail == null) {
Debug.logError("No gift card purchase email setting found for this store; cannot send gift card information", module);
} else {
- Map emailCtx = new HashMap();
+ Map<String, Object> emailCtx = new HashMap<String, Object>();
ResourceBundleMapWrapper uiLabelMap = (ResourceBundleMapWrapper) UtilProperties.getResourceBundleMap("EcommerceUiLabels", locale);
uiLabelMap.addBottomResourceBundle("OrderUiLabels");
uiLabelMap.addBottomResourceBundle("CommonUiLabels");
Modified: ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/util/UtilAccounting.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/util/UtilAccounting.java?rev=882210&r1=882209&r2=882210&view=diff
==============================================================================
--- ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/util/UtilAccounting.java (original)
+++ ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/util/UtilAccounting.java Thu Nov 19 17:26:03 2009
@@ -117,17 +117,17 @@
return balance;
}
- public static List getDescendantGlAccountClassIds(GenericValue glAccountClass) throws GenericEntityException {
- List glAccountClassIds = FastList.newInstance();
+ public static List<String> getDescendantGlAccountClassIds(GenericValue glAccountClass) throws GenericEntityException {
+ List<String> glAccountClassIds = FastList.newInstance();
getGlAccountClassChildren(glAccountClass, glAccountClassIds);
return glAccountClassIds;
}
- private static void getGlAccountClassChildren(GenericValue glAccountClass, List glAccountClassIds) throws GenericEntityException {
+ private static void getGlAccountClassChildren(GenericValue glAccountClass, List<String> glAccountClassIds) throws GenericEntityException {
glAccountClassIds.add(glAccountClass.getString("glAccountClassId"));
- List glAccountClassChildren = glAccountClass.getRelatedCache("ChildGlAccountClass");
- Iterator glAccountClassChildrenIt = glAccountClassChildren.iterator();
+ List<GenericValue> glAccountClassChildren = glAccountClass.getRelatedCache("ChildGlAccountClass");
+ Iterator<GenericValue> glAccountClassChildrenIt = glAccountClassChildren.iterator();
while (glAccountClassChildrenIt.hasNext()) {
- GenericValue glAccountClassChild = (GenericValue) glAccountClassChildrenIt.next();
+ GenericValue glAccountClassChild = glAccountClassChildrenIt.next();
getGlAccountClassChildren(glAccountClassChild, glAccountClassIds);
}
}