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 23:45:57 UTC
svn commit: r882342 [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/test/FinAccountTests.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/test/FinAccountTests.java?rev=882342&r1=882341&r2=882342&view=diff
==============================================================================
--- ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/test/FinAccountTests.java (original)
+++ ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/test/FinAccountTests.java Thu Nov 19 22:45:56 2009
@@ -50,31 +50,31 @@
}
public void testCreateFinAccount() throws Exception {
- Map<String, Object> ctx = FastMap.newInstance();
+ Map ctx = FastMap.newInstance();
ctx.put("finAccountId", "TESTACCOUNT1");
ctx.put("finAccountName", "Test Financial Account");
ctx.put("finAccountTypeId", "BANK_ACCOUNT");
ctx.put("userLogin", userLogin);
- Map<String, Object> resp = dispatcher.runSync("createFinAccount", ctx);
+ Map resp = dispatcher.runSync("createFinAccount", ctx);
assertEquals("Service result success", ModelService.RESPOND_SUCCESS, resp.get(ModelService.RESPONSE_MESSAGE));
}
public void testDeposit() throws Exception {
- Map<String, Object> ctx = FastMap.newInstance();
+ Map ctx = FastMap.newInstance();
ctx.put("finAccountId", "TESTACCOUNT1");
ctx.put("amount", new BigDecimal("100.00"));
ctx.put("userLogin", userLogin);
- Map<String, Object> resp = dispatcher.runSync("finAccountDeposit", ctx);
+ Map resp = dispatcher.runSync("finAccountDeposit", ctx);
BigDecimal balance = (BigDecimal) resp.get("balance");
assertEquals(balance.toPlainString(), "100.00");
}
public void testWithdraw() throws Exception {
- Map<String, Object> ctx = FastMap.newInstance();
+ Map ctx = FastMap.newInstance();
ctx.put("finAccountId", "TESTACCOUNT1");
ctx.put("amount", new BigDecimal("50.00"));
ctx.put("userLogin", userLogin);
- Map<String, Object> resp = dispatcher.runSync("finAccountWithdraw", ctx);
+ Map resp = dispatcher.runSync("finAccountWithdraw", ctx);
BigDecimal previousBalance = (BigDecimal) resp.get("previousBalance");
BigDecimal balance = ((BigDecimal) resp.get("balance"));
assertEquals(balance.add(new BigDecimal("50.00")).toPlainString(), previousBalance.toPlainString());
Modified: ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/thirdparty/clearcommerce/CCServicesTest.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/thirdparty/clearcommerce/CCServicesTest.java?rev=882342&r1=882341&r2=882342&view=diff
==============================================================================
--- ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/thirdparty/clearcommerce/CCServicesTest.java (original)
+++ ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/thirdparty/clearcommerce/CCServicesTest.java Thu Nov 19 22:45:56 2009
@@ -19,15 +19,27 @@
package org.ofbiz.accounting.thirdparty.clearcommerce;
-import java.math.BigDecimal;
+import java.sql.Timestamp;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
import java.util.Map;
+import java.lang.Thread;
+import java.math.BigDecimal;
import junit.framework.TestCase;
import org.ofbiz.base.util.Debug;
+import org.ofbiz.base.util.UtilDateTime;
import org.ofbiz.base.util.UtilMisc;
+import org.ofbiz.base.util.UtilXml;
import org.ofbiz.entity.GenericValue;
+import org.ofbiz.entity.GenericEntityException;
import org.ofbiz.service.GenericServiceException;
+import org.ofbiz.service.GenericDispatcher;
+import org.ofbiz.service.LocalDispatcher;
import org.ofbiz.service.ModelService;
import org.ofbiz.service.testtools.OFBizTestCase;
@@ -41,7 +53,7 @@
protected GenericValue creditCard = null;
protected GenericValue billingAddress = null;
protected GenericValue shippingAddress = null;
- protected Map<String, Object> pbOrder = null;
+ protected Map pbOrder = null;
protected BigDecimal creditAmount = null;
protected String configFile = null;
@@ -75,7 +87,7 @@
"stateProvinceGeoId", "NLD",
"postalCode","12345"));
pbOrder = UtilMisc.toMap(
- "OrderFrequencyCycle", (Object)"M",
+ "OrderFrequencyCycle", "M",
"OrderFrequencyInterval", "3",
"TotalNumberPayments", "4");
}
@@ -86,7 +98,7 @@
public void testAuth() throws Exception{
Debug.logInfo("=====[testAuth] starting....", module);
try {
- Map<String, Object> serviceInput = UtilMisc.toMap(
+ Map serviceInput = UtilMisc.toMap(
"paymentConfig", configFile,
"billToEmail", emailAddr,
"creditCard", creditCard,
@@ -97,7 +109,7 @@
serviceInput.put("processAmount", new BigDecimal("200.00"));
// run the service (make sure in payment
- Map<String, Object> result = dispatcher.runSync("clearCommerceCCAuth",serviceInput);
+ Map result = dispatcher.runSync("clearCommerceCCAuth",serviceInput);
// verify the results
String responseMessage = (String) result.get(ModelService.RESPONSE_MESSAGE);
@@ -120,7 +132,7 @@
public void testCredit() throws Exception{
Debug.logInfo("=====[testCCredit] starting....", module);
try {
- Map<String, Object> serviceMap = UtilMisc.toMap(
+ Map serviceMap = UtilMisc.toMap(
"paymentConfig", configFile,
"orderId", orderId,
"creditAmount", creditAmount,
@@ -129,7 +141,7 @@
"creditAmount", new BigDecimal("200.00")
);
// run the service
- Map<String, Object> result = dispatcher.runSync("clearCommerceCCCredit",serviceMap);
+ Map result = dispatcher.runSync("clearCommerceCCCredit",serviceMap);
// verify the results
String responseMessage = (String) result.get(ModelService.RESPONSE_MESSAGE);
@@ -152,7 +164,7 @@
Debug.logInfo("=====[testPurchaseSubscription] starting....", module);
try {
- Map<String, Object> serviceMap = UtilMisc.toMap(
+ Map serviceMap = UtilMisc.toMap(
"paymentConfig", configFile,
"orderId", orderId,
"creditAmount", creditAmount,
@@ -163,7 +175,7 @@
serviceMap.put("creditAmount", new BigDecimal("200.00"));
// run the service
- Map<String, Object> result = dispatcher.runSync("clearCommerceCCCredit",serviceMap);
+ Map result = dispatcher.runSync("clearCommerceCCCredit",serviceMap);
// verify the results
String responseMessage = (String) result.get(ModelService.RESPONSE_MESSAGE);
@@ -206,13 +218,13 @@
Debug.logInfo("=====[testReport] starting....", module);
try {
- Map<String, Object> serviceMap = UtilMisc.toMap(
- "orderId", (Object)"4488668f-2db0-3002-002b-0003ba1d84d5",
+ Map serviceMap = UtilMisc.toMap(
+ "orderId", "4488668f-2db0-3002-002b-0003ba1d84d5",
"paymentConfig", configFile
);
// run the service
- Map<String, Object> result = dispatcher.runSync("clearCommerceCCReport",serviceMap);
+ Map result = dispatcher.runSync("clearCommerceCCReport",serviceMap);
// verify the results
String responseMessage = (String) result.get(ModelService.RESPONSE_MESSAGE);
Modified: ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/thirdparty/gosoftware/PcChargeServices.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/thirdparty/gosoftware/PcChargeServices.java?rev=882342&r1=882341&r2=882342&view=diff
==============================================================================
--- ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/thirdparty/gosoftware/PcChargeServices.java (original)
+++ ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/thirdparty/gosoftware/PcChargeServices.java Thu Nov 19 22:45:56 2009
@@ -18,23 +18,24 @@
*******************************************************************************/
package org.ofbiz.accounting.thirdparty.gosoftware;
-import java.io.IOException;
-import java.math.BigDecimal;
-import java.util.List;
import java.util.Map;
import java.util.Properties;
+import java.util.List;
+import java.text.DecimalFormat;
+import java.io.IOException;
+import java.math.BigDecimal;
-import org.ofbiz.accounting.payment.PaymentGatewayServices;
-import org.ofbiz.base.util.Debug;
-import org.ofbiz.base.util.GeneralException;
-import org.ofbiz.base.util.StringUtil;
-import org.ofbiz.base.util.UtilMisc;
+import org.ofbiz.service.DispatchContext;
+import org.ofbiz.service.ServiceUtil;
import org.ofbiz.base.util.UtilNumber;
import org.ofbiz.base.util.UtilProperties;
import org.ofbiz.base.util.UtilValidate;
+import org.ofbiz.base.util.Debug;
+import org.ofbiz.base.util.StringUtil;
+import org.ofbiz.base.util.GeneralException;
+import org.ofbiz.base.util.UtilMisc;
import org.ofbiz.entity.GenericValue;
-import org.ofbiz.service.DispatchContext;
-import org.ofbiz.service.ServiceUtil;
+import org.ofbiz.accounting.payment.PaymentGatewayServices;
public class PcChargeServices {
@@ -43,7 +44,7 @@
private static int decimals = UtilNumber.getBigDecimalScale("invoice.decimals");
private static int rounding = UtilNumber.getBigDecimalRoundingMode("invoice.rounding");
- public static Map<String, Object> ccAuth(DispatchContext dctx, Map<String, Object> context) {
+ public static Map ccAuth(DispatchContext dctx, Map context) {
Properties props = buildPccProperties(context);
PcChargeApi api = getApi(props);
if (api == null) {
@@ -84,7 +85,7 @@
}
if (out != null) {
- Map<String, Object> result = ServiceUtil.returnSuccess();
+ Map result = ServiceUtil.returnSuccess();
String resultCode = out.get(PcChargeApi.RESULT);
boolean passed = false;
if ("CAPTURED".equals(resultCode)) {
@@ -129,7 +130,7 @@
}
}
- public static Map<String, Object> ccCapture(DispatchContext dctx, Map<String, Object> context) {
+ public static Map ccCapture(DispatchContext dctx, Map context) {
GenericValue orderPaymentPreference = (GenericValue) context.get("orderPaymentPreference");
//lets see if there is a auth transaction already in context
@@ -166,7 +167,7 @@
}
if (out != null) {
- Map<String, Object> result = ServiceUtil.returnSuccess();
+ Map result = ServiceUtil.returnSuccess();
String resultCode = out.get(PcChargeApi.RESULT);
if ("CAPTURED".equals(resultCode)) {
result.put("captureResult", Boolean.TRUE);
@@ -185,7 +186,7 @@
}
}
- public static Map<String, Object> ccRelease(DispatchContext dctx, Map<String, Object> context) {
+ public static Map ccRelease(DispatchContext dctx, Map context) {
GenericValue orderPaymentPreference = (GenericValue) context.get("orderPaymentPreference");
//lets see if there is a auth transaction already in context
@@ -227,7 +228,7 @@
}
if (out != null) {
- Map<String, Object> result = ServiceUtil.returnSuccess();
+ Map result = ServiceUtil.returnSuccess();
String resultCode = out.get(PcChargeApi.RESULT);
if ("VOIDED".equals(resultCode)) {
result.put("releaseResult", Boolean.TRUE);
@@ -246,7 +247,7 @@
}
}
- public static Map<String, Object> ccRefund(DispatchContext dctx, Map<String, Object> context) {
+ public static Map ccRefund(DispatchContext dctx, Map context) {
GenericValue orderPaymentPreference = (GenericValue) context.get("orderPaymentPreference");
//lets see if there is a auth transaction already in context
@@ -283,7 +284,7 @@
}
if (out != null) {
- Map<String, Object> result = ServiceUtil.returnSuccess();
+ Map result = ServiceUtil.returnSuccess();
String resultCode = out.get(PcChargeApi.RESULT);
if ("CAPTURED".equals(resultCode)) {
result.put("refundResult", Boolean.TRUE);
@@ -302,11 +303,11 @@
}
}
- private static void setCreditCardInfo(PcChargeApi api, Map<String, Object> context) throws GeneralException {
+ private static void setCreditCardInfo(PcChargeApi api, Map context) throws GeneralException {
GenericValue orderPaymentPreference = (GenericValue) context.get("orderPaymentPreference");
GenericValue creditCard = (GenericValue) context.get("creditCard");
if (creditCard != null) {
- List<String> expDateList = StringUtil.split(creditCard.getString("expireDate"), "/");
+ List expDateList = StringUtil.split(creditCard.getString("expireDate"), "/");
String month = (String) expDateList.get(0);
String year = (String) expDateList.get(1);
String y2d = year.substring(2);
@@ -385,7 +386,7 @@
return api;
}
- private static Properties buildPccProperties(Map<String, Object> context) {
+ private static Properties buildPccProperties(Map context) {
String configString = (String) context.get("paymentConfig");
if (configString == null) {
configString = "payment.properties";
@@ -425,7 +426,7 @@
return props;
}
- private static String getAmountString(Map<String, Object> context, String amountField) {
+ private static String getAmountString(Map 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/gosoftware/RitaApi.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/thirdparty/gosoftware/RitaApi.java?rev=882342&r1=882341&r2=882342&view=diff
==============================================================================
--- ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/thirdparty/gosoftware/RitaApi.java (original)
+++ ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/thirdparty/gosoftware/RitaApi.java Thu Nov 19 22:45:56 2009
@@ -19,6 +19,7 @@
package org.ofbiz.accounting.thirdparty.gosoftware;
import java.io.IOException;
+import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.Map;
@@ -91,19 +92,19 @@
protected static final int MODE_IN = 10;
// instance variables
- protected LinkedHashMap<String, String> document = null;
+ protected LinkedHashMap document = null;
protected String host = null;
protected boolean ssl = false;
protected int port = 0;
protected int mode = 0;
- public RitaApi(Map<String, String> document) {
- this.document = new LinkedHashMap<String, String>(document);
+ public RitaApi(Map document) {
+ this.document = new LinkedHashMap(document);
this.mode = MODE_OUT;
}
public RitaApi() {
- this.document = new LinkedHashMap<String, String>();
+ this.document = new LinkedHashMap();
this.mode = MODE_IN;
}
@@ -150,7 +151,9 @@
@Override
public String toString() {
StringBuilder buf = new StringBuilder();
- for (Map.Entry<String, String> entry : document.entrySet()) {
+ Iterator i = document.entrySet().iterator();
+ while (i.hasNext()) {
+ Map.Entry entry = (Map.Entry) i.next();
String name = (String) entry.getKey();
String value = (String) entry.getValue();
buf.append(name);
@@ -162,7 +165,7 @@
return buf.toString();
}
- public Map<String, String> getDocument() {
+ public Map getDocument() {
return this.document;
}
@@ -224,7 +227,7 @@
br.close();
*/
- LinkedHashMap<String, String> docMap = new LinkedHashMap<String, String>();
+ LinkedHashMap docMap = new LinkedHashMap();
String resp = null;
try {
resp = http.post(stream);
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=882342&r1=882341&r2=882342&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 22:45:56 2009
@@ -18,30 +18,31 @@
*******************************************************************************/
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.accounting.payment.PaymentGatewayServices;
-import org.ofbiz.base.util.Debug;
+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.base.util.StringUtil;
-import org.ofbiz.base.util.UtilDateTime;
+import org.ofbiz.base.util.Debug;
import org.ofbiz.base.util.UtilMisc;
+import org.ofbiz.base.util.StringUtil;
import org.ofbiz.base.util.UtilNumber;
-import org.ofbiz.base.util.UtilProperties;
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.entity.Delegator;
import org.ofbiz.entity.GenericEntityException;
-import org.ofbiz.entity.GenericValue;
import org.ofbiz.entity.util.EntityUtil;
-import org.ofbiz.service.DispatchContext;
-import org.ofbiz.service.GenericServiceException;
-import org.ofbiz.service.LocalDispatcher;
-import org.ofbiz.service.ServiceUtil;
+import org.ofbiz.accounting.payment.PaymentGatewayServices;
public class RitaServices {
@@ -50,7 +51,7 @@
private static int decimals = UtilNumber.getBigDecimalScale("invoice.decimals");
private static int rounding = UtilNumber.getBigDecimalRoundingMode("invoice.rounding");
- public static Map<String, Object> ccAuth(DispatchContext dctx, Map<String, Object> context) {
+ public static Map ccAuth(DispatchContext dctx, Map context) {
Properties props = buildPccProperties(context);
RitaApi api = getApi(props, "CREDIT");
if (api == null) {
@@ -90,7 +91,7 @@
}
if (out != null) {
- Map<String, Object> result = ServiceUtil.returnSuccess();
+ Map result = ServiceUtil.returnSuccess();
String resultCode = out.get(RitaApi.RESULT);
boolean passed = false;
if ("CAPTURED".equals(resultCode)) {
@@ -134,7 +135,7 @@
}
}
- public static Map<String, Object> ccCapture(DispatchContext dctx, Map<String, Object> context) {
+ public static Map ccCapture(DispatchContext dctx, Map context) {
GenericValue orderPaymentPreference = (GenericValue) context.get("orderPaymentPreference");
//lets see if there is a auth transaction already in context
@@ -171,7 +172,7 @@
}
if (out != null) {
- Map<String, Object> result = ServiceUtil.returnSuccess();
+ Map result = ServiceUtil.returnSuccess();
String resultCode = out.get(RitaApi.RESULT);
if ("CAPTURED".equals(resultCode)) {
result.put("captureResult", Boolean.TRUE);
@@ -190,15 +191,15 @@
}
}
- public static Map<String, Object> ccVoidRelease(DispatchContext dctx, Map<String, Object> context) {
+ public static Map ccVoidRelease(DispatchContext dctx, Map context) {
return ccVoid(dctx, context, false);
}
- public static Map<String, Object> ccVoidRefund(DispatchContext dctx, Map<String, Object> context) {
+ public static Map ccVoidRefund(DispatchContext dctx, Map context) {
return ccVoid(dctx, context, true);
}
- private static Map<String, Object> ccVoid(DispatchContext dctx, Map<String, Object> context, boolean isRefund) {
+ private static Map ccVoid(DispatchContext dctx, Map context, boolean isRefund) {
GenericValue orderPaymentPreference = (GenericValue) context.get("orderPaymentPreference");
//lets see if there is a auth transaction already in context
@@ -241,7 +242,7 @@
}
if (out != null) {
- Map<String, Object> result = ServiceUtil.returnSuccess();
+ Map result = ServiceUtil.returnSuccess();
String resultCode = out.get(RitaApi.RESULT);
if ("VOIDED".equals(resultCode)) {
result.put(isRefund ? "refundResult" : "releaseResult", Boolean.TRUE);
@@ -260,7 +261,7 @@
}
}
- public static Map<String, Object> ccCreditRefund(DispatchContext dctx, Map<String, Object> context) {
+ public static Map ccCreditRefund(DispatchContext dctx, Map context) {
GenericValue orderPaymentPreference = (GenericValue) context.get("orderPaymentPreference");
//lets see if there is a auth transaction already in context
@@ -305,7 +306,7 @@
}
if (out != null) {
- Map<String, Object> result = ServiceUtil.returnSuccess();
+ Map result = ServiceUtil.returnSuccess();
String resultCode = out.get(RitaApi.RESULT);
if ("CAPTURED".equals(resultCode)) {
result.put("refundResult", Boolean.TRUE);
@@ -324,7 +325,7 @@
}
}
- public static Map<String, Object> ccRefund(DispatchContext dctx, Map<String, Object> context) {
+ public static Map ccRefund(DispatchContext dctx, Map context) {
LocalDispatcher dispatcher = dctx.getDispatcher();
Delegator delegator = dctx.getDelegator();
GenericValue orderPaymentPreference = (GenericValue) context.get("orderPaymentPreference");
@@ -343,7 +344,7 @@
Timestamp orderDate = orderHeader.getTimestamp("orderDate");
GenericValue terminalState = null;
try {
- List<GenericValue> states = delegator.findByAnd("PosTerminalState", UtilMisc.toMap("posTerminalId", terminalId));
+ List states = delegator.findByAnd("PosTerminalState", UtilMisc.toMap("posTerminalId", terminalId));
states = EntityUtil.filterByDate(states, UtilDateTime.nowTimestamp(), "openedDate", "closedDate", true);
terminalState = EntityUtil.getFirst(states);
} catch (GenericEntityException e) {
@@ -361,7 +362,7 @@
}
}
- Map<String, Object> refundResp = null;
+ Map refundResp = null;
try {
if (isVoid) {
refundResp = dispatcher.runSync("ritaCCVoidRefund", context);
@@ -378,14 +379,14 @@
}
}
- private static void setCreditCardInfo(RitaApi api, Delegator delegator, Map<String, Object> context) throws GeneralException {
+ private static void setCreditCardInfo(RitaApi api, Delegator delegator, Map 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<String> expDateList = StringUtil.split(creditCard.getString("expireDate"), "/");
+ List expDateList = StringUtil.split(creditCard.getString("expireDate"), "/");
String month = (String) expDateList.get(0);
String year = (String) expDateList.get(1);
String y2d = year.substring(2);
@@ -482,7 +483,7 @@
return api;
}
- private static Properties buildPccProperties(Map<String, Object> context) {
+ private static Properties buildPccProperties(Map context) {
String configString = (String) context.get("paymentConfig");
if (configString == null) {
configString = "payment.properties";
@@ -526,7 +527,7 @@
return props;
}
- private static String getAmountString(Map<String, Object> context, String amountField) {
+ private static String getAmountString(Map 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=882342&r1=882341&r2=882342&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 22:45:56 2009
@@ -30,6 +30,8 @@
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;
@@ -60,8 +62,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;
@@ -74,7 +76,7 @@
public static final String module = ValueLinkApi.class.getName();
// static object cache
- private static Map<String, ValueLinkApi> objectCache = new HashMap<String, ValueLinkApi>();
+ private static Map objectCache = new HashMap();
// instance variables
protected Delegator delegator = null;
@@ -118,10 +120,10 @@
throw new IllegalArgumentException("Properties cannot be null");
}
- ValueLinkApi api = objectCache.get(merchantId);
+ ValueLinkApi api = (ValueLinkApi) objectCache.get(merchantId);
if (api == null || reload) {
synchronized(ValueLinkApi.class) {
- api = objectCache.get(merchantId);
+ api = (ValueLinkApi) objectCache.get(merchantId);
if (api == null || reload) {
api = new ValueLinkApi(delegator, props);
objectCache.put(merchantId, api);
@@ -231,7 +233,7 @@
* @return Map of response parameters
* @throws HttpClientException
*/
- public Map<String, Object> send(Map<String, Object> request) throws HttpClientException {
+ public Map send(Map request) throws HttpClientException {
return send((String) props.get("payment.valuelink.url"), request);
}
@@ -242,7 +244,7 @@
* @return Map of response parameters
* @throws HttpClientException
*/
- public Map<String, Object> send(String url, Map<String, Object> request) throws HttpClientException {
+ public Map send(String url, Map request) throws HttpClientException {
if (debug) {
Debug.log("Request : " + url + " / " + request, module);
}
@@ -695,8 +697,8 @@
* Note: For 2010 (assign working key) transaction, the EncryptID will need to be adjusted
* @return Map containing the inital request values
*/
- public Map<String, Object> getInitialRequestMap(Map<String, Object> context) {
- Map<String, Object> request = new HashMap<String, Object>();
+ public Map getInitialRequestMap(Map context) {
+ Map request = new HashMap();
// merchant information
request.put("MerchID", merchantId + terminalId);
@@ -903,7 +905,7 @@
return StringUtil.fromHexString(this.getGenericValue().getString("privateKey"));
}
- protected Map<String, Object> parseResponse(String response) {
+ protected Map parseResponse(String response) {
if (debug) {
Debug.log("Raw Response : " + response, module);
}
@@ -916,7 +918,7 @@
// check for a history table
String history = null;
- List<Map<String, String>> historyMapList = null;
+ List historyMapList = null;
if (subResponse.indexOf("<table") > -1) {
int startHistory = subResponse.indexOf("<table");
int endHistory = subResponse.indexOf("</table>") + 8;
@@ -941,7 +943,7 @@
subResponse = StringUtil.replaceString(subResponse, "</td>", "");
// make the map
- Map<String, Object> responseMap = UtilGenerics.cast(StringUtil.strToMap(subResponse, true));
+ Map responseMap = StringUtil.strToMap(subResponse, true);
// add the raw html back in just in case we need it later
responseMap.put("_rawHtmlResponse", response);
@@ -959,7 +961,7 @@
return responseMap;
}
- private List<Map<String, String>> parseHistoryResponse(String response) {
+ private List parseHistoryResponse(String response) {
if (debug) {
Debug.log("Raw History : " + response, module);
}
@@ -993,12 +995,12 @@
// split sets of values up
values = StringUtil.replaceString(values, "|</tr><tr>", "&");
- List<String> valueList = StringUtil.split(values, "&");
+ List valueList = StringUtil.split(values, "&");
// create a List of Maps for each set of values
- List<Map<String, String>> valueMap = new ArrayList<Map<String, String>>();
+ List valueMap = new ArrayList();
for (int i = 0; i < valueList.size(); i++) {
- valueMap.add(StringUtil.createMap(StringUtil.split(keys, "|"), StringUtil.split(valueList.get(i), "|")));
+ valueMap.add(StringUtil.createMap(StringUtil.split(keys, "|"), StringUtil.split((String) 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=882342&r1=882341&r2=882342&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 22:45:56 2009
@@ -20,11 +20,11 @@
import java.math.BigDecimal;
import java.util.HashMap;
+import java.util.Iterator;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.Properties;
-
import javax.transaction.xa.XAException;
import org.ofbiz.base.util.Debug;
@@ -56,7 +56,7 @@
public static final String module = ValueLinkServices.class.getName();
// generate/display new public/private/kek keys
- public static Map<String, Object> createKeys(DispatchContext dctx, Map<String, Object> context) {
+ public static Map createKeys(DispatchContext dctx, Map 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<String, Object> result = ServiceUtil.returnSuccess();
+ Map result = ServiceUtil.returnSuccess();
result.put("output", output);
return result;
}
// test the KEK encryption
- public static Map<String, Object> testKekEncryption(DispatchContext dctx, Map<String, Object> context) {
+ public static Map testKekEncryption(DispatchContext dctx, Map 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<String, Object> result = ServiceUtil.returnSuccess();
+ Map result = ServiceUtil.returnSuccess();
result.put("output", output);
return result;
}
// change working key service
- public static Map<String, Object> assignWorkingKey(DispatchContext dctx, Map<String, Object> context) {
+ public static Map assignWorkingKey(DispatchContext dctx, Map 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<String, Object> request = vl.getInitialRequestMap(context);
+ Map 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<String, Object> response = null;
+ Map response = null;
try {
response = vl.send(request);
} catch (HttpClientException e) {
@@ -191,7 +191,7 @@
}
}
- public static Map<String, Object> activate(DispatchContext dctx, Map<String, Object> context) {
+ public static Map activate(DispatchContext dctx, Map 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<String, Object> request = vl.getInitialRequestMap(context);
+ Map 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<String, Object> response = null;
+ Map response = null;
try {
response = vl.send(request);
} catch (HttpClientException e) {
@@ -246,7 +246,7 @@
if (response != null) {
String responseCode = (String) response.get("responsecode");
- Map<String, Object> result = ServiceUtil.returnSuccess();
+ Map 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<String, Object> linkPhysicalCard(DispatchContext dctx, Map<String, Object> context) {
+ public static Map linkPhysicalCard(DispatchContext dctx, Map 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<String, Object> request = vl.getInitialRequestMap(context);
+ Map 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<String, Object> response = null;
+ Map response = null;
try {
response = vl.send(request);
} catch (HttpClientException e) {
@@ -302,7 +302,7 @@
if (response != null) {
String responseCode = (String) response.get("responsecode");
- Map<String, Object> result = ServiceUtil.returnSuccess("Activation of physical card complete.");
+ Map result = ServiceUtil.returnSuccess("Activation of physical card complete.");
if (responseCode.equals("00")) {
result.put("processResult", Boolean.TRUE);
@@ -322,7 +322,7 @@
}
}
- public static Map<String, Object> disablePin(DispatchContext dctx, Map<String, Object> context) {
+ public static Map disablePin(DispatchContext dctx, Map 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<String, Object> request = vl.getInitialRequestMap(context);
+ Map 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<String, Object> response = null;
+ Map response = null;
try {
response = vl.send(request);
} catch (HttpClientException e) {
@@ -360,7 +360,7 @@
if (response != null) {
String responseCode = (String) response.get("responsecode");
- Map<String, Object> result = ServiceUtil.returnSuccess("PIN disabled.");
+ Map result = ServiceUtil.returnSuccess("PIN disabled.");
if (responseCode.equals("00")) {
result.put("processResult", Boolean.TRUE);
} else {
@@ -378,7 +378,7 @@
}
}
- public static Map<String, Object> redeem(DispatchContext dctx, Map<String, Object> context) {
+ public static Map redeem(DispatchContext dctx, Map 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<String, Object> request = vl.getInitialRequestMap(context);
+ Map 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<String, Object> response = null;
+ Map response = null;
try {
response = vl.send(request);
} catch (HttpClientException e) {
@@ -424,7 +424,7 @@
if (response != null) {
String responseCode = (String) response.get("responsecode");
- Map<String, Object> result = ServiceUtil.returnSuccess();
+ Map result = ServiceUtil.returnSuccess();
if (responseCode.equals("00")) {
result.put("processResult", Boolean.TRUE);
} else {
@@ -445,7 +445,7 @@
}
}
- public static Map<String, Object> reload(DispatchContext dctx, Map<String, Object> context) {
+ public static Map reload(DispatchContext dctx, Map 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<String, Object> request = vl.getInitialRequestMap(context);
+ Map 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<String, Object> response = null;
+ Map response = null;
try {
response = vl.send(request);
} catch (HttpClientException e) {
@@ -491,7 +491,7 @@
if (response != null) {
String responseCode = (String) response.get("responsecode");
- Map<String, Object> result = ServiceUtil.returnSuccess();
+ Map result = ServiceUtil.returnSuccess();
if (responseCode.equals("00")) {
result.put("processResult", Boolean.TRUE);
} else {
@@ -511,7 +511,7 @@
}
}
- public static Map<String, Object> balanceInquire(DispatchContext dctx, Map<String, Object> context) {
+ public static Map balanceInquire(DispatchContext dctx, Map 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<String, Object> request = vl.getInitialRequestMap(context);
+ Map 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<String, Object> response = null;
+ Map response = null;
try {
response = vl.send(request);
} catch (HttpClientException e) {
@@ -549,7 +549,7 @@
if (response != null) {
String responseCode = (String) response.get("responsecode");
- Map<String, Object> result = ServiceUtil.returnSuccess();
+ Map result = ServiceUtil.returnSuccess();
if (responseCode.equals("00")) {
result.put("processResult", Boolean.TRUE);
} else {
@@ -567,7 +567,7 @@
}
}
- public static Map<String, Object> transactionHistory(DispatchContext dctx, Map<String, Object> context) {
+ public static Map transactionHistory(DispatchContext dctx, Map 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<String, Object> request = vl.getInitialRequestMap(context);
+ Map 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<String, Object> response = null;
+ Map response = null;
try {
response = vl.send(request);
} catch (HttpClientException e) {
@@ -603,7 +603,7 @@
if (response != null) {
String responseCode = (String) response.get("responsecode");
- Map<String, Object> result = ServiceUtil.returnSuccess();
+ Map result = ServiceUtil.returnSuccess();
if (responseCode.equals("00")) {
result.put("processResult", Boolean.TRUE);
} else {
@@ -622,7 +622,7 @@
}
}
- public static Map<String, Object> refund(DispatchContext dctx, Map<String, Object> context) {
+ public static Map refund(DispatchContext dctx, Map 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<String, Object> request = vl.getInitialRequestMap(context);
+ Map 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<String, Object> response = null;
+ Map response = null;
try {
response = vl.send(request);
} catch (HttpClientException e) {
@@ -668,7 +668,7 @@
if (response != null) {
String responseCode = (String) response.get("responsecode");
- Map<String, Object> result = ServiceUtil.returnSuccess();
+ Map result = ServiceUtil.returnSuccess();
if (responseCode.equals("00")) {
result.put("processResult", Boolean.TRUE);
} else {
@@ -688,27 +688,27 @@
}
}
- public static Map<String, Object> voidRedeem(DispatchContext dctx, Map<String, Object> context) {
+ public static Map voidRedeem(DispatchContext dctx, Map context) {
context.put("Interface", "Redeem/Void");
return redeem(dctx, context);
}
- public static Map<String, Object> voidRefund(DispatchContext dctx, Map<String, Object> context) {
+ public static Map voidRefund(DispatchContext dctx, Map context) {
context.put("Interface", "Refund/Void");
return refund(dctx, context);
}
- public static Map<String, Object> voidReload(DispatchContext dctx, Map<String, Object> context) {
+ public static Map voidReload(DispatchContext dctx, Map context) {
context.put("Interface", "Reload/Void");
return reload(dctx, context);
}
- public static Map<String, Object> voidActivate(DispatchContext dctx, Map<String, Object> context) {
+ public static Map voidActivate(DispatchContext dctx, Map context) {
context.put("Interface", "Activate/Void");
return activate(dctx, context);
}
- public static Map<String, Object> timeOutReversal(DispatchContext dctx, Map<String, Object> context) {
+ public static Map timeOutReversal(DispatchContext dctx, Map 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<String, Object> ctx, Map<String, Object> request) {
+ private static void setTimeoutReversal(DispatchContext dctx, Map ctx, Map request) {
String vlInterface = (String) request.get("Interface");
// clone the context
- Map<String, Object> context = new HashMap<String, Object>(ctx);
+ Map context = new HashMap(ctx);
// append the rollback interface
if (!vlInterface.endsWith("Rollback")) {
@@ -762,7 +762,7 @@
}
}
- private static Properties getProperties(Map<String, Object> context) {
+ private static Properties getProperties(Map 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<String, Object> giftCardProcessor(DispatchContext dctx, Map<String, Object> context) {
+ public static Map giftCardProcessor(DispatchContext dctx, Map 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<String, Object> redeemCtx = new HashMap<String, Object>();
+ Map redeemCtx = new HashMap();
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<String, Object> redeemResult = null;
+ Map redeemResult = null;
try {
redeemResult = dispatcher.runSync("redeemGiftCard", redeemCtx);
} catch (GenericServiceException e) {
@@ -808,7 +808,7 @@
return ServiceUtil.returnError("Redeem service failed");
}
- Map<String, Object> result = ServiceUtil.returnSuccess();
+ Map 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<String, Object> voidResult = null;
+ Map voidResult = null;
try {
voidResult = dispatcher.runSync("voidRedeemGiftCard", redeemCtx);
} catch (GenericServiceException e) {
@@ -848,7 +848,7 @@
return result;
}
- public static Map<String, Object> giftCardRelease(DispatchContext dctx, Map<String, Object> context) {
+ public static Map giftCardRelease(DispatchContext dctx, Map 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<String, Object> redeemCtx = new HashMap<String, Object>();
+ Map redeemCtx = new HashMap();
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<String, Object> redeemResult = null;
+ Map redeemResult = null;
try {
redeemResult = dispatcher.runSync("voidRedeemGiftCard", redeemCtx);
} catch (GenericServiceException e) {
@@ -896,7 +896,7 @@
return ServiceUtil.returnError("Redeem service failed");
}
- Map<String, Object> result = ServiceUtil.returnSuccess();
+ Map 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<String, Object> giftCardRefund(DispatchContext dctx, Map<String, Object> context) {
+ public static Map giftCardRefund(DispatchContext dctx, Map 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<String, Object> refundCtx = new HashMap<String, Object>();
+ Map refundCtx = new HashMap();
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<String, Object> redeemResult = null;
+ Map redeemResult = null;
try {
redeemResult = dispatcher.runSync("refundGiftCard", refundCtx);
} catch (GenericServiceException e) {
@@ -957,7 +957,7 @@
return ServiceUtil.returnError("Refund service failed");
}
- Map<String, Object> result = ServiceUtil.returnSuccess();
+ Map 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<String, Object> giftCardPurchase(DispatchContext dctx, Map<String, Object> context) {
+ public static Map giftCardPurchase(DispatchContext dctx, Map 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<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);
+ Map fields = UtilMisc.toMap("productId", product.get("productId"), "productFeatureTypeId", "TYPE");
+ List order = UtilMisc.toList("-fromDate");
+ List 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<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);
+ Map fields = UtilMisc.toMap("orderId", orderId, "orderItemSeqId", orderItem.get("orderItemSeqId"), "surveyId", surveyId);
+ List order = UtilMisc.toList("-responseDate");
+ List 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<GenericValue> responseAnswers = null;
+ List responseAnswers = null;
try {
responseAnswers = surveyResponse.getRelated("SurveyResponseAnswer");
} catch (GenericEntityException e) {
@@ -1092,9 +1092,11 @@
}
// make a map of answer info
- Map<String, Object> answerMap = new HashMap<String, Object>();
+ Map answerMap = new HashMap();
if (responseAnswers != null) {
- for(GenericValue answer : responseAnswers) {
+ Iterator rai = responseAnswers.iterator();
+ while (rai.hasNext()) {
+ GenericValue answer = (GenericValue) rai.next();
GenericValue question = null;
try {
question = answer.getRelatedOne("SurveyQuestion");
@@ -1124,7 +1126,7 @@
int qtyLoop = quantity.intValue();
for (int i = 0; i < qtyLoop; i++) {
// activate a gift card
- Map<String, Object> activateCtx = new HashMap<String, Object>();
+ Map activateCtx = new HashMap();
activateCtx.put("paymentConfig", paymentConfig);
activateCtx.put("vlPromoCode", promoCode);
activateCtx.put("currency", currency);
@@ -1134,7 +1136,7 @@
activateCtx.put("userLogin", userLogin);
boolean failure = false;
- Map<String, Object> activateResult = null;
+ Map activateResult = null;
try {
activateResult = dispatcher.runSync("activateGiftCard", activateCtx);
} catch (GenericServiceException e) {
@@ -1161,7 +1163,7 @@
}
// create the fulfillment record
- Map<String, Object> vlFulFill = new HashMap<String, Object>();
+ Map vlFulFill = new HashMap();
vlFulFill.put("typeEnumId", "GC_ACTIVATE");
vlFulFill.put("merchantId", UtilProperties.getPropertyValue(paymentConfig, "payment.valuelink.merchantId"));
vlFulFill.put("partyId", partyId);
@@ -1218,7 +1220,7 @@
}
}
- Map<String, Object> emailCtx = new HashMap<String, Object>();
+ Map emailCtx = new HashMap();
String bodyScreenLocation = productStoreEmail.getString("bodyScreenLocation");
if (UtilValidate.isEmpty(bodyScreenLocation)) {
bodyScreenLocation = ProductStoreWorker.getDefaultProductStoreEmailScreenLocation(emailType);
@@ -1247,7 +1249,7 @@
return ServiceUtil.returnSuccess();
}
- public static Map<String, Object> giftCardReload(DispatchContext dctx, Map<String, Object> context) {
+ public static Map giftCardReload(DispatchContext dctx, Map context) {
// this service should always be called via FULFILLMENT_EXTSYNC
LocalDispatcher dispatcher = dctx.getDispatcher();
Delegator delegator = dctx.getDelegator();
@@ -1313,9 +1315,9 @@
// get the survey response
GenericValue surveyResponse = null;
try {
- 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);
+ Map fields = UtilMisc.toMap("orderId", orderId, "orderItemSeqId", orderItem.get("orderItemSeqId"), "surveyId", surveyId);
+ List order = UtilMisc.toList("-responseDate");
+ List responses = delegator.findByAnd("SurveyResponse", fields, order);
// there should be only one
surveyResponse = EntityUtil.getFirst(responses);
} catch (GenericEntityException e) {
@@ -1324,7 +1326,7 @@
}
// get the response answers
- List<GenericValue> responseAnswers = null;
+ List responseAnswers = null;
try {
responseAnswers = surveyResponse.getRelated("SurveyResponseAnswer");
} catch (GenericEntityException e) {
@@ -1333,10 +1335,12 @@
}
// make a map of answer info
- Map<String, Object> answerMap = new HashMap<String, Object>();
+ Map answerMap = new HashMap();
if (responseAnswers != null) {
- for (GenericValue answer: responseAnswers) {
- GenericValue question = null;
+ Iterator rai = responseAnswers.iterator();
+ while (rai.hasNext()) {
+ GenericValue answer = (GenericValue) rai.next();
+ GenericValue question = null;
try {
question = answer.getRelatedOne("SurveyQuestion");
} catch (GenericEntityException e) {
@@ -1357,7 +1361,7 @@
String pinNumber = (String) answerMap.get(pinNumberKey);
// reload the gift card
- Map<String, Object> reloadCtx = new HashMap<String, Object>();
+ Map reloadCtx = new HashMap();
reloadCtx.put("paymentConfig", paymentConfig);
reloadCtx.put("currency", currency);
reloadCtx.put("partyId", partyId);
@@ -1367,7 +1371,7 @@
reloadCtx.put("amount", amount);
reloadCtx.put("userLogin", userLogin);
- Map<String, Object> reloadResult = null;
+ Map reloadResult = null;
try {
reloadResult = dispatcher.runSync("reloadGiftCard", reloadCtx);
} catch (GenericServiceException e) {
@@ -1376,7 +1380,7 @@
}
// create the fulfillment record
- Map<String, Object> vlFulFill = new HashMap<String, Object>();
+ Map vlFulFill = new HashMap();
vlFulFill.put("typeEnumId", "GC_RELOAD");
vlFulFill.put("merchantId", UtilProperties.getPropertyValue(paymentConfig, "payment.valuelink.merchantId"));
vlFulFill.put("partyId", partyId);
@@ -1403,7 +1407,7 @@
// process the return
try {
- Map<String, Object> refundCtx = UtilMisc.toMap("orderItem", orderItem, "partyId", partyId, "userLogin", userLogin);
+ Map 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);
@@ -1439,7 +1443,7 @@
if (productStoreEmail == null) {
Debug.logError("No gift card purchase email setting found for this store; cannot send gift card information", module);
} else {
- Map<String, Object> emailCtx = new HashMap<String, Object>();
+ Map emailCtx = new HashMap();
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=882342&r1=882341&r2=882342&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 22:45:56 2009
@@ -20,10 +20,9 @@
package org.ofbiz.accounting.util;
import java.math.BigDecimal;
+import java.util.Iterator;
import java.util.List;
-import javolution.util.FastList;
-
import org.ofbiz.accounting.AccountingException;
import org.ofbiz.base.util.Debug;
import org.ofbiz.base.util.UtilMisc;
@@ -31,6 +30,8 @@
import org.ofbiz.entity.GenericEntityException;
import org.ofbiz.entity.GenericValue;
+import javolution.util.FastList;
+
public class UtilAccounting {
@@ -116,15 +117,17 @@
return balance;
}
- public static List<String> getDescendantGlAccountClassIds(GenericValue glAccountClass) throws GenericEntityException {
- List<String> glAccountClassIds = FastList.newInstance();
+ public static List getDescendantGlAccountClassIds(GenericValue glAccountClass) throws GenericEntityException {
+ List glAccountClassIds = FastList.newInstance();
getGlAccountClassChildren(glAccountClass, glAccountClassIds);
return glAccountClassIds;
}
- private static void getGlAccountClassChildren(GenericValue glAccountClass, List<String> glAccountClassIds) throws GenericEntityException {
+ private static void getGlAccountClassChildren(GenericValue glAccountClass, List glAccountClassIds) throws GenericEntityException {
glAccountClassIds.add(glAccountClass.getString("glAccountClassId"));
- List<GenericValue> glAccountClassChildren = glAccountClass.getRelatedCache("ChildGlAccountClass");
- for(GenericValue glAccountClassChild : glAccountClassChildren) {
+ List glAccountClassChildren = glAccountClass.getRelatedCache("ChildGlAccountClass");
+ Iterator glAccountClassChildrenIt = glAccountClassChildren.iterator();
+ while (glAccountClassChildrenIt.hasNext()) {
+ GenericValue glAccountClassChild = (GenericValue) glAccountClassChildrenIt.next();
getGlAccountClassChildren(glAccountClassChild, glAccountClassIds);
}
}