Author: deepak
Date: Mon Oct 16 06:52:34 2017 New Revision: 1812244 URL: http://svn.apache.org/viewvc?rev=1812244&view=rev Log: Improved: Inconsistent String Comparisons, Applied patch for accounting java files. Thanks Devanshu Vyas for your contribution. (OFBIZ-9254) Modified: ofbiz/ofbiz-framework/trunk/applications/accounting/src/main/java/org/apache/ofbiz/accounting/agreement/AgreementServices.java ofbiz/ofbiz-framework/trunk/applications/accounting/src/main/java/org/apache/ofbiz/accounting/invoice/InvoiceServices.java ofbiz/ofbiz-framework/trunk/applications/accounting/src/main/java/org/apache/ofbiz/accounting/invoice/InvoiceWorker.java ofbiz/ofbiz-framework/trunk/applications/accounting/src/main/java/org/apache/ofbiz/accounting/payment/PaymentGatewayServices.java ofbiz/ofbiz-framework/trunk/applications/accounting/src/main/java/org/apache/ofbiz/accounting/payment/PaymentMethodServices.java ofbiz/ofbiz-framework/trunk/applications/accounting/src/main/java/org/apache/ofbiz/accounting/thirdparty/eway/GatewayResponse.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 ofbiz/ofbiz-framework/trunk/applications/accounting/src/main/java/org/apache/ofbiz/accounting/thirdparty/paypal/PayPalEvents.java ofbiz/ofbiz-framework/trunk/applications/accounting/src/main/java/org/apache/ofbiz/accounting/thirdparty/securepay/SecurePayPaymentServices.java ofbiz/ofbiz-framework/trunk/applications/accounting/src/main/java/org/apache/ofbiz/accounting/thirdparty/valuelink/ValueLinkServices.java ofbiz/ofbiz-framework/trunk/applications/accounting/src/main/java/org/apache/ofbiz/accounting/thirdparty/worldpay/WorldPayEvents.java Modified: ofbiz/ofbiz-framework/trunk/applications/accounting/src/main/java/org/apache/ofbiz/accounting/agreement/AgreementServices.java URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/accounting/src/main/java/org/apache/ofbiz/accounting/agreement/AgreementServices.java?rev=1812244&r1=1812243&r2=1812244&view=diff ============================================================================== --- ofbiz/ofbiz-framework/trunk/applications/accounting/src/main/java/org/apache/ofbiz/accounting/agreement/AgreementServices.java (original) +++ ofbiz/ofbiz-framework/trunk/applications/accounting/src/main/java/org/apache/ofbiz/accounting/agreement/AgreementServices.java Mon Oct 16 06:52:34 2017 @@ -127,14 +127,14 @@ public class AgreementServices { String termTypeId = term.getString("termTypeId"); BigDecimal termValue = term.getBigDecimal("termValue"); if (termValue != null) { - if (termTypeId.equals("FIN_COMM_FIXED")) { + if ("FIN_COMM_FIXED".equals(termTypeId)) { commission = commission.add(termValue); - } else if (termTypeId.equals("FIN_COMM_VARIABLE")) { + } else if ("FIN_COMM_VARIABLE".equals(termTypeId)) { // if variable percentage commission, need to divide by 100, because 5% is stored as termValue of 5.0 commission = commission.add(termValue.multiply(amount).divide(new BigDecimal("100"), 12, rounding)); - } else if (termTypeId.equals("FIN_COMM_MIN")) { + } else if ("FIN_COMM_MIN".equals(termTypeId)) { min = termValue; - } else if (termTypeId.equals("FIN_COMM_MAX")) { + } else if ("FIN_COMM_MAX".equals(termTypeId)) { max = termValue; } // TODO: Add other type of terms and handling here Modified: ofbiz/ofbiz-framework/trunk/applications/accounting/src/main/java/org/apache/ofbiz/accounting/invoice/InvoiceServices.java URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/accounting/src/main/java/org/apache/ofbiz/accounting/invoice/InvoiceServices.java?rev=1812244&r1=1812243&r2=1812244&view=diff ============================================================================== --- ofbiz/ofbiz-framework/trunk/applications/accounting/src/main/java/org/apache/ofbiz/accounting/invoice/InvoiceServices.java (original) +++ ofbiz/ofbiz-framework/trunk/applications/accounting/src/main/java/org/apache/ofbiz/accounting/invoice/InvoiceServices.java Mon Oct 16 06:52:34 2017 @@ -184,9 +184,9 @@ public class InvoiceServices { String invoiceType = null; String orderType = orderHeader.getString("orderTypeId"); - if (orderType.equals("SALES_ORDER")) { + if ("SALES_ORDER".equals(orderType)) { invoiceType = "SALES_INVOICE"; - } else if (orderType.equals("PURCHASE_ORDER")) { + } else if ("PURCHASE_ORDER".equals(orderType)) { invoiceType = "PURCHASE_INVOICE"; } @@ -341,7 +341,7 @@ public class InvoiceServices { // create the bill-from (or pay-to) contact mech as the primary PAYMENT_LOCATION of the party from the store GenericValue payToAddress = null; - if (invoiceType.equals("PURCHASE_INVOICE")) { + if ("PURCHASE_INVOICE".equals(invoiceType)) { // for purchase orders, the pay to address is the BILLING_LOCATION of the vendor GenericValue billFromVendor = orh.getPartyFromRole("BILL_FROM_VENDOR"); if (billFromVendor != null) { @@ -423,7 +423,7 @@ public class InvoiceServices { // check if shipping applies to this item. Shipping is calculated for sales invoices, not purchase invoices. boolean shippingApplies = false; - if ((product != null) && (ProductWorker.shippingApplies(product)) && (invoiceType.equals("SALES_INVOICE"))) { + if ((product != null) && (ProductWorker.shippingApplies(product)) && ("SALES_INVOICE".equals(invoiceType))) { shippingApplies = true; } @@ -458,7 +458,7 @@ public class InvoiceServices { createInvoiceItemContext.put("inventoryItemId", itemIssuance.get("inventoryItemId")); } // similarly, tax only for purchase invoices - if ((product != null) && (invoiceType.equals("SALES_INVOICE"))) { + if ((product != null) && ("SALES_INVOICE".equals(invoiceType))) { createInvoiceItemContext.put("taxableFlag", product.get("taxable")); } @@ -551,7 +551,7 @@ public class InvoiceServices { // continue; // } // Set adjustment amount as amountAlreadyIncluded to continue invoice item creation process - Boolean isTaxIncludedInPrice = adj.getString("orderAdjustmentTypeId").equals("VAT_TAX") && UtilValidate.isNotEmpty(adj.getBigDecimal("amountAlreadyIncluded")) && adj.getBigDecimal("amountAlreadyIncluded").signum() != 0; + Boolean isTaxIncludedInPrice = "VAT_TAX".equals(adj.getString("orderAdjustmentTypeId")) && UtilValidate.isNotEmpty(adj.getBigDecimal("amountAlreadyIncluded")) && adj.getBigDecimal("amountAlreadyIncluded").signum() != 0; if ((adj.getBigDecimal("amount").signum() == 0) && isTaxIncludedInPrice) { adj.set("amount", adj.getBigDecimal("amountAlreadyIncluded")); } @@ -611,7 +611,7 @@ public class InvoiceServices { } } // Tax needs to be rounded differently from other order adjustments - if (adj.getString("orderAdjustmentTypeId").equals("SALES_TAX")) { + if ("SALES_TAX".equals(adj.getString("orderAdjustmentTypeId"))) { amount = amount.setScale(TAX_DECIMALS, TAX_ROUNDING); } else { amount = amount.setScale(invoiceTypeDecimals, ROUNDING); @@ -650,7 +650,7 @@ public class InvoiceServices { // invoice items for sales tax are not taxable themselves // TODO: This is not an ideal solution. Instead, we need to use OrderAdjustment.includeInTax when it is implemented - if (!(adj.getString("orderAdjustmentTypeId").equals("SALES_TAX"))) { + if (!("SALES_TAX".equals(adj.getString("orderAdjustmentTypeId")))) { createInvoiceItemAdjContext.put("taxableFlag", product.get("taxable")); } @@ -1332,9 +1332,9 @@ public class InvoiceServices { for (String tmpShipmentId : shipmentIds) { try { GenericValue shipment = EntityQuery.use(delegator).from("Shipment").where("shipmentId", tmpShipmentId).queryOne(); - if ((shipment.getString("shipmentTypeId") != null) && (shipment.getString("shipmentTypeId").equals("PURCHASE_SHIPMENT"))) { + if ((shipment.getString("shipmentTypeId") != null) && ("PURCHASE_SHIPMENT".equals(shipment.getString("shipmentTypeId")))) { purchaseShipmentFound = true; - } else if ((shipment.getString("shipmentTypeId") != null) && (shipment.getString("shipmentTypeId").equals("DROP_SHIPMENT"))) { + } else if ((shipment.getString("shipmentTypeId") != null) && ("DROP_SHIPMENT".equals(shipment.getString("shipmentTypeId")))) { dropShipmentFound = true; } else { salesShipmentFound = true; @@ -1430,9 +1430,9 @@ public class InvoiceServices { itemsByOrder.add(item); shippedOrderItems.put(orderId, itemsByOrder); continue; - } else if (item.getEntityName().equals("ItemIssuance")) { + } else if ("ItemIssuance".equals(item.getEntityName())) { billFields.add(EntityCondition.makeCondition("itemIssuanceId", item.get("itemIssuanceId"))); - } else if (item.getEntityName().equals("ShipmentReceipt")) { + } else if ("ShipmentReceipt".equals(item.getEntityName())) { billFields.add(EntityCondition.makeCondition("shipmentReceiptId", item.getString("receiptId"))); } List<GenericValue> itemBillings = null; @@ -1470,7 +1470,7 @@ public class InvoiceServices { for (GenericValue issue : billItems) { BigDecimal issueQty = ZERO; - if (issue.getEntityName().equals("ShipmentReceipt")) { + if ("ShipmentReceipt".equals(issue.getEntityName())) { issueQty = issue.getBigDecimal("quantityAccepted"); } else { issueQty = issue.getBigDecimal("quantity"); @@ -1486,7 +1486,7 @@ public class InvoiceServices { List<GenericValue> billed = null; BigDecimal orderedQty = null; try { - orderItem = issue.getEntityName().equals("OrderItem") ? issue : issue.getRelatedOne("OrderItem", false); + orderItem = "OrderItem".equals(issue.getEntityName()) ? issue : issue.getRelatedOne("OrderItem", false); // total ordered orderedQty = orderItem.getBigDecimal("quantity"); @@ -1726,7 +1726,7 @@ public class InvoiceServices { // all at once. BigDecimal totalNewAuthAmount = totalAdditionalShippingCharges.setScale(DECIMALS, ROUNDING); for (GenericValue orderPaymentPreference : orderPaymentPreferences) { - if (! (orderPaymentPreference.getString("statusId").equals("PAYMENT_SETTLED") || orderPaymentPreference.getString("statusId").equals("PAYMENT_CANCELLED"))) { + if (! ("PAYMENT_SETTLED".equals(orderPaymentPreference.getString("statusId")) || "PAYMENT_CANCELLED".equals(orderPaymentPreference.getString("statusId")))) { GenericValue authTransaction = PaymentGatewayServices.getAuthTransaction(orderPaymentPreference); if (authTransaction != null && authTransaction.get("amount") != null) { @@ -1860,7 +1860,7 @@ public class InvoiceServices { return ServiceUtil.returnError(errorMsg + UtilProperties.getMessage(resource, "AccountingShipmentNotFound", locale)); } - if (shipment.getString("shipmentTypeId").equals("SALES_RETURN")) { + if ("SALES_RETURN".equals(shipment.getString("shipmentTypeId"))) { salesReturnFound = true; } else if ("PURCHASE_RETURN".equals(shipment.getString("shipmentTypeId"))) { purchaseReturnFound = true; @@ -1887,9 +1887,9 @@ public class InvoiceServices { for (GenericValue item : shippedItems) { String returnId = null; String returnItemSeqId = null; - if (item.getEntityName().equals("ShipmentReceipt")) { + if ("ShipmentReceipt".equals(item.getEntityName())) { returnId = item.getString("returnId"); - } else if (item.getEntityName().equals("ItemIssuance")) { + } else if ("ItemIssuance".equals(item.getEntityName())) { GenericValue returnItemShipment = EntityQuery.use(delegator).from("ReturnItemShipment") .where("shipmentId", item.get("shipmentId"), "shipmentItemSeqId", item.get("shipmentItemSeqId")) .queryFirst(); @@ -1899,13 +1899,13 @@ public class InvoiceServices { // see if there are ReturnItemBillings for this item Long billingCount = 0L; - if (item.getEntityName().equals("ShipmentReceipt")) { + if ("ShipmentReceipt".equals(item.getEntityName())) { billingCount = EntityQuery.use(delegator).from("ReturnItemBilling") .where("shipmentReceiptId", item.get("receiptId"), "returnId", returnId, "returnItemSeqId", item.get("returnItemSeqId")) .queryCount(); - } else if (item.getEntityName().equals("ItemIssuance")) { + } else if ("ItemIssuance".equals(item.getEntityName())) { billingCount = EntityQuery.use(delegator).from("ReturnItemBilling").where("returnId", returnId, "returnItemSeqId", returnItemSeqId).queryCount(); } // if there are billings, we have already billed the item, so skip it @@ -2170,7 +2170,7 @@ public class InvoiceServices { // only set taxable flag when the adjustment is not a tax // TODO: Note that we use the value of Product.taxable here. This is not an ideal solution. Instead, use returnAdjustment.includeInTax - if (adjustment.get("returnAdjustmentTypeId").equals("RET_SALES_TAX_ADJ")) { + if ("RET_SALES_TAX_ADJ".equals(adjustment.get("returnAdjustmentTypeId"))) { input.put("taxableFlag", "N"); } @@ -2280,7 +2280,7 @@ public class InvoiceServices { } // Ignore invoices that aren't ready yet - if (! invoice.getString("statusId").equals("INVOICE_READY")) { + if (! "INVOICE_READY".equals(invoice.getString("statusId"))) { return ServiceUtil.returnSuccess(); } @@ -2583,13 +2583,13 @@ public class InvoiceServices { } boolean invoiceProcessing = true; - if (defaultInvoiceProcessing.equals("YY")) { + if ("YY".equals(defaultInvoiceProcessing)) { invoiceProcessing = true; - } else if (defaultInvoiceProcessing.equals("NN")) { + } else if ("NN".equals(defaultInvoiceProcessing)) { invoiceProcessing = false; - } else if (defaultInvoiceProcessing.equals("Y")) { + } else if ("Y".equals(defaultInvoiceProcessing)) { invoiceProcessing = !"Y".equals(changeProcessing); - } else if (defaultInvoiceProcessing.equals("N")) { + } else if ("N".equals(defaultInvoiceProcessing)) { invoiceProcessing = "Y".equals(changeProcessing); } @@ -2635,11 +2635,11 @@ public class InvoiceServices { } paymentApplyAvailable = payment.getBigDecimal("amount").subtract(PaymentWorker.getPaymentApplied(payment)).setScale(DECIMALS,ROUNDING); - if (payment.getString("statusId").equals("PMNT_CANCELLED")) { + if ("PMNT_CANCELLED".equals(payment.getString("statusId"))) { errorMessageList.add(UtilProperties.getMessage(resource, "AccountingPaymentCancelled", UtilMisc.toMap("paymentId", paymentId), locale)); } - if (payment.getString("statusId").equals("PMNT_CONFIRMED")) { + if ("PMNT_CONFIRMED".equals(payment.getString("statusId"))) { errorMessageList.add(UtilProperties.getMessage(resource, "AccountingPaymentConfirmed", UtilMisc.toMap("paymentId", paymentId), locale)); } @@ -2664,11 +2664,11 @@ public class InvoiceServices { } toPaymentApplyAvailable = toPayment.getBigDecimal("amount").subtract(PaymentWorker.getPaymentApplied(toPayment)).setScale(DECIMALS,ROUNDING); - if (toPayment.getString("statusId").equals("PMNT_CANCELLED")) { + if ("PMNT_CANCELLED".equals(toPayment.getString("statusId"))) { errorMessageList.add(UtilProperties.getMessage(resource, "AccountingPaymentCancelled", UtilMisc.toMap("paymentId", paymentId), locale)); } - if (toPayment.getString("statusId").equals("PMNT_CONFIRMED")) { + if ("PMNT_CONFIRMED".equals(toPayment.getString("statusId"))) { errorMessageList.add(UtilProperties.getMessage(resource, "AccountingPaymentConfirmed", UtilMisc.toMap("paymentId", paymentId), locale)); } @@ -2764,7 +2764,7 @@ public class InvoiceServices { "AccountingInvoiceNotFound", UtilMisc.toMap("invoiceId", invoiceId), locale)); } else { // check the invoice and when supplied the invoice item... - if (invoice.getString("statusId").equals("INVOICE_CANCELLED")) { + if ("INVOICE_CANCELLED".equals(invoice.getString("statusId"))) { errorMessageList.add(UtilProperties.getMessage(resource, "AccountingInvoiceCancelledCannotApplyTo", UtilMisc.toMap("invoiceId", invoiceId), locale)); } @@ -3088,7 +3088,7 @@ public class InvoiceServices { } } // if the amount to apply was not provided or was zero fill it with the maximum possible and provide information to the user - if (amountApplied.signum() == 0 && useHighestAmount.equals("Y")) { + if (amountApplied.signum() == 0 && "Y".equals(useHighestAmount)) { amountApplied = newPaymentApplyAvailable; if (invoiceId != null && newInvoiceApplyAvailable.compareTo(amountApplied) < 0) { amountApplied = newInvoiceApplyAvailable; Modified: ofbiz/ofbiz-framework/trunk/applications/accounting/src/main/java/org/apache/ofbiz/accounting/invoice/InvoiceWorker.java URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/accounting/src/main/java/org/apache/ofbiz/accounting/invoice/InvoiceWorker.java?rev=1812244&r1=1812243&r2=1812244&view=diff ============================================================================== --- ofbiz/ofbiz-framework/trunk/applications/accounting/src/main/java/org/apache/ofbiz/accounting/invoice/InvoiceWorker.java (original) +++ ofbiz/ofbiz-framework/trunk/applications/accounting/src/main/java/org/apache/ofbiz/accounting/invoice/InvoiceWorker.java Mon Oct 16 06:52:34 2017 @@ -301,9 +301,9 @@ public final class InvoiceWorker { // if no locations found get it from the PartyAndContactMech using the from and to party on the invoice String destinationPartyId = null; Timestamp now = UtilDateTime.nowTimestamp(); - if (invoice.getString("invoiceTypeId").equals("SALES_INVOICE")) + if ("SALES_INVOICE".equals(invoice.getString("invoiceTypeId"))) destinationPartyId = invoice.getString("partyId"); - if (invoice.getString("invoiceTypeId").equals("PURCHASE_INVOICE")) + if ("PURCHASE_INVOICE".equals(invoice.getString("invoiceTypeId"))) destinationPartyId = invoice.getString("partyId"); try { locations = EntityQuery.use(delegator).from("PartyContactWithPurpose") @@ -336,7 +336,7 @@ public final class InvoiceWorker { Debug.logError(e, "Trouble getting Contact for contactMechId: " + locations.get(0).getString("contactMechId"), module); } - if (contactMech != null && contactMech.getString("contactMechTypeId").equals("POSTAL_ADDRESS")) { + if (contactMech != null && "POSTAL_ADDRESS".equals(contactMech.getString("contactMechTypeId"))) { try { postalAddress = contactMech.getRelatedOne("PostalAddress", false); return postalAddress; Modified: ofbiz/ofbiz-framework/trunk/applications/accounting/src/main/java/org/apache/ofbiz/accounting/payment/PaymentGatewayServices.java URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/accounting/src/main/java/org/apache/ofbiz/accounting/payment/PaymentGatewayServices.java?rev=1812244&r1=1812243&r2=1812244&view=diff ============================================================================== --- ofbiz/ofbiz-framework/trunk/applications/accounting/src/main/java/org/apache/ofbiz/accounting/payment/PaymentGatewayServices.java (original) +++ ofbiz/ofbiz-framework/trunk/applications/accounting/src/main/java/org/apache/ofbiz/accounting/payment/PaymentGatewayServices.java Mon Oct 16 06:52:34 2017 @@ -1542,7 +1542,7 @@ public class PaymentGatewayServices { // Check the productStore setting to see if we need to do this explicitly GenericValue productStore = order.getRelatedOne("ProductStore", false); - if (productStore.getString("manualAuthIsCapture") == null || (! productStore.getString("manualAuthIsCapture").equalsIgnoreCase("Y"))) { + if (productStore.getString("manualAuthIsCapture") == null || (! "Y".equalsIgnoreCase(productStore.getString("manualAuthIsCapture")))) { String responseId = delegator.getNextSeqId("PaymentGatewayResponse"); GenericValue pgResponse = delegator.makeValue("PaymentGatewayResponse"); pgResponse.set("paymentGatewayResponseId", responseId); @@ -2838,7 +2838,7 @@ public class PaymentGatewayServices { Debug.logError(e, module); } - if (paymentMethod != null && paymentMethod.getString("paymentMethodTypeId").equals("CREDIT_CARD")) { + if (paymentMethod != null && "CREDIT_CARD".equals(paymentMethod.getString("paymentMethodTypeId"))) { GenericValue creditCard = null; try { creditCard = paymentMethod.getRelatedOne("CreditCard", false); @@ -3199,7 +3199,7 @@ public class PaymentGatewayServices { "AccountingPaymentSettingNotValid", locale)); } - if (paymentMethodTypeId.equals("CREDIT_CARD")) { + if ("CREDIT_CARD".equals(paymentMethodTypeId)) { GenericValue creditCard = delegator.makeValue("CreditCard"); creditCard.setAllFields(context, true, null, null); if (creditCard.get("firstNameOnCard") == null || creditCard.get("lastNameOnCard") == null || creditCard.get("cardType") == null || creditCard.get("cardNumber") == null) { @@ -3303,9 +3303,9 @@ public class PaymentGatewayServices { } String amount = null; - if (mode.equalsIgnoreCase("CREATE")) { + if ("CREATE".equalsIgnoreCase(mode)) { amount = EntityUtilProperties.getPropertyValue(productStorePaymentProperties, "payment.general.cc_create.auth", delegator); - } else if (mode.equalsIgnoreCase("UPDATE")) { + } else if ("UPDATE".equalsIgnoreCase(mode)) { amount = EntityUtilProperties.getPropertyValue(productStorePaymentProperties, "payment.general.cc_update.auth", delegator); } if (Debug.infoOn()) Debug.logInfo("Running credit card verification [" + paymentMethodId + "] (" + amount + ") : " + productStorePaymentProperties + " : " + mode, module); Modified: ofbiz/ofbiz-framework/trunk/applications/accounting/src/main/java/org/apache/ofbiz/accounting/payment/PaymentMethodServices.java URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/accounting/src/main/java/org/apache/ofbiz/accounting/payment/PaymentMethodServices.java?rev=1812244&r1=1812243&r2=1812244&view=diff ============================================================================== --- ofbiz/ofbiz-framework/trunk/applications/accounting/src/main/java/org/apache/ofbiz/accounting/payment/PaymentMethodServices.java (original) +++ ofbiz/ofbiz-framework/trunk/applications/accounting/src/main/java/org/apache/ofbiz/accounting/payment/PaymentMethodServices.java Mon Oct 16 06:52:34 2017 @@ -204,7 +204,7 @@ public class PaymentMethodServices { GenericValue newPartyContactMechPurpose = null; String contactMechId = (String) context.get("contactMechId"); - if (UtilValidate.isNotEmpty(contactMechId) && !contactMechId.equals("_NEW_")) { + if (UtilValidate.isNotEmpty(contactMechId) && !"_NEW_".equals(contactMechId)) { // set the contactMechId on the credit card newCc.set("contactMechId", context.get("contactMechId")); // add a PartyContactMechPurpose of BILLING_LOCATION if necessary @@ -369,7 +369,7 @@ public class PaymentMethodServices { GenericValue newPartyContactMechPurpose = null; String contactMechId = (String) context.get("contactMechId"); - if (UtilValidate.isNotEmpty(contactMechId) && !contactMechId.equals("_NEW_")) { + if (UtilValidate.isNotEmpty(contactMechId) && !"_NEW_".equals(contactMechId)) { // set the contactMechId on the credit card newCc.set("contactMechId", contactMechId); } @@ -382,7 +382,7 @@ public class PaymentMethodServices { isModified = true; } - if (UtilValidate.isNotEmpty(contactMechId) && !contactMechId.equals("_NEW_")) { + if (UtilValidate.isNotEmpty(contactMechId) && !"_NEW_".equals(contactMechId)) { // add a PartyContactMechPurpose of BILLING_LOCATION if necessary String contactMechPurposeTypeId = "BILLING_LOCATION"; @@ -426,7 +426,7 @@ public class PaymentMethodServices { result.put("paymentMethodId", paymentMethodId); result.put("oldPaymentMethodId", paymentMethodId); result.put(ModelService.RESPONSE_MESSAGE, ModelService.RESPOND_SUCCESS); - if (contactMechId == null || !contactMechId.equals("_NEW_")) { + if (contactMechId == null || !"_NEW_".equals(contactMechId)) { result.put(ModelService.SUCCESS_MESSAGE, UtilProperties.getMessage(resource, "AccountingNoChangesMadeNotUpdatingCreditCard", locale)); } Modified: ofbiz/ofbiz-framework/trunk/applications/accounting/src/main/java/org/apache/ofbiz/accounting/thirdparty/eway/GatewayResponse.java URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/accounting/src/main/java/org/apache/ofbiz/accounting/thirdparty/eway/GatewayResponse.java?rev=1812244&r1=1812243&r2=1812244&view=diff ============================================================================== --- ofbiz/ofbiz-framework/trunk/applications/accounting/src/main/java/org/apache/ofbiz/accounting/thirdparty/eway/GatewayResponse.java (original) +++ ofbiz/ofbiz-framework/trunk/applications/accounting/src/main/java/org/apache/ofbiz/accounting/thirdparty/eway/GatewayResponse.java Mon Oct 16 06:52:34 2017 @@ -153,7 +153,7 @@ public class GatewayResponse { if (name == "ewayTrxnError") txTrxnError = value; else if (name == "ewayTrxnStatus") { - if (value.toLowerCase().trim().equals("true")) { + if ("true".equals(value.toLowerCase().trim())) { txTrxnStatus = true; } } 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=1812244&r1=1812243&r2=1812244&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 Mon Oct 16 06:52:34 2017 @@ -191,7 +191,7 @@ public class RitaApi { String[] lines = resp.split("\n"); for (int i = 0; i < lines.length; i++) { Debug.logInfo(lines[i], module); - if (!lines[i].trim().equals(".")) { + if (!".".equals(lines[i].trim())) { String[] lineSplit = lines[i].trim().split(" ", 2); if (lineSplit != null && lineSplit.length == 2) { docMap.put(lineSplit[0], lineSplit[1]); 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=1812244&r1=1812243&r2=1812244&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 Mon Oct 16 06:52:34 2017 @@ -447,7 +447,7 @@ public class RitaServices { if (presentFlag == null) { presentFlag = "N"; } - api.set(RitaApi.PRESENT_FLAG, presentFlag.equals("Y") ? "3" : "1"); // 1, no present, 2 present, 3 swiped + api.set(RitaApi.PRESENT_FLAG, "Y".equals(presentFlag) ? "3" : "1"); // 1, no present, 2 present, 3 swiped } else { throw new GeneralException("No CreditCard object found"); } @@ -465,7 +465,7 @@ public class RitaServices { } catch (Exception e) { Debug.logError(e, module); } - boolean ssl = props.getProperty("ssl", "N").equals("Y") ? true : false; + boolean ssl = "Y".equals(props.getProperty("ssl", "N")) ? true : false; RitaApi api = null; if (port > 0 && host != null) { Modified: ofbiz/ofbiz-framework/trunk/applications/accounting/src/main/java/org/apache/ofbiz/accounting/thirdparty/paypal/PayPalEvents.java URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/accounting/src/main/java/org/apache/ofbiz/accounting/thirdparty/paypal/PayPalEvents.java?rev=1812244&r1=1812243&r2=1812244&view=diff ============================================================================== --- ofbiz/ofbiz-framework/trunk/applications/accounting/src/main/java/org/apache/ofbiz/accounting/thirdparty/paypal/PayPalEvents.java (original) +++ ofbiz/ofbiz-framework/trunk/applications/accounting/src/main/java/org/apache/ofbiz/accounting/thirdparty/paypal/PayPalEvents.java Mon Oct 16 06:52:34 2017 @@ -303,9 +303,9 @@ public class PayPalEvents { try { beganTransaction = TransactionUtil.begin(); - if (paymentStatus.equals("Completed")) { + if ("Completed".equals(paymentStatus)) { okay = OrderChangeHelper.approveOrder(dispatcher, userLogin, orderId); - } else if (paymentStatus.equals("Failed") || paymentStatus.equals("Denied")) { + } else if ("Failed".equals(paymentStatus) || "Denied".equals(paymentStatus)) { okay = OrderChangeHelper.cancelOrder(dispatcher, userLogin, orderId); } @@ -433,9 +433,9 @@ public class PayPalEvents { } paymentPreference.set("maxAmount", new BigDecimal(paymentAmount)); - if (paymentStatus.equals("Completed")) { + if ("Completed".equals(paymentStatus)) { paymentPreference.set("statusId", "PAYMENT_RECEIVED"); - } else if (paymentStatus.equals("Pending")) { + } else if ("Pending".equals(paymentStatus)) { paymentPreference.set("statusId", "PAYMENT_NOT_RECEIVED"); } else { paymentPreference.set("statusId", "PAYMENT_CANCELLED"); Modified: ofbiz/ofbiz-framework/trunk/applications/accounting/src/main/java/org/apache/ofbiz/accounting/thirdparty/securepay/SecurePayPaymentServices.java URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/accounting/src/main/java/org/apache/ofbiz/accounting/thirdparty/securepay/SecurePayPaymentServices.java?rev=1812244&r1=1812243&r2=1812244&view=diff ============================================================================== --- ofbiz/ofbiz-framework/trunk/applications/accounting/src/main/java/org/apache/ofbiz/accounting/thirdparty/securepay/SecurePayPaymentServices.java (original) +++ ofbiz/ofbiz-framework/trunk/applications/accounting/src/main/java/org/apache/ofbiz/accounting/thirdparty/securepay/SecurePayPaymentServices.java Mon Oct 16 06:52:34 2017 @@ -67,13 +67,13 @@ public class SecurePayPaymentServices { BigDecimal newAmount = null; int amont; - if (enableamountround.equals("Y")) { + if ("Y".equals(enableamountround)) { newAmount = new BigDecimal(processAmount.setScale(0, RoundingMode.HALF_UP)+".00"); } else { newAmount = processAmount; } - if (currency.equals("JPY")) { + if ("JPY".equals(currency)) { amont = newAmount.intValue(); } else { amont = newAmount.multiply(multiplyAmount).intValue(); @@ -162,13 +162,13 @@ public class SecurePayPaymentServices { BigDecimal newAmount = null; int amont; - if (enableamountround.equals("Y")) { + if ("Y".equals(enableamountround)) { newAmount = new BigDecimal(captureAmount.setScale(0, RoundingMode.HALF_UP)+".00"); } else { newAmount = captureAmount; } - if (currency.equals("JPY")) { + if ("JPY".equals(currency)) { amont = newAmount.intValue(); } else { amont = newAmount.multiply(multiplyAmount).intValue(); @@ -241,13 +241,13 @@ public class SecurePayPaymentServices { BigDecimal newAmount = null; int amont; - if (enableamountround.equals("Y")) { + if ("Y".equals(enableamountround)) { newAmount = new BigDecimal(releaseAmount.setScale(0, RoundingMode.HALF_UP)+".00"); } else { newAmount = releaseAmount; } - if (currency.equals("JPY")) { + if ("JPY".equals(currency)) { amont = newAmount.intValue(); } else { amont = newAmount.multiply(multiplyAmount).intValue(); @@ -327,14 +327,14 @@ public class SecurePayPaymentServices { BigDecimal multiplyAmount = new BigDecimal(100); BigDecimal newAmount = null; - if (enableamountround.equals("Y")) { + if ("Y".equals(enableamountround)) { newAmount = new BigDecimal(refundAmount.setScale(0, RoundingMode.HALF_UP)+".00"); } else { newAmount = refundAmount; } int amont; - if (currency.equals("JPY")) { + if ("JPY".equals(currency)) { amont = newAmount.intValue(); } else { amont = newAmount.multiply(multiplyAmount).intValue(); @@ -400,13 +400,13 @@ public class SecurePayPaymentServices { BigDecimal newAmount = null; int amont; - if (enableamountround.equals("Y")) { + if ("Y".equals(enableamountround)) { newAmount = new BigDecimal(creditAmount.setScale(0, RoundingMode.HALF_UP)+".00"); } else { newAmount = creditAmount; } - if (currency.equals("JPY")) { + if ("JPY".equals(currency)) { amont = newAmount.intValue(); } else { amont = newAmount.multiply(multiplyAmount).intValue(); Modified: ofbiz/ofbiz-framework/trunk/applications/accounting/src/main/java/org/apache/ofbiz/accounting/thirdparty/valuelink/ValueLinkServices.java URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/accounting/src/main/java/org/apache/ofbiz/accounting/thirdparty/valuelink/ValueLinkServices.java?rev=1812244&r1=1812243&r2=1812244&view=diff ============================================================================== --- ofbiz/ofbiz-framework/trunk/applications/accounting/src/main/java/org/apache/ofbiz/accounting/thirdparty/valuelink/ValueLinkServices.java (original) +++ ofbiz/ofbiz-framework/trunk/applications/accounting/src/main/java/org/apache/ofbiz/accounting/thirdparty/valuelink/ValueLinkServices.java Mon Oct 16 06:52:34 2017 @@ -170,7 +170,7 @@ public class ValueLinkServices { // on success update the database / reload the cached api if (response != null) { String responseCode = (String) response.get("responsecode"); - if (responseCode.equals("00")) { + if ("00".equals(responseCode)) { GenericValue vlKeys = GenericValue.create(vl.getGenericValue()); vlKeys.set("lastWorkingKey", vlKeys.get("workingKey")); vlKeys.set("workingKey", StringUtil.toHexString(mwk)); @@ -255,7 +255,7 @@ public class ValueLinkServices { if (response != null) { String responseCode = (String) response.get("responsecode"); Map<String, Object> result = ServiceUtil.returnSuccess(); - if (responseCode.equals("00")) { + if ("00".equals(responseCode)) { result.put("processResult", Boolean.TRUE); result.put("pin", vl.decryptPin((String) response.get("pin"))); } else { @@ -316,7 +316,7 @@ public class ValueLinkServices { Map<String, Object> result = ServiceUtil.returnSuccess(UtilProperties.getMessage(resource, "AccountingValueLinkGiftCardActivated", locale)); - if (responseCode.equals("00")) { + if ("00".equals(responseCode)) { result.put("processResult", Boolean.TRUE); } else { @@ -378,7 +378,7 @@ public class ValueLinkServices { String responseCode = (String) response.get("responsecode"); Map<String, Object> result = ServiceUtil.returnSuccess(UtilProperties.getMessage(resource, "AccountingValueLinkPinDisabled", locale)); - if (responseCode.equals("00")) { + if ("00".equals(responseCode)) { result.put("processResult", Boolean.TRUE); } else { result.put("processResult", Boolean.FALSE); @@ -445,7 +445,7 @@ public class ValueLinkServices { if (response != null) { String responseCode = (String) response.get("responsecode"); Map<String, Object> result = ServiceUtil.returnSuccess(); - if (responseCode.equals("00")) { + if ("00".equals(responseCode)) { result.put("processResult", Boolean.TRUE); } else { result.put("processResult", Boolean.FALSE); @@ -515,7 +515,7 @@ public class ValueLinkServices { if (response != null) { String responseCode = (String) response.get("responsecode"); Map<String, Object> result = ServiceUtil.returnSuccess(); - if (responseCode.equals("00")) { + if ("00".equals(responseCode)) { result.put("processResult", Boolean.TRUE); } else { result.put("processResult", Boolean.FALSE); @@ -576,7 +576,7 @@ public class ValueLinkServices { if (response != null) { String responseCode = (String) response.get("responsecode"); Map<String, Object> result = ServiceUtil.returnSuccess(); - if (responseCode.equals("00")) { + if ("00".equals(responseCode)) { result.put("processResult", Boolean.TRUE); } else { result.put("processResult", Boolean.FALSE); @@ -633,7 +633,7 @@ public class ValueLinkServices { if (response != null) { String responseCode = (String) response.get("responsecode"); Map<String, Object> result = ServiceUtil.returnSuccess(); - if (responseCode.equals("00")) { + if ("00".equals(responseCode)) { result.put("processResult", Boolean.TRUE); } else { result.put("processResult", Boolean.FALSE); @@ -701,7 +701,7 @@ public class ValueLinkServices { if (response != null) { String responseCode = (String) response.get("responsecode"); Map<String, Object> result = ServiceUtil.returnSuccess(); - if (responseCode.equals("00")) { + if ("00".equals(responseCode)) { result.put("processResult", Boolean.TRUE); } else { result.put("processResult", Boolean.FALSE); @@ -747,7 +747,7 @@ public class ValueLinkServices { Debug.logInfo("704 Interface : " + vlInterface, module); if (vlInterface != null) { if (vlInterface.startsWith("Activate")) { - if (vlInterface.equals("Activate/Rollback")) { + if ("Activate/Rollback".equals(vlInterface)) { return ServiceUtil.returnError(UtilProperties.getMessage(resource, "AccountingValueLinkThisTransactionIsNotSupported", locale)); } @@ -785,7 +785,7 @@ public class ValueLinkServices { context.put("TermTxnNo", request.get("TermTxnNo")); // Activate/Rollback is not supported by valuelink - if (!vlInterface.equals("Activate")) { + if (!"Activate".equals(vlInterface)) { // create the listener Debug.logInfo("Set 704 context : " + context, module); try { Modified: ofbiz/ofbiz-framework/trunk/applications/accounting/src/main/java/org/apache/ofbiz/accounting/thirdparty/worldpay/WorldPayEvents.java URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/accounting/src/main/java/org/apache/ofbiz/accounting/thirdparty/worldpay/WorldPayEvents.java?rev=1812244&r1=1812243&r2=1812244&view=diff ============================================================================== --- ofbiz/ofbiz-framework/trunk/applications/accounting/src/main/java/org/apache/ofbiz/accounting/thirdparty/worldpay/WorldPayEvents.java (original) +++ ofbiz/ofbiz-framework/trunk/applications/accounting/src/main/java/org/apache/ofbiz/accounting/thirdparty/worldpay/WorldPayEvents.java Mon Oct 16 06:52:34 2017 @@ -228,7 +228,7 @@ public class WorldPayEvents { String description = UtilProperties.getMessage(resource, "AccountingOrderNr", locale) + orderId + " " + (company != null ? UtilProperties.getMessage(commonResource, "CommonFrom", locale) + " "+ company : ""); // check the instId - very important - if (instId == null || instId.equals("NONE")) { + if (instId == null || "NONE".equals(instId)) { Debug.logError("Worldpay InstId not found, cannot continue", module); request.setAttribute("_ERROR_MESSAGE_", UtilProperties.getMessage(resourceErr, "worldPayEvents.problemsGettingInstId", locale)); return "error"; |
Free forum by Nabble | Edit this page |