Author: mrisaliti
Date: Mon Jan 17 21:07:06 2011
New Revision: 1060092
URL: http://svn.apache.org/viewvc?rev=1060092&view=rev
Log:
Internationalization of ServiceUtil.returnSuccess, ServiceUtil.returnFailure,
ServiceUtil.returnError (OFBIZ-4091)
Modified:
ofbiz/trunk/applications/accounting/config/AccountingUiLabels.xml
ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/thirdparty/gosoftware/PcChargeServices.java
ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/thirdparty/gosoftware/RitaServices.java
Modified: ofbiz/trunk/applications/accounting/config/AccountingUiLabels.xml
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/config/AccountingUiLabels.xml?rev=1060092&r1=1060091&r2=1060092&view=diff
==============================================================================
--- ofbiz/trunk/applications/accounting/config/AccountingUiLabels.xml (original)
+++ ofbiz/trunk/applications/accounting/config/AccountingUiLabels.xml Mon Jan
17 21:07:06 2011
@@ -8773,6 +8773,18 @@
<value xml:lang="en">Unable to obtain cc information from payment
preference</value>
<value xml:lang="it">Non è possibile le informazioni della carta di
carta dalle preferenze pagamento ordine</value>
</property>
+ <property key="AccountingPcChargeErrorGettingPaymentGatewayConfig">
+ <value xml:lang="en">PcCharge is not configured properly</value>
+ <value xml:lang="it">PcCharge non è configurato propriamente</value>
+ </property>
+ <property key="AccountingPcChargeCannotSupportReleasingPreAuth">
+ <value xml:lang="en">PcCharge does not support releasing
pre-auths.</value>
+ <value xml:lang="it">PcCharge non supporta rilascio
pre-autorizzazioni.</value>
+ </property>
+ <property key="AccountingPcChargeResultIsNull">
+ <value xml:lang="en">Receive a null result from PcCharge</value>
+ <value xml:lang="it">Ricevuto risultato nullo da PcCharge</value>
+ </property>
<property key="AccountingPermissionError">
<value xml:lang="ar">ÙØ§ رخصة ÙØ¯ÙÙÙ
ÙÙØ°Ù
Ø§ÙØ¹Ù
ÙÙØ©</value>
<value xml:lang="de">Sie haben keine Berechtigung für diese
Funktion.</value>
@@ -8805,6 +8817,22 @@
<property key="AccountingPastDueInvoices">
<value xml:lang="en">Past Due Invoices</value>
</property>
+ <property key="AccountingRitaErrorGettingPaymentGatewayConfig">
+ <value xml:lang="en">RiTA is not configured properly</value>
+ <value xml:lang="it">RiTA non è configurato propriamente</value>
+ </property>
+ <property key="AccountingRitaErrorServiceException">
+ <value xml:lang="en">Service invocation exception</value>
+ <value xml:lang="it">Eccezione durante l'invocazione del
servizio</value>
+ </property>
+ <property key="AccountingRitaCannotSupportReleasingPreAuth">
+ <value xml:lang="en">RiTA does not support releasing pre-auths.</value>
+ <value xml:lang="it">RiTA non supporta rilascio
pre-autorizzazioni.</value>
+ </property>
+ <property key="AccountingRitaResultIsNull">
+ <value xml:lang="en">Receive a null result from RiTA</value>
+ <value xml:lang="it">Ricevuto risultato nullo da RiTA</value>
+ </property>
<property key="AccountingOrgPartyId">
<value xml:lang="en">Org Party Id</value>
<value xml:lang="fr">Réf. d'org.</value>
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=1060092&r1=1060091&r2=1060092&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
Mon Jan 17 21:07:06 2011
@@ -21,6 +21,7 @@ package org.ofbiz.accounting.thirdparty.
import java.io.IOException;
import java.math.BigDecimal;
import java.util.List;
+import java.util.Locale;
import java.util.Map;
import java.util.Properties;
@@ -42,12 +43,15 @@ public class PcChargeServices {
public static final String module = PcChargeServices.class.getName();
private static int decimals =
UtilNumber.getBigDecimalScale("invoice.decimals");
private static int rounding =
UtilNumber.getBigDecimalRoundingMode("invoice.rounding");
+ public final static String resource = "AccountingUiLabels";
public static Map<String, Object> ccAuth(DispatchContext dctx, Map<String,
? extends Object> context) {
+ Locale locale = (Locale) context.get("locale");
Properties props = buildPccProperties(context);
PcChargeApi api = getApi(props);
if (api == null) {
- return ServiceUtil.returnError("PCCharge is not configured
properly");
+ return ServiceUtil.returnError(UtilProperties.getMessage(resource,
+ "AccountingPcChargeErrorGettingPaymentGatewayConfig",
locale));
}
try {
@@ -125,12 +129,14 @@ public class PcChargeServices {
return result;
} else {
- return ServiceUtil.returnError("Receive a null result from
PcCharge");
+ return ServiceUtil.returnError(UtilProperties.getMessage(resource,
+ "AccountingPcChargeResultIsNull", locale));
}
}
public static Map<String, Object> ccCapture(DispatchContext dctx,
Map<String, ? extends Object> context) {
GenericValue orderPaymentPreference = (GenericValue)
context.get("orderPaymentPreference");
+ Locale locale = (Locale) context.get("locale");
//lets see if there is a auth transaction already in context
GenericValue authTransaction = (GenericValue) context.get("authTrans");
@@ -140,14 +146,16 @@ public class PcChargeServices {
}
if (authTransaction == null) {
- return ServiceUtil.returnError("No authorization transaction found
for the OrderPaymentPreference; cannot capture");
+ return ServiceUtil.returnError(UtilProperties.getMessage(resource,
+
"AccountingPaymentTransactionAuthorizationNotFoundCannotCapture", locale));
}
// setup the PCCharge Interface
Properties props = buildPccProperties(context);
PcChargeApi api = getApi(props);
if (api == null) {
- return ServiceUtil.returnError("PCCharge is not configured
properly");
+ return ServiceUtil.returnError(UtilProperties.getMessage(resource,
+ "AccountingPcChargeErrorGettingPaymentGatewayConfig",
locale));
}
api.set(PcChargeApi.TROUTD, authTransaction.getString("referenceNum"));
@@ -181,7 +189,8 @@ public class PcChargeServices {
return result;
} else {
- return ServiceUtil.returnError("Receive a null result from
PcCharge");
+ return ServiceUtil.returnError(UtilProperties.getMessage(resource,
+ "AccountingPcChargeResultIsNull", locale));
}
}
@@ -190,20 +199,23 @@ public class PcChargeServices {
//lets see if there is a auth transaction already in context
GenericValue authTransaction = (GenericValue) context.get("authTrans");
+ Locale locale = (Locale) context.get("locale");
if (authTransaction == null) {
authTransaction =
PaymentGatewayServices.getAuthTransaction(orderPaymentPreference);
}
if (authTransaction == null) {
- return ServiceUtil.returnError("No authorization transaction found
for the OrderPaymentPreference; cannot release");
+ return ServiceUtil.returnError(UtilProperties.getMessage(resource,
+
"AccountingPaymentTransactionAuthorizationNotFoundCannotRelease", locale));
}
// setup the PCCharge Interface
Properties props = buildPccProperties(context);
PcChargeApi api = getApi(props);
if (api == null) {
- return ServiceUtil.returnError("PCCharge is not configured
properly");
+ return ServiceUtil.returnError(UtilProperties.getMessage(resource,
+ "AccountingPcChargeErrorGettingPaymentGatewayConfig",
locale));
}
api.set(PcChargeApi.TROUTD, authTransaction.getString("referenceNum"));
@@ -211,7 +223,8 @@ public class PcChargeServices {
// check to make sure we are configured for SALE mode
if (!"true".equalsIgnoreCase(props.getProperty("autoBill"))) {
- return ServiceUtil.returnError("PCCharge does not support
releasing pre-auths.");
+ return ServiceUtil.returnError(UtilProperties.getMessage(resource,
+ "AccountingPcChargeCannotSupportReleasingPreAuth",
locale));
}
// send the transaction
@@ -242,7 +255,8 @@ public class PcChargeServices {
return result;
} else {
- return ServiceUtil.returnError("Receive a null result from
PcCharge");
+ return ServiceUtil.returnError(UtilProperties.getMessage(resource,
+ "AccountingPcChargeResultIsNull", locale));
}
}
@@ -251,20 +265,23 @@ public class PcChargeServices {
//lets see if there is a auth transaction already in context
GenericValue authTransaction = (GenericValue) context.get("authTrans");
+ Locale locale = (Locale) context.get("locale");
if (authTransaction == null) {
authTransaction =
PaymentGatewayServices.getAuthTransaction(orderPaymentPreference);
}
if (authTransaction == null) {
- return ServiceUtil.returnError("No authorization transaction found
for the OrderPaymentPreference; cannot refund");
+ return ServiceUtil.returnError(UtilProperties.getMessage(resource,
+
"AccountingPaymentTransactionAuthorizationNotFoundCannotRefund", locale));
}
// setup the PCCharge Interface
Properties props = buildPccProperties(context);
PcChargeApi api = getApi(props);
if (api == null) {
- return ServiceUtil.returnError("PCCharge is not configured
properly");
+ return ServiceUtil.returnError(UtilProperties.getMessage(resource,
+ "AccountingPcChargeErrorGettingPaymentGatewayConfig",
locale));
}
api.set(PcChargeApi.TROUTD, authTransaction.getString("referenceNum"));
@@ -298,7 +315,8 @@ public class PcChargeServices {
return result;
} else {
- return ServiceUtil.returnError("Receive a null result from
PcCharge");
+ return ServiceUtil.returnError(UtilProperties.getMessage(resource,
+ "AccountingPcChargeResultIsNull", locale));
}
}
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=1060092&r1=1060091&r2=1060092&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
Mon Jan 17 21:07:06 2011
@@ -22,6 +22,7 @@ import java.io.IOException;
import java.math.BigDecimal;
import java.sql.Timestamp;
import java.util.List;
+import java.util.Locale;
import java.util.Map;
import java.util.Properties;
@@ -49,12 +50,16 @@ public class RitaServices {
public static final String module = RitaServices.class.getName();
private static int decimals =
UtilNumber.getBigDecimalScale("invoice.decimals");
private static int rounding =
UtilNumber.getBigDecimalRoundingMode("invoice.rounding");
+ public final static String resource = "AccountingUiLabels";
+ public static final String resourceOrder = "OrderUiLabels";
public static Map<String, Object> ccAuth(DispatchContext dctx, Map<String,
? extends Object> context) {
+ Locale locale = (Locale) context.get("locale");
Properties props = buildPccProperties(context);
RitaApi api = getApi(props, "CREDIT");
if (api == null) {
- return ServiceUtil.returnError("RiTA is not configured properly");
+ return ServiceUtil.returnError(UtilProperties.getMessage(resource,
+ "AccountingRitaErrorGettingPaymentGatewayConfig", locale));
}
try {
@@ -130,12 +135,14 @@ public class RitaServices {
return result;
} else {
- return ServiceUtil.returnError("Receive a null result from RiTA");
+ return ServiceUtil.returnError(UtilProperties.getMessage(resource,
+ "AccountingRitaResultIsNull", locale));
}
}
public static Map<String, Object> ccCapture(DispatchContext dctx,
Map<String, ? extends Object> context) {
GenericValue orderPaymentPreference = (GenericValue)
context.get("orderPaymentPreference");
+ Locale locale = (Locale) context.get("locale");
//lets see if there is a auth transaction already in context
GenericValue authTransaction = (GenericValue) context.get("authTrans");
@@ -145,14 +152,16 @@ public class RitaServices {
}
if (authTransaction == null) {
- return ServiceUtil.returnError("No authorization transaction found
for the OrderPaymentPreference; cannot capture");
+ return ServiceUtil.returnError(UtilProperties.getMessage(resource,
+
"AccountingPaymentTransactionAuthorizationNotFoundCannotCapture", locale));
}
// setup the RiTA Interface
Properties props = buildPccProperties(context);
RitaApi api = getApi(props, "CREDIT");
if (api == null) {
- return ServiceUtil.returnError("RiTA is not configured properly");
+ return ServiceUtil.returnError(UtilProperties.getMessage(resource,
+ "AccountingRitaErrorGettingPaymentGatewayConfig", locale));
}
api.set(RitaApi.ORIG_SEQ_NUM,
authTransaction.getString("referenceNum"));
@@ -186,7 +195,8 @@ public class RitaServices {
return result;
} else {
- return ServiceUtil.returnError("Receive a null result from RiTA");
+ return ServiceUtil.returnError(UtilProperties.getMessage(resource,
+ "AccountingRitaResultIsNull", locale));
}
}
@@ -200,6 +210,7 @@ public class RitaServices {
private static Map<String, Object> ccVoid(DispatchContext dctx,
Map<String, ? extends Object> context, boolean isRefund) {
GenericValue orderPaymentPreference = (GenericValue)
context.get("orderPaymentPreference");
+ Locale locale = (Locale) context.get("locale");
//lets see if there is a auth transaction already in context
GenericValue authTransaction = (GenericValue) context.get("authTrans");
@@ -209,14 +220,16 @@ public class RitaServices {
}
if (authTransaction == null) {
- return ServiceUtil.returnError("No authorization transaction found
for the OrderPaymentPreference; cannot release");
+ return ServiceUtil.returnError(UtilProperties.getMessage(resource,
+
"AccountingPaymentTransactionAuthorizationNotFoundCannotRelease", locale));
}
// setup the RiTA Interface
Properties props = buildPccProperties(context);
RitaApi api = getApi(props, "CREDIT");
if (api == null) {
- return ServiceUtil.returnError("RiTA is not configured properly");
+ return ServiceUtil.returnError(UtilProperties.getMessage(resource,
+ "AccountingRitaErrorGettingPaymentGatewayConfig", locale));
}
api.set(RitaApi.TRANS_AMOUNT, getAmountString(context, isRefund ?
"refundAmount" : "releaseAmount"));
@@ -225,7 +238,8 @@ public class RitaServices {
// check to make sure we are configured for SALE mode
if (!"1".equals(props.getProperty("autoBill"))) {
- return ServiceUtil.returnError("RiTA does not support releasing
pre-auths.");
+ return ServiceUtil.returnError(UtilProperties.getMessage(resource,
+ "AccountingRitaCannotSupportReleasingPreAuth", locale));
}
// send the transaction
@@ -256,12 +270,14 @@ public class RitaServices {
return result;
} else {
- return ServiceUtil.returnError("Receive a null result from RiTA");
+ return ServiceUtil.returnError(UtilProperties.getMessage(resource,
+ "AccountingRitaResultIsNull", locale));
}
}
public static Map<String, Object> ccCreditRefund(DispatchContext dctx,
Map<String, ? extends Object> context) {
GenericValue orderPaymentPreference = (GenericValue)
context.get("orderPaymentPreference");
+ Locale locale = (Locale) context.get("locale");
//lets see if there is a auth transaction already in context
GenericValue authTransaction = (GenericValue) context.get("authTrans");
@@ -271,14 +287,16 @@ public class RitaServices {
}
if (authTransaction == null) {
- return ServiceUtil.returnError("No authorization transaction found
for the OrderPaymentPreference; cannot refund");
+ return ServiceUtil.returnError(UtilProperties.getMessage(resource,
+
"AccountingPaymentTransactionAuthorizationNotFoundCannotRefund", locale));
}
// setup the RiTA Interface
Properties props = buildPccProperties(context);
RitaApi api = getApi(props, "CREDIT");
if (api == null) {
- return ServiceUtil.returnError("RiTA is not configured properly");
+ return ServiceUtil.returnError(UtilProperties.getMessage(resource,
+ "AccountingRitaErrorGettingPaymentGatewayConfig", locale));
}
// set the required cc info
@@ -320,7 +338,8 @@ public class RitaServices {
return result;
} else {
- return ServiceUtil.returnError("Receive a null result from RiTA");
+ return ServiceUtil.returnError(UtilProperties.getMessage(resource,
+ "AccountingRitaResultIsNull", locale));
}
}
@@ -328,12 +347,14 @@ public class RitaServices {
LocalDispatcher dispatcher = dctx.getDispatcher();
Delegator delegator = dctx.getDelegator();
GenericValue orderPaymentPreference = (GenericValue)
context.get("orderPaymentPreference");
+ Locale locale = (Locale) context.get("locale");
GenericValue orderHeader = null;
try {
orderHeader = orderPaymentPreference.getRelatedOne("OrderHeader");
} catch (GenericEntityException e) {
Debug.logError(e, module);
- return ServiceUtil.returnError("Unable to obtain order header
information from payment preference");
+ return
ServiceUtil.returnError(UtilProperties.getMessage(resourceOrder,
+ "OrderOrderNotFound", UtilMisc.toMap("orderId",
orderPaymentPreference.getString("orderId")), locale));
}
if (orderHeader != null) {
@@ -370,11 +391,13 @@ public class RitaServices {
}
} catch (GenericServiceException e) {
Debug.logError(e, module);
- return ServiceUtil.returnError("Service invocation exception");
+ return
ServiceUtil.returnError(UtilProperties.getMessage(resourceOrder,
+ "AccountingRitaErrorServiceException", locale));
}
return refundResp;
} else {
- return ServiceUtil.returnError("Unable to find order information;
cannot complete the refund");
+ return
ServiceUtil.returnError(UtilProperties.getMessage(resourceOrder,
+ "OrderOrderNotFound", UtilMisc.toMap("orderId",
orderPaymentPreference.getString("orderId")), locale));
}
}