Author: mbrohl
Date: Fri Aug 18 19:28:12 2017 New Revision: 1805460 URL: http://svn.apache.org/viewvc?rev=1805460&view=rev Log: Improved: Fixing defects reported by FindBugs for package org.apache.ofbiz.accounting.thirdparty.gosoftware. (OFBIZ-9486) Thanks Kyra Pritzel-Hentley for reporting and providing the patch. Modified: ofbiz/ofbiz-framework/trunk/applications/accounting/src/main/java/org/apache/ofbiz/accounting/thirdparty/gosoftware/PcChargeApi.java ofbiz/ofbiz-framework/trunk/applications/accounting/src/main/java/org/apache/ofbiz/accounting/thirdparty/gosoftware/PcChargeServices.java ofbiz/ofbiz-framework/trunk/applications/accounting/src/main/java/org/apache/ofbiz/accounting/thirdparty/gosoftware/RitaApi.java ofbiz/ofbiz-framework/trunk/applications/accounting/src/main/java/org/apache/ofbiz/accounting/thirdparty/gosoftware/RitaServices.java Modified: ofbiz/ofbiz-framework/trunk/applications/accounting/src/main/java/org/apache/ofbiz/accounting/thirdparty/gosoftware/PcChargeApi.java URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/accounting/src/main/java/org/apache/ofbiz/accounting/thirdparty/gosoftware/PcChargeApi.java?rev=1805460&r1=1805459&r2=1805460&view=diff ============================================================================== --- ofbiz/ofbiz-framework/trunk/applications/accounting/src/main/java/org/apache/ofbiz/accounting/thirdparty/gosoftware/PcChargeApi.java (original) +++ ofbiz/ofbiz-framework/trunk/applications/accounting/src/main/java/org/apache/ofbiz/accounting/thirdparty/gosoftware/PcChargeApi.java Fri Aug 18 19:28:12 2017 @@ -78,8 +78,8 @@ public class PcChargeApi { public static final String CARD_ID_CODE = "CARD_ID_CODE"; public static final String CVV2_CODE = "CVV2_CODE"; - protected static final String[] validOut = { RESULT, TRANS_DATE, AVS_CODE, CVV2_CODE, CARD_ID_CODE, TICKET }; - protected static final String[] validIn = { PROCESSOR_ID, MERCH_NUM, ACCT_NUM, EXP_DATE, TRANS_AMOUNT, TRACK_DATA, + private static final String[] validOut = { RESULT, TRANS_DATE, AVS_CODE, CVV2_CODE, CARD_ID_CODE, TICKET }; + private static final String[] validIn = { PROCESSOR_ID, MERCH_NUM, ACCT_NUM, EXP_DATE, TRANS_AMOUNT, TRACK_DATA, CUSTOMER_CODE, TAX_AMOUNT, PRINT_RECEIPTS_FLAG, PERIODIC_PAYMENT_FLAG, OFFLINE_FLAG, VOID_FLAG, ZIP_CODE, STREET, TICKET_NUM, CARDHOLDER, TRANS_STORE, TOTAL_AUTH, MULTI_FLAG, PRESENT_FLAG, CVV2 }; @@ -186,7 +186,7 @@ public class PcChargeApi { byte readBuffer[] = new byte[2250]; if (mode == MODE_IN) { try (Socket sock = new Socket(host, port); - PrintStream ps = new PrintStream(sock.getOutputStream()); + PrintStream ps = new PrintStream(sock.getOutputStream(), false, "UTF-8"); DataInputStream dis = new DataInputStream(sock.getInputStream())) { ps.print(this.toString()); @@ -195,7 +195,7 @@ public class PcChargeApi { StringBuilder buf = new StringBuilder(); int size; while ((size = dis.read(readBuffer)) > -1) { - buf.append(new String(readBuffer, 0, size)); + buf.append(new String(readBuffer, 0, size, "UTF-8")); } Document outDoc = null; try { Modified: ofbiz/ofbiz-framework/trunk/applications/accounting/src/main/java/org/apache/ofbiz/accounting/thirdparty/gosoftware/PcChargeServices.java URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/accounting/src/main/java/org/apache/ofbiz/accounting/thirdparty/gosoftware/PcChargeServices.java?rev=1805460&r1=1805459&r2=1805460&view=diff ============================================================================== --- ofbiz/ofbiz-framework/trunk/applications/accounting/src/main/java/org/apache/ofbiz/accounting/thirdparty/gosoftware/PcChargeServices.java (original) +++ ofbiz/ofbiz-framework/trunk/applications/accounting/src/main/java/org/apache/ofbiz/accounting/thirdparty/gosoftware/PcChargeServices.java Fri Aug 18 19:28:12 2017 @@ -91,51 +91,46 @@ public class PcChargeServices { return ServiceUtil.returnError(e.getMessage()); } - if (out != null) { - Map<String, Object> result = ServiceUtil.returnSuccess(); - String resultCode = out.get(PcChargeApi.RESULT); - boolean passed = false; - if ("CAPTURED".equals(resultCode)) { - result.put("authResult", Boolean.TRUE); - result.put("captureResult", Boolean.TRUE); - passed = true; - } else if ("APPROVED".equals(resultCode)) { - result.put("authCode", out.get(PcChargeApi.AUTH_CODE)); - result.put("authResult", Boolean.TRUE); - passed = true; - } else if ("PROCESSED".equals(resultCode)) { - result.put("authResult", Boolean.TRUE); - } else { - result.put("authResult", Boolean.FALSE); - } - - result.put("authRefNum", out.get(PcChargeApi.TROUTD) != null ? out.get(PcChargeApi.TROUTD) : ""); - result.put("processAmount", context.get("processAmount")); + Map<String, Object> result = ServiceUtil.returnSuccess(); + String resultCode = out.get(PcChargeApi.RESULT); + boolean passed = false; + if ("CAPTURED".equals(resultCode)) { + result.put("authResult", Boolean.TRUE); + result.put("captureResult", Boolean.TRUE); + passed = true; + } else if ("APPROVED".equals(resultCode)) { result.put("authCode", out.get(PcChargeApi.AUTH_CODE)); - result.put("authFlag", out.get(PcChargeApi.REFERENCE)); - result.put("authMessage", out.get(PcChargeApi.RESULT)); - result.put("cvCode", out.get(PcChargeApi.CVV2_CODE)); - result.put("avsCode", out.get(PcChargeApi.AVS_CODE)); - - if (!passed) { - String respMsg = out.get(PcChargeApi.RESULT) + " / " + out.get(PcChargeApi.AUTH_CODE); - String refNum = out.get(PcChargeApi.TROUTD); - result.put("customerRespMsgs", UtilMisc.toList(respMsg, refNum)); - } - - if (result.get("captureResult") != null) { - result.put("captureCode", out.get(PcChargeApi.AUTH_CODE)); - result.put("captureFlag", out.get(PcChargeApi.REFERENCE)); - result.put("captureRefNum", out.get(PcChargeApi.TROUTD)); - result.put("captureMessage", out.get(PcChargeApi.RESULT)); - } + result.put("authResult", Boolean.TRUE); + passed = true; + } else if ("PROCESSED".equals(resultCode)) { + result.put("authResult", Boolean.TRUE); + } else { + result.put("authResult", Boolean.FALSE); + } - return result; + result.put("authRefNum", out.get(PcChargeApi.TROUTD) != null ? out.get(PcChargeApi.TROUTD) : ""); + result.put("processAmount", context.get("processAmount")); + result.put("authCode", out.get(PcChargeApi.AUTH_CODE)); + result.put("authFlag", out.get(PcChargeApi.REFERENCE)); + result.put("authMessage", out.get(PcChargeApi.RESULT)); + result.put("cvCode", out.get(PcChargeApi.CVV2_CODE)); + result.put("avsCode", out.get(PcChargeApi.AVS_CODE)); - } else { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, - "AccountingPcChargeResultIsNull", locale)); + if (!passed) { + String respMsg = out.get(PcChargeApi.RESULT) + " / " + out.get(PcChargeApi.AUTH_CODE); + String refNum = out.get(PcChargeApi.TROUTD); + result.put("customerRespMsgs", UtilMisc.toList(respMsg, refNum)); + } + + if (result.get("captureResult") != null) { + result.put("captureCode", out.get(PcChargeApi.AUTH_CODE)); + result.put("captureFlag", out.get(PcChargeApi.REFERENCE)); + result.put("captureRefNum", out.get(PcChargeApi.TROUTD)); + result.put("captureMessage", out.get(PcChargeApi.RESULT)); } + + return result; + } public static Map<String, Object> ccCapture(DispatchContext dctx, Map<String, ? extends Object> context) { @@ -177,25 +172,20 @@ public class PcChargeServices { return ServiceUtil.returnError(e.getMessage()); } - if (out != null) { - Map<String, Object> result = ServiceUtil.returnSuccess(); - String resultCode = out.get(PcChargeApi.RESULT); - if ("CAPTURED".equals(resultCode)) { - result.put("captureResult", Boolean.TRUE); - } else { - result.put("captureResult", Boolean.FALSE); - } - result.put("captureAmount", context.get("captureAmount")); - result.put("captureRefNum", out.get(PcChargeApi.TROUTD) != null ? out.get(PcChargeApi.TROUTD) : ""); - result.put("captureCode", out.get(PcChargeApi.AUTH_CODE)); - result.put("captureFlag", out.get(PcChargeApi.REFERENCE)); - result.put("captureMessage", out.get(PcChargeApi.RESULT)); - - return result; + Map<String, Object> result = ServiceUtil.returnSuccess(); + String resultCode = out.get(PcChargeApi.RESULT); + if ("CAPTURED".equals(resultCode)) { + result.put("captureResult", Boolean.TRUE); } else { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, - "AccountingPcChargeResultIsNull", locale)); + result.put("captureResult", Boolean.FALSE); } + result.put("captureAmount", context.get("captureAmount")); + result.put("captureRefNum", out.get(PcChargeApi.TROUTD) != null ? out.get(PcChargeApi.TROUTD) : ""); + result.put("captureCode", out.get(PcChargeApi.AUTH_CODE)); + result.put("captureFlag", out.get(PcChargeApi.REFERENCE)); + result.put("captureMessage", out.get(PcChargeApi.RESULT)); + + return result; } public static Map<String, Object> ccRelease(DispatchContext dctx, Map<String, ? extends Object> context) { @@ -243,25 +233,20 @@ public class PcChargeServices { return ServiceUtil.returnError(e.getMessage()); } - if (out != null) { - Map<String, Object> result = ServiceUtil.returnSuccess(); - String resultCode = out.get(PcChargeApi.RESULT); - if ("VOIDED".equals(resultCode)) { - result.put("releaseResult", Boolean.TRUE); - } else { - result.put("releaseResult", Boolean.FALSE); - } - result.put("releaseAmount", context.get("releaseAmount")); - result.put("releaseRefNum", out.get(PcChargeApi.TROUTD) != null ? out.get(PcChargeApi.TROUTD) : ""); - result.put("releaseCode", out.get(PcChargeApi.AUTH_CODE)); - result.put("releaseFlag", out.get(PcChargeApi.REFERENCE)); - result.put("releaseMessage", out.get(PcChargeApi.RESULT)); - - return result; + Map<String, Object> result = ServiceUtil.returnSuccess(); + String resultCode = out.get(PcChargeApi.RESULT); + if ("VOIDED".equals(resultCode)) { + result.put("releaseResult", Boolean.TRUE); } else { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, - "AccountingPcChargeResultIsNull", locale)); + result.put("releaseResult", Boolean.FALSE); } + result.put("releaseAmount", context.get("releaseAmount")); + result.put("releaseRefNum", out.get(PcChargeApi.TROUTD) != null ? out.get(PcChargeApi.TROUTD) : ""); + result.put("releaseCode", out.get(PcChargeApi.AUTH_CODE)); + result.put("releaseFlag", out.get(PcChargeApi.REFERENCE)); + result.put("releaseMessage", out.get(PcChargeApi.RESULT)); + + return result; } public static Map<String, Object> ccRefund(DispatchContext dctx, Map<String, ? extends Object> context) { @@ -303,25 +288,20 @@ public class PcChargeServices { return ServiceUtil.returnError(e.getMessage()); } - if (out != null) { - Map<String, Object> result = ServiceUtil.returnSuccess(); - String resultCode = out.get(PcChargeApi.RESULT); - if ("CAPTURED".equals(resultCode)) { - result.put("refundResult", Boolean.TRUE); - } else { - result.put("refundResult", Boolean.FALSE); - } - result.put("refundAmount", context.get("releaseAmount")); - result.put("refundRefNum", out.get(PcChargeApi.TROUTD) != null ? out.get(PcChargeApi.TROUTD) : ""); - result.put("refundCode", out.get(PcChargeApi.AUTH_CODE)); - result.put("refundFlag", out.get(PcChargeApi.REFERENCE)); - result.put("refundMessage", out.get(PcChargeApi.RESULT)); - - return result; + Map<String, Object> result = ServiceUtil.returnSuccess(); + String resultCode = out.get(PcChargeApi.RESULT); + if ("CAPTURED".equals(resultCode)) { + result.put("refundResult", Boolean.TRUE); } else { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, - "AccountingPcChargeResultIsNull", locale)); + result.put("refundResult", Boolean.FALSE); } + result.put("refundAmount", context.get("releaseAmount")); + result.put("refundRefNum", out.get(PcChargeApi.TROUTD) != null ? out.get(PcChargeApi.TROUTD) : ""); + result.put("refundCode", out.get(PcChargeApi.AUTH_CODE)); + result.put("refundFlag", out.get(PcChargeApi.REFERENCE)); + result.put("refundMessage", out.get(PcChargeApi.RESULT)); + + return result; } private static void setCreditCardInfo(PcChargeApi api, Map<String, ? extends Object> context) throws GeneralException { Modified: ofbiz/ofbiz-framework/trunk/applications/accounting/src/main/java/org/apache/ofbiz/accounting/thirdparty/gosoftware/RitaApi.java URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/accounting/src/main/java/org/apache/ofbiz/accounting/thirdparty/gosoftware/RitaApi.java?rev=1805460&r1=1805459&r2=1805460&view=diff ============================================================================== --- ofbiz/ofbiz-framework/trunk/applications/accounting/src/main/java/org/apache/ofbiz/accounting/thirdparty/gosoftware/RitaApi.java (original) +++ ofbiz/ofbiz-framework/trunk/applications/accounting/src/main/java/org/apache/ofbiz/accounting/thirdparty/gosoftware/RitaApi.java Fri Aug 18 19:28:12 2017 @@ -77,11 +77,11 @@ public class RitaApi { public static final String ORIG_TRANS_AMOUNT = "ORIG_TRANS_AMOUNT"; // IN/OUT validation array - protected static final String[] validOut = { TERMINATION_STATUS, INTRN_SEQ_NUM, RESULT, RESULT_CODE, RESPONSE_TEXT, + private static final String[] validOut = { TERMINATION_STATUS, INTRN_SEQ_NUM, RESULT, RESULT_CODE, RESPONSE_TEXT, AUTH_CODE, AVS_CODE, CVV2_CODE, REFERENCE, TRANS_DATE, TRANS_TIME, ORIG_TRANS_AMOUNT }; - protected static final String[] validIn = { FUNCTION_TYPE, PAYMENT_TYPE, USER_ID, USER_PW, COMMAND, CLIENT_ID, + private static final String[] validIn = { FUNCTION_TYPE, PAYMENT_TYPE, USER_ID, USER_PW, COMMAND, CLIENT_ID, ACCT_NUM, EXP_MONTH, EXP_YEAR, TRANS_AMOUNT, CARDHOLDER, TRACK_DATA, INVOICE, PRESENT_FLAG, CUSTOMER_STREET, CUSTOMER_ZIP, CVV2, TAX_AMOUNT, PURCHASE_ID, FORCE_FLAG, ORIG_TRANS_AMOUNT, ORIG_SEQ_NUM }; Modified: ofbiz/ofbiz-framework/trunk/applications/accounting/src/main/java/org/apache/ofbiz/accounting/thirdparty/gosoftware/RitaServices.java URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/accounting/src/main/java/org/apache/ofbiz/accounting/thirdparty/gosoftware/RitaServices.java?rev=1805460&r1=1805459&r2=1805460&view=diff ============================================================================== --- ofbiz/ofbiz-framework/trunk/applications/accounting/src/main/java/org/apache/ofbiz/accounting/thirdparty/gosoftware/RitaServices.java (original) +++ ofbiz/ofbiz-framework/trunk/applications/accounting/src/main/java/org/apache/ofbiz/accounting/thirdparty/gosoftware/RitaServices.java Fri Aug 18 19:28:12 2017 @@ -95,50 +95,44 @@ public class RitaServices { return ServiceUtil.returnError(e.getMessage()); } - if (out != null) { - Map<String, Object> result = ServiceUtil.returnSuccess(); - String resultCode = out.get(RitaApi.RESULT); - boolean passed = false; - if ("CAPTURED".equals(resultCode)) { - result.put("authResult", Boolean.TRUE); - result.put("captureResult", Boolean.TRUE); - passed = true; - } else if ("APPROVED".equals(resultCode)) { - result.put("authCode", out.get(RitaApi.AUTH_CODE)); - result.put("authResult", Boolean.TRUE); - passed = true; - } else if ("PROCESSED".equals(resultCode)) { - result.put("authResult", Boolean.TRUE); - } else { - result.put("authResult", Boolean.FALSE); - } - - result.put("authRefNum", out.get(RitaApi.INTRN_SEQ_NUM) != null ? out.get(RitaApi.INTRN_SEQ_NUM) : ""); - result.put("processAmount", context.get("processAmount")); + Map<String, Object> result = ServiceUtil.returnSuccess(); + String resultCode = out.get(RitaApi.RESULT); + boolean passed = false; + if ("CAPTURED".equals(resultCode)) { + result.put("authResult", Boolean.TRUE); + result.put("captureResult", Boolean.TRUE); + passed = true; + } else if ("APPROVED".equals(resultCode)) { result.put("authCode", out.get(RitaApi.AUTH_CODE)); - result.put("authFlag", out.get(RitaApi.REFERENCE)); - result.put("authMessage", out.get(RitaApi.RESULT)); - result.put("cvCode", out.get(RitaApi.CVV2_CODE)); - result.put("avsCode", out.get(RitaApi.AVS_CODE)); - - if (!passed) { - String respMsg = out.get(RitaApi.RESULT) + " / " + out.get(RitaApi.INTRN_SEQ_NUM); - result.put("customerRespMsgs", UtilMisc.toList(respMsg)); - } - - if (result.get("captureResult") != null) { - result.put("captureCode", out.get(RitaApi.AUTH_CODE)); - result.put("captureFlag", out.get(RitaApi.REFERENCE)); - result.put("captureRefNum", out.get(RitaApi.INTRN_SEQ_NUM)); - result.put("captureMessage", out.get(RitaApi.RESULT)); - } + result.put("authResult", Boolean.TRUE); + passed = true; + } else if ("PROCESSED".equals(resultCode)) { + result.put("authResult", Boolean.TRUE); + } else { + result.put("authResult", Boolean.FALSE); + } - return result; + result.put("authRefNum", out.get(RitaApi.INTRN_SEQ_NUM) != null ? out.get(RitaApi.INTRN_SEQ_NUM) : ""); + result.put("processAmount", context.get("processAmount")); + result.put("authCode", out.get(RitaApi.AUTH_CODE)); + result.put("authFlag", out.get(RitaApi.REFERENCE)); + result.put("authMessage", out.get(RitaApi.RESULT)); + result.put("cvCode", out.get(RitaApi.CVV2_CODE)); + result.put("avsCode", out.get(RitaApi.AVS_CODE)); - } else { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, - "AccountingRitaResultIsNull", locale)); + if (!passed) { + String respMsg = out.get(RitaApi.RESULT) + " / " + out.get(RitaApi.INTRN_SEQ_NUM); + result.put("customerRespMsgs", UtilMisc.toList(respMsg)); + } + + if (result.get("captureResult") != null) { + result.put("captureCode", out.get(RitaApi.AUTH_CODE)); + result.put("captureFlag", out.get(RitaApi.REFERENCE)); + result.put("captureRefNum", out.get(RitaApi.INTRN_SEQ_NUM)); + result.put("captureMessage", out.get(RitaApi.RESULT)); } + + return result; } public static Map<String, Object> ccCapture(DispatchContext dctx, Map<String, ? extends Object> context) { @@ -181,25 +175,20 @@ public class RitaServices { return ServiceUtil.returnError(e.getMessage()); } - if (out != null) { - Map<String, Object> result = ServiceUtil.returnSuccess(); - String resultCode = out.get(RitaApi.RESULT); - if ("CAPTURED".equals(resultCode)) { - result.put("captureResult", Boolean.TRUE); - } else { - result.put("captureResult", Boolean.FALSE); - } - result.put("captureAmount", context.get("captureAmount")); - result.put("captureRefNum", out.get(RitaApi.INTRN_SEQ_NUM) != null ? out.get(RitaApi.INTRN_SEQ_NUM) : ""); - result.put("captureCode", out.get(RitaApi.AUTH_CODE)); - result.put("captureFlag", out.get(RitaApi.REFERENCE)); - result.put("captureMessage", out.get(RitaApi.RESULT)); - - return result; + Map<String, Object> result = ServiceUtil.returnSuccess(); + String resultCode = out.get(RitaApi.RESULT); + if ("CAPTURED".equals(resultCode)) { + result.put("captureResult", Boolean.TRUE); } else { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, - "AccountingRitaResultIsNull", locale)); + result.put("captureResult", Boolean.FALSE); } + result.put("captureAmount", context.get("captureAmount")); + result.put("captureRefNum", out.get(RitaApi.INTRN_SEQ_NUM) != null ? out.get(RitaApi.INTRN_SEQ_NUM) : ""); + result.put("captureCode", out.get(RitaApi.AUTH_CODE)); + result.put("captureFlag", out.get(RitaApi.REFERENCE)); + result.put("captureMessage", out.get(RitaApi.RESULT)); + + return result; } public static Map<String, Object> ccVoidRelease(DispatchContext dctx, Map<String, ? extends Object> context) { @@ -257,25 +246,22 @@ public class RitaServices { return ServiceUtil.returnError(e.getMessage()); } - if (out != null) { - Map<String, Object> result = ServiceUtil.returnSuccess(); - String resultCode = out.get(RitaApi.RESULT); - if ("VOIDED".equals(resultCode)) { - result.put(isRefund ? "refundResult" : "releaseResult", Boolean.TRUE); - } else { - result.put(isRefund ? "refundResult" : "releaseResult", Boolean.FALSE); - } - result.put(isRefund ? "refundAmount" : "releaseAmount", context.get(isRefund ? "refundAmount" : "releaseAmount")); - result.put(isRefund ? "refundRefNum" : "releaseRefNum", out.get(RitaApi.INTRN_SEQ_NUM) != null ? out.get(RitaApi.INTRN_SEQ_NUM) : ""); - result.put(isRefund ? "refundCode" : "releaseCode", out.get(RitaApi.AUTH_CODE)); - result.put(isRefund ? "refundFlag" : "releaseFlag", out.get(RitaApi.REFERENCE)); - result.put(isRefund ? "refundMessage" : "releaseMessage", out.get(RitaApi.RESULT)); - - return result; + Map<String, Object> result = ServiceUtil.returnSuccess(); + String resultCode = out.get(RitaApi.RESULT); + if ("VOIDED".equals(resultCode)) { + result.put(isRefund ? "refundResult" : "releaseResult", Boolean.TRUE); } else { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, - "AccountingRitaResultIsNull", locale)); + result.put(isRefund ? "refundResult" : "releaseResult", Boolean.FALSE); } + result.put(isRefund ? "refundAmount" : "releaseAmount", + context.get(isRefund ? "refundAmount" : "releaseAmount")); + result.put(isRefund ? "refundRefNum" : "releaseRefNum", + out.get(RitaApi.INTRN_SEQ_NUM) != null ? out.get(RitaApi.INTRN_SEQ_NUM) : ""); + result.put(isRefund ? "refundCode" : "releaseCode", out.get(RitaApi.AUTH_CODE)); + result.put(isRefund ? "refundFlag" : "releaseFlag", out.get(RitaApi.REFERENCE)); + result.put(isRefund ? "refundMessage" : "releaseMessage", out.get(RitaApi.RESULT)); + + return result; } public static Map<String, Object> ccCreditRefund(DispatchContext dctx, Map<String, ? extends Object> context) { @@ -326,25 +312,20 @@ public class RitaServices { return ServiceUtil.returnError(e.getMessage()); } - if (out != null) { - Map<String, Object> result = ServiceUtil.returnSuccess(); - String resultCode = out.get(RitaApi.RESULT); - if ("CAPTURED".equals(resultCode)) { - result.put("refundResult", Boolean.TRUE); - } else { - result.put("refundResult", Boolean.FALSE); - } - result.put("refundAmount", context.get("refundAmount")); - result.put("refundRefNum", out.get(RitaApi.INTRN_SEQ_NUM) != null ? out.get(RitaApi.INTRN_SEQ_NUM) : ""); - result.put("refundCode", out.get(RitaApi.AUTH_CODE)); - result.put("refundFlag", out.get(RitaApi.REFERENCE)); - result.put("refundMessage", out.get(RitaApi.RESULT)); - - return result; + Map<String, Object> result = ServiceUtil.returnSuccess(); + String resultCode = out.get(RitaApi.RESULT); + if ("CAPTURED".equals(resultCode)) { + result.put("refundResult", Boolean.TRUE); } else { - return ServiceUtil.returnError(UtilProperties.getMessage(resource, - "AccountingRitaResultIsNull", locale)); + result.put("refundResult", Boolean.FALSE); } + result.put("refundAmount", context.get("refundAmount")); + result.put("refundRefNum", out.get(RitaApi.INTRN_SEQ_NUM) != null ? out.get(RitaApi.INTRN_SEQ_NUM) : ""); + result.put("refundCode", out.get(RitaApi.AUTH_CODE)); + result.put("refundFlag", out.get(RitaApi.REFERENCE)); + result.put("refundMessage", out.get(RitaApi.RESULT)); + + return result; } public static Map<String, Object> ccRefund(DispatchContext dctx, Map<String, ? extends Object> context) { |
Free forum by Nabble | Edit this page |