Author: mrisaliti
Date: Tue Jan 18 21:17:21 2011 New Revision: 1060581 URL: http://svn.apache.org/viewvc?rev=1060581&view=rev Log: Internationalization of ServiceUtil.returnSuccess, ServiceUtil.returnFailure, ServiceUtil.returnError (OFBIZ-4091) Modified: ofbiz/trunk/applications/accounting/config/AccountingErrorUiLabels.xml ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/thirdparty/orbital/OrbitalPaymentServices.java Modified: ofbiz/trunk/applications/accounting/config/AccountingErrorUiLabels.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/config/AccountingErrorUiLabels.xml?rev=1060581&r1=1060580&r2=1060581&view=diff ============================================================================== --- ofbiz/trunk/applications/accounting/config/AccountingErrorUiLabels.xml (original) +++ ofbiz/trunk/applications/accounting/config/AccountingErrorUiLabels.xml Tue Jan 18 21:17:21 2011 @@ -279,6 +279,10 @@ <value xml:lang="en">You do not have permission to delete Payment Method for this partyId</value> <value xml:lang="it">Non hai il permesso per cancellare il metodo di pagamento per questo soggetto</value> </property> + <property key="AccountingOrbital"> + <value xml:lang="en">An error occurred while retreiving cart details</value> + <value xml:lang="it">Un'errore è successo mentre ricavavo i dettagli del carrello</value> + </property> <property key="AccountingPayPalCommunicationError"> <value xml:lang="en">A problem occurred while communicating with PayPal, please try again or select a different checkout method</value> <value xml:lang="hi_IN">Paypal सॠसà¤à¤à¤¾à¤° मà¥à¤ समसà¥à¤¯à¤¾, à¤à¥à¤ªà¤¯à¤¾ पà¥à¤¨: पà¥à¤°à¤¯à¤¾à¤¸ à¤à¤°à¥à¤ या à¤à¤ ठलठCheckout पदà¥à¤§à¤¤à¤¿ à¤à¤¾ à¤à¤¯à¤¨ à¤à¤°à¥à¤</value> Modified: ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/thirdparty/orbital/OrbitalPaymentServices.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/thirdparty/orbital/OrbitalPaymentServices.java?rev=1060581&r1=1060580&r2=1060581&view=diff ============================================================================== --- ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/thirdparty/orbital/OrbitalPaymentServices.java (original) +++ ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/thirdparty/orbital/OrbitalPaymentServices.java Tue Jan 18 21:17:21 2011 @@ -19,6 +19,7 @@ package org.ofbiz.accounting.thirdparty.orbital; import java.math.BigDecimal; +import java.util.Locale; import java.util.Map; import javolution.util.FastMap; @@ -28,6 +29,7 @@ import org.ofbiz.base.util.Debug; import org.ofbiz.base.util.UtilFormatOut; import org.ofbiz.base.util.UtilMisc; import org.ofbiz.base.util.UtilNumber; +import org.ofbiz.base.util.UtilProperties; import org.ofbiz.base.util.UtilValidate; import org.ofbiz.entity.Delegator; import org.ofbiz.entity.GenericEntityException; @@ -52,6 +54,7 @@ public class OrbitalPaymentServices { public static String module = OrbitalPaymentServices.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 String APPROVED = "Approved"; public static String DECLINED = "Declined"; @@ -120,18 +123,20 @@ public class OrbitalPaymentServices { Delegator delegator = ctx.getDelegator(); Map<String, Object> results = ServiceUtil.returnSuccess(); Map<String, Object> props = buildOrbitalProperties(context, delegator); - + Locale locale = (Locale) context.get("locale"); GenericValue orderPaymentPreference = (GenericValue) context.get("orderPaymentPreference"); GenericValue creditCard = null; try { creditCard = delegator.getRelatedOne("CreditCard",orderPaymentPreference); } catch (GenericEntityException e) { Debug.logError(e, module); - return ServiceUtil.returnError("Unable to obtain cc information from payment preference"); + return ServiceUtil.returnError(UtilProperties.getMessage(resource, + "AccountingPaymentUnableToGetCCInfo", locale)); } GenericValue authTransaction = PaymentGatewayServices.getAuthTransaction(orderPaymentPreference); if (authTransaction == null) { - return ServiceUtil.returnError("No authorization transaction found for the OrderPaymentPreference; cannot Capture"); + return ServiceUtil.returnError(UtilProperties.getMessage(resource, + "AccountingPaymentTransactionAuthorizationNotFoundCannotCapture", locale)); } context.put("creditCard", creditCard); context.put("authTransaction", authTransaction); @@ -161,6 +166,7 @@ public class OrbitalPaymentServices { } public static Map<String, Object> ccRefund(DispatchContext ctx, Map<String, Object> context) { + Locale locale = (Locale) context.get("locale"); Delegator delegator = ctx.getDelegator(); Map<String, Object> results = ServiceUtil.returnSuccess(); Map<String, Object> props = buildOrbitalProperties(context, delegator); @@ -170,11 +176,13 @@ public class OrbitalPaymentServices { creditCard = delegator.getRelatedOne("CreditCard",orderPaymentPreference); } catch (GenericEntityException e) { Debug.logError(e, module); - return ServiceUtil.returnError("Unable to obtain cc information from payment preference"); + return ServiceUtil.returnError(UtilProperties.getMessage(resource, + "AccountingPaymentUnableToGetCCInfo", locale)); } GenericValue 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)); } context.put("creditCard", creditCard); context.put("authTransaction", authTransaction); @@ -203,21 +211,23 @@ public class OrbitalPaymentServices { } public static Map<String, Object> ccRelease(DispatchContext ctx, Map<String, Object> context) { + Locale locale = (Locale) context.get("locale"); Delegator delegator = ctx.getDelegator(); Map<String, Object> results = ServiceUtil.returnSuccess(); Map<String, Object> props = buildOrbitalProperties(context, delegator); GenericValue orderPaymentPreference = (GenericValue) context.get("orderPaymentPreference"); - GenericValue creditCard = null; try { - creditCard = delegator.getRelatedOne("CreditCard",orderPaymentPreference); + delegator.getRelatedOne("CreditCard",orderPaymentPreference); } catch (GenericEntityException e) { Debug.logError(e, module); - return ServiceUtil.returnError("Unable to obtain cc information from payment preference"); + return ServiceUtil.returnError(UtilProperties.getMessage(resource, + "AccountingPaymentUnableToGetCCInfo", locale)); } GenericValue 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)); } context.put("authTransaction", authTransaction); context.put("orderId", orderPaymentPreference.getString("orderId")); |
Free forum by Nabble | Edit this page |