Modified: ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/payment/PaymentWorker.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/payment/PaymentWorker.java?rev=757093&r1=757092&r2=757093&view=diff ============================================================================== --- ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/payment/PaymentWorker.java (original) +++ ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/payment/PaymentWorker.java Sat Mar 21 23:44:59 2009 @@ -6,9 +6,9 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY @@ -48,11 +48,11 @@ * Worker methods for Payments */ public class PaymentWorker { - + public static final String module = PaymentWorker.class.getName(); private static int decimals = UtilNumber.getBigDecimalScale("invoice.decimals"); private static int rounding = UtilNumber.getBigDecimalRoundingMode("invoice.rounding"); - + /** @deprecated */ public static void getPartyPaymentMethodValueMaps(PageContext pageContext, String partyId, Boolean showOld, String paymentMethodValueMapsAttr) { GenericDelegator delegator = (GenericDelegator) pageContext.getRequest().getAttribute("delegator"); @@ -62,9 +62,9 @@ // to be able to use in minilanguage where Boolean cannot be used public static List getPartyPaymentMethodValueMaps(GenericDelegator delegator, String partyId) { - return(getPartyPaymentMethodValueMaps(delegator, partyId, false)); + return(getPartyPaymentMethodValueMaps(delegator, partyId, false)); } - + public static List getPartyPaymentMethodValueMaps(GenericDelegator delegator, String partyId, Boolean showOld) { List paymentMethodValueMaps = new LinkedList(); try { @@ -104,7 +104,7 @@ ServletRequest request = pageContext.getRequest(); Map results = getPaymentMethodAndRelated(request, partyId); - + if (results.get("paymentMethod") != null) pageContext.setAttribute(paymentMethodAttr, results.get("paymentMethod")); if (results.get("creditCard") != null) pageContext.setAttribute(creditCardAttr, results.get("creditCard")); if (results.get("eftAccount") != null) pageContext.setAttribute(eftAccountAttr, results.get("eftAccount")); @@ -113,11 +113,11 @@ if (results.get("donePage") != null) pageContext.setAttribute(donePageAttr, results.get("donePage")); if (results.get("tryEntity") != null) pageContext.setAttribute(tryEntityAttr, results.get("tryEntity")); } - + public static Map getPaymentMethodAndRelated(ServletRequest request, String partyId) { GenericDelegator delegator = (GenericDelegator) request.getAttribute("delegator"); Map results = new HashMap(); - + Boolean tryEntity = Boolean.TRUE; if (request.getAttribute("_ERROR_MESSAGE_") != null) tryEntity = false; @@ -180,21 +180,21 @@ } results.put("tryEntity", new Boolean(tryEntity)); - + return results; } - - public static GenericValue getPaymentAddress(GenericDelegator delegator, String partyId) { - List paymentAddresses = null; + + public static GenericValue getPaymentAddress(GenericDelegator delegator, String partyId) { + List paymentAddresses = null; try { - paymentAddresses = delegator.findByAnd("PartyContactMechPurpose", - UtilMisc.toMap("partyId", partyId, "contactMechPurposeTypeId", "PAYMENT_LOCATION"), + paymentAddresses = delegator.findByAnd("PartyContactMechPurpose", + UtilMisc.toMap("partyId", partyId, "contactMechPurposeTypeId", "PAYMENT_LOCATION"), UtilMisc.toList("-fromDate")); - paymentAddresses = EntityUtil.filterByDate(paymentAddresses); + paymentAddresses = EntityUtil.filterByDate(paymentAddresses); } catch (GenericEntityException e) { - Debug.logError(e, "Trouble getting PartyContactMechPurpose entity list", module); + Debug.logError(e, "Trouble getting PartyContactMechPurpose entity list", module); } - + // get the address for the primary contact mech GenericValue purpose = EntityUtil.getFirst(paymentAddresses); GenericValue postalAddress = null; @@ -205,20 +205,20 @@ Debug.logError(e, "Trouble getting PostalAddress record for contactMechId: " + purpose.getString("contactMechId"), module); } } - - return postalAddress; - } - + + return postalAddress; + } + /** * Returns the total from a list of Payment entities - * + * * @param payments List of Payment GenericValue items * @return total payments as BigDecimal */ public static BigDecimal getPaymentsTotal(List payments) { if (payments == null) { - throw new IllegalArgumentException("Payment list cannot be null"); + throw new IllegalArgumentException("Payment list cannot be null"); } BigDecimal paymentsTotal = BigDecimal.ZERO; @@ -236,25 +236,25 @@ * @return the applied total as BigDecimal */ public static BigDecimal getPaymentApplied(GenericDelegator delegator, String paymentId) { - return getPaymentApplied(delegator, paymentId, false); + return getPaymentApplied(delegator, paymentId, false); } - + public static BigDecimal getPaymentApplied(GenericDelegator delegator, String paymentId, Boolean actual) { if (delegator == null) { throw new IllegalArgumentException("Null delegator is not allowed in this method"); } - + GenericValue payment = null; try { - payment = delegator.findByPrimaryKey("Payment", UtilMisc.toMap("paymentId", paymentId)); + payment = delegator.findByPrimaryKey("Payment", UtilMisc.toMap("paymentId", paymentId)); } catch (GenericEntityException e) { Debug.logError(e, "Problem getting Payment", module); } - + if (payment == null) { throw new IllegalArgumentException("The paymentId passed does not match an existing payment"); } - + return getPaymentApplied(payment, actual); } /** @@ -291,7 +291,7 @@ public static BigDecimal getPaymentApplied(GenericValue payment) { return getPaymentApplied(payment, false); } - + /** * Method to return the total amount of an payment which is applied to a payment * @param payment GenericValue object of the Payment @@ -324,9 +324,9 @@ } } } catch (GenericEntityException e) { - Debug.logError(e, "Trouble getting entities", module); + Debug.logError(e, "Trouble getting entities", module); } - return paymentApplied; + return paymentApplied; } public static BigDecimal getPaymentNotApplied(GenericValue payment) { return payment.getBigDecimal("amount").subtract(getPaymentApplied(payment)).setScale(decimals,rounding); @@ -345,14 +345,14 @@ if (delegator == null) { throw new IllegalArgumentException("Null delegator is not allowed in this method"); } - + GenericValue payment = null; try { - payment = delegator.findByPrimaryKey("Payment", UtilMisc.toMap("paymentId", paymentId)); + payment = delegator.findByPrimaryKey("Payment", UtilMisc.toMap("paymentId", paymentId)); } catch (GenericEntityException e) { Debug.logError(e, "Problem getting Payment", module); } - + if (payment == null) { throw new IllegalArgumentException("The paymentId passed does not match an existing payment"); } Modified: ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/tax/TaxAuthorityServices.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/tax/TaxAuthorityServices.java?rev=757093&r1=757092&r2=757093&view=diff ============================================================================== --- ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/tax/TaxAuthorityServices.java (original) +++ ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/tax/TaxAuthorityServices.java Sat Mar 21 23:44:59 2009 @@ -6,9 +6,9 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY @@ -54,9 +54,9 @@ public class TaxAuthorityServices { public static final String module = TaxAuthorityServices.class.getName(); - public static final BigDecimal ZERO_BASE = BigDecimal.ZERO; - public static final BigDecimal ONE_BASE = BigDecimal.ONE; - public static final BigDecimal PERCENT_SCALE = new BigDecimal("100.000"); + public static final BigDecimal ZERO_BASE = BigDecimal.ZERO; + public static final BigDecimal ONE_BASE = BigDecimal.ONE; + public static final BigDecimal PERCENT_SCALE = new BigDecimal("100.000"); public static int salestaxFinalDecimals = UtilNumber.getBigDecimalScale("salestax.final.decimals"); public static int salestaxCalcDecimals = UtilNumber.getBigDecimalScale("salestax.calc.decimals"); public static int salestaxRounding = UtilNumber.getBigDecimalRoundingMode("salestax.rounding"); @@ -72,11 +72,11 @@ if (quantity == null) quantity = ONE_BASE; BigDecimal amount = basePrice.multiply(quantity); - + BigDecimal taxTotal = ZERO_BASE; BigDecimal taxPercentage = ZERO_BASE; BigDecimal priceWithTax = basePrice; - if (shippingPrice != null) priceWithTax = priceWithTax.add(shippingPrice); + if (shippingPrice != null) priceWithTax = priceWithTax.add(shippingPrice); try { GenericValue product = delegator.findByPrimaryKeyCache("Product", UtilMisc.toMap("productId", productId)); @@ -84,7 +84,7 @@ if (productStore == null) { throw new IllegalArgumentException("Could not find ProductStore with ID [" + productStoreId + "] for tax calculation"); } - + if ("Y".equals(productStore.getString("showPricesWithVatTax"))) { Set taxAuthoritySet = FastSet.newInstance(); if (productStore.get("vatTaxAuthPartyId") == null) { @@ -94,11 +94,11 @@ GenericValue taxAuthority = delegator.findByPrimaryKeyCache("TaxAuthority", UtilMisc.toMap("taxAuthGeoId", productStore.get("vatTaxAuthGeoId"), "taxAuthPartyId", productStore.get("vatTaxAuthPartyId"))); taxAuthoritySet.add(taxAuthority); } - + if (taxAuthoritySet.size() == 0) { throw new IllegalArgumentException("Could not find any Tax Authories for store with ID [" + productStoreId + "] for tax calculation; the store settings may need to be corrected."); } - + List taxAdustmentList = getTaxAdjustments(delegator, product, productStore, null, billToPartyId, taxAuthoritySet, basePrice, amount, shippingPrice, ZERO_BASE); if (taxAdustmentList.size() == 0) { // this is something that happens every so often for different products and such, so don't blow up on it... @@ -121,11 +121,11 @@ Debug.logError(e, errMsg, module); return ServiceUtil.returnError(errMsg); } - + // round to 2 decimal places for display/etc taxTotal = taxTotal.setScale(salestaxFinalDecimals, salestaxRounding); priceWithTax = priceWithTax.setScale(salestaxFinalDecimals, salestaxRounding); - + Map result = ServiceUtil.returnSuccess(); result.put("taxTotal", taxTotal); result.put("taxPercentage", taxPercentage); @@ -162,11 +162,11 @@ Debug.logError(e, errMsg, module); return ServiceUtil.returnError(errMsg); } - + if (productStore == null && payToPartyId == null) { throw new IllegalArgumentException("Could not find payToPartyId [" + payToPartyId + "] or ProductStore [" + productStoreId + "] for tax calculation"); } - + // Setup the return lists. List orderAdjustments = FastList.newInstance(); List itemAdjustments = FastList.newInstance(); @@ -219,7 +219,7 @@ } else { Debug.logWarning("shippingAddress was null, adding nothing to taxAuthoritySet", module); } - + //Debug.logInfo("Tax calc geoIdSet before expand:" + geoIdSet + "; this is for shippingAddress=" + shippingAddress, module); // get the most granular, or all available, geoIds and then find parents by GeoAssoc with geoAssocTypeId="REGIONS" and geoIdTo=<granular geoId> and find the GeoAssoc.geoId geoIdSet = GeoWorker.expandGeoRegionDeep(geoIdSet, delegator); @@ -255,16 +255,16 @@ List taxAuthCondOrList = FastList.newInstance(); // start with the _NA_ TaxAuthority... taxAuthCondOrList.add(EntityCondition.makeCondition( - EntityCondition.makeCondition("taxAuthPartyId", EntityOperator.EQUALS, "_NA_"), - EntityOperator.AND, + EntityCondition.makeCondition("taxAuthPartyId", EntityOperator.EQUALS, "_NA_"), + EntityOperator.AND, EntityCondition.makeCondition("taxAuthGeoId", EntityOperator.EQUALS, "_NA_"))); - + Iterator taxAuthorityIter = taxAuthoritySet.iterator(); while (taxAuthorityIter.hasNext()) { GenericValue taxAuthority = (GenericValue) taxAuthorityIter.next(); EntityCondition taxAuthCond = EntityCondition.makeCondition( - EntityCondition.makeCondition("taxAuthPartyId", EntityOperator.EQUALS, taxAuthority.getString("taxAuthPartyId")), - EntityOperator.AND, + EntityCondition.makeCondition("taxAuthPartyId", EntityOperator.EQUALS, taxAuthority.getString("taxAuthPartyId")), + EntityOperator.AND, EntityCondition.makeCondition("taxAuthGeoId", EntityOperator.EQUALS, taxAuthority.getString("taxAuthGeoId"))); taxAuthCondOrList.add(taxAuthCond); } @@ -283,7 +283,7 @@ GenericValue pcm = (GenericValue) pcmIter.next(); productCategoryIdSet.add(pcm.get("productCategoryId")); } - + if (productCategoryIdSet.size() == 0) { productCategoryCond = EntityCondition.makeCondition("productCategoryId", EntityOperator.EQUALS, null); } else { @@ -331,7 +331,7 @@ if (orderPromotionsAmount != null && taxAuthorityRateProduct != null && (taxAuthorityRateProduct.get("taxPromotions") == null || (taxAuthorityRateProduct.get("taxPromotions") != null && taxAuthorityRateProduct.getBoolean("taxPromotions").booleanValue()))) { taxable = taxable.add(orderPromotionsAmount); } - + if (taxable.compareTo(BigDecimal.ZERO) == 0) { // this should make it less confusing if the taxable flag on the product is not Y/true, and there is no shipping and such continue; @@ -391,7 +391,7 @@ return adjustments; } - + private static void handlePartyTaxExempt(GenericValue adjValue, Set billToPartyIdSet, String taxAuthGeoId, String taxAuthPartyId, BigDecimal taxAmount, Timestamp nowTimestamp, GenericDelegator delegator) throws GenericEntityException { Debug.logInfo("Checking for tax exemption : " + taxAuthGeoId + " / " + taxAuthPartyId, module); List ptiConditionList = UtilMisc.toList( 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=757093&r1=757092&r2=757093&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 Sat Mar 21 23:44:59 2009 @@ -60,7 +60,7 @@ ctx.put("finAccountTypeId", "BANK_ACCOUNT"); ctx.put("userLogin", userLogin); Map resp = dispatcher.runSync("createFinAccount", ctx); - assertEquals("Service result success", ModelService.RESPOND_SUCCESS, resp.get(ModelService.RESPONSE_MESSAGE)); + assertEquals("Service result success", ModelService.RESPOND_SUCCESS, resp.get(ModelService.RESPONSE_MESSAGE)); } public void testDeposit() throws Exception { Modified: ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/thirdparty/authorizedotnet/AIMPaymentServices.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/thirdparty/authorizedotnet/AIMPaymentServices.java?rev=757093&r1=757092&r2=757093&view=diff ============================================================================== --- ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/thirdparty/authorizedotnet/AIMPaymentServices.java (original) +++ ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/thirdparty/authorizedotnet/AIMPaymentServices.java Sat Mar 21 23:44:59 2009 @@ -6,9 +6,9 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY @@ -119,7 +119,7 @@ buildEmailSettings(context,props,request); request.put("x_Invoice_Num","Order " + orderPaymentPreference.getString("orderId")); // PRIOR_AUTH_CAPTURE is the right one to use, since we already have an authorization from the authTransaction. - // CAPTURE_ONLY is a "force" transaction to be used if there is no prior authorization + // CAPTURE_ONLY is a "force" transaction to be used if there is no prior authorization props.put("transType","PRIOR_AUTH_CAPTURE"); //props.put("transType","CAPTURE_ONLY"); props.put("cardtype", (String)creditCard.get("cardType")); @@ -137,15 +137,15 @@ processCaptureTransResult(reply,results); // if there is no captureRefNum, then the capture failed if (results.get("captureRefNum") == null) { - return ServiceUtil.returnError((String) results.get("captureMessage")); - } + return ServiceUtil.returnError((String) results.get("captureMessage")); + } return results; } public static Map ccRefund(DispatchContext ctx, Map context) { GenericDelegator delegator = ctx.getDelegator(); GenericValue orderPaymentPreference = (GenericValue) context.get("orderPaymentPreference"); - + GenericValue creditCard = null; try { creditCard = delegator.getRelatedOne("CreditCard",orderPaymentPreference); @@ -153,12 +153,12 @@ Debug.logError(e, module); return ServiceUtil.returnError("Unable to obtain cc information from payment preference"); } - + GenericValue authTransaction = PaymentGatewayServices.getAuthTransaction(orderPaymentPreference); if (authTransaction == null) { return ServiceUtil.returnError("No authorization transaction found for the OrderPaymentPreference; cannot Refund"); } - + context.put("creditCard",creditCard); context.put("authTransaction",authTransaction); Map results = ServiceUtil.returnSuccess(); @@ -224,7 +224,7 @@ if (ServiceUtil.isError(reply)) { return reply; } - + results = ServiceUtil.returnSuccess(); results.putAll( processRefundTransResult(reply) ); return results; @@ -375,7 +375,7 @@ } private static String getVersion() { - return (String)AIMProperties.get("ver"); + return (String)AIMProperties.get("ver"); } private static Properties buildAIMProperties(Map context) { @@ -444,8 +444,8 @@ AIMProperties = props; } - if (isTestMode()) { - Debug.logInfo("Created Authorize.Net properties file: " + props.toString(),module); + if (isTestMode()) { + Debug.logInfo("Created Authorize.Net properties file: " + props.toString(),module); } return props; @@ -508,11 +508,11 @@ AIMRequest.put("x_Country",UtilFormatOut.checkNull(ba.getString("countryGeoId"))); } return; - + } catch (GenericEntityException ex) { Debug.logError("Cannot build customer information for " + params + " due to error: " + ex.getMessage(), module); return; - } + } } private static void buildEmailSettings(Map params, Properties props, Map AIMRequest) { Modified: ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/thirdparty/authorizedotnet/AuthorizeResponse.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/thirdparty/authorizedotnet/AuthorizeResponse.java?rev=757093&r1=757092&r2=757093&view=diff ============================================================================== --- ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/thirdparty/authorizedotnet/AuthorizeResponse.java (original) +++ ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/thirdparty/authorizedotnet/AuthorizeResponse.java Sat Mar 21 23:44:59 2009 @@ -6,9 +6,9 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY Modified: ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/thirdparty/clearcommerce/CCPaymentServices.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/thirdparty/clearcommerce/CCPaymentServices.java?rev=757093&r1=757092&r2=757093&view=diff ============================================================================== --- ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/thirdparty/clearcommerce/CCPaymentServices.java (original) +++ ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/thirdparty/clearcommerce/CCPaymentServices.java Sat Mar 21 23:44:59 2009 @@ -6,9 +6,9 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY @@ -263,22 +263,22 @@ return processReAuthResponse(reauthResponseDoc); } - + public static Map ccReport(DispatchContext dctx, Map context) { - + // configuration file String paymentConfig = (String) context.get("paymentConfig"); if (UtilValidate.isEmpty(paymentConfig)) { paymentConfig = "payment.properties"; } - + // orderId String orderId = (String) context.get("orderId"); if (UtilValidate.isEmpty(orderId)) { return ServiceUtil.returnError("orderId is required......"); } - - + + // EngineDocList Document requestDocument = UtilXml.makeEmptyXmlDocument("EngineDocList"); Element engineDocListElement = requestDocument.getDocumentElement(); @@ -299,7 +299,7 @@ } else UtilXml.addChildElementValue(engineDocElement, "GroupId", orderId, requestDocument); - + // EngineDocList.EngineDoc.User Element userElement = UtilXml.addChildElement(engineDocElement, "User", requestDocument); @@ -329,7 +329,7 @@ // EngineDocList.EngineDoc.ReportDoc.ReportActionList Element actionList = UtilXml.addChildElement(comp, "ReportActionList",requestDocument); Element action = UtilXml.addChildElement(actionList, "ReportAction",requestDocument); - UtilXml.addChildElementValue(action,"ReportName","CCE_OrderDetail",requestDocument); + UtilXml.addChildElementValue(action,"ReportName","CCE_OrderDetail",requestDocument); Element start = UtilXml.addChildElementValue(action,"Start","1",requestDocument); start.setAttribute("DataType", "S32"); Element count = UtilXml.addChildElementValue(action,"Count","10",requestDocument); @@ -343,7 +343,7 @@ clientId.setAttribute("DataType", "S32"); } UtilXml.addChildElementValue(value,"OrderId", orderId, requestDocument); - + Debug.set(Debug.VERBOSE, true); Document reportResponseDoc = null; try { @@ -352,9 +352,9 @@ return ServiceUtil.returnError(cce.getMessage()); } Debug.set(Debug.VERBOSE, true); - + Map result = ServiceUtil.returnSuccess(); - + return result; } @@ -707,7 +707,7 @@ Element total = UtilXml.addChildElementValue(pbOrderElement, "TotalNumberPayments", (String) pbOrder.get("TotalNumberPayments"), requestDocument); total.setAttribute("DataType", "S32"); } - + return requestDocument; } 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=757093&r1=757092&r2=757093&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 Sat Mar 21 23:44:59 2009 @@ -6,9 +6,9 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY @@ -50,7 +50,7 @@ public GenericDelegator delegator = null; public static final String DISPATCHER_NAME = "test-dispatcher"; public LocalDispatcher dispatcher = null; - + // test data protected GenericValue emailAddr = null; protected String orderId = null; @@ -60,7 +60,7 @@ protected Map pbOrder = null; protected BigDecimal creditAmount = null; protected String configFile = null; - + public CCServicesTest(String name) { super(name); } @@ -93,11 +93,11 @@ "stateProvinceGeoId", "NLD", "postalCode","12345")); pbOrder = UtilMisc.toMap( - "OrderFrequencyCycle", "M", - "OrderFrequencyInterval", "3", + "OrderFrequencyCycle", "M", + "OrderFrequencyInterval", "3", "TotalNumberPayments", "4"); } - + protected void tearDown() throws Exception { dispatcher.deregister(); } @@ -117,24 +117,24 @@ "orderId", orderId ); serviceInput.put("processAmount", new BigDecimal("200.00")); - + // run the service (make sure in payment Map result = dispatcher.runSync("clearCommerceCCAuth",serviceInput); - + // verify the results String responseMessage = (String) result.get(ModelService.RESPONSE_MESSAGE); Debug.logInfo("[testCCAuth] responseMessage: " + responseMessage, module); TestCase.assertEquals("Service result is success", ModelService.RESPOND_SUCCESS, responseMessage); - + if (((Boolean) result.get("authResult")).equals(new Boolean(false))) { // returnCode ok? - Debug.logInfo("[testAuth] Error Messages from ClearCommerce: " + result.get("internalRespMsgs"), module); + Debug.logInfo("[testAuth] Error Messages from ClearCommerce: " + result.get("internalRespMsgs"), module); TestCase.fail("Returned messages:" + result.get("internalRespMsgs")); } } catch (GenericServiceException ex) { TestCase.fail(ex.getMessage()); } - + } /* * Check the credit action: to deduct a certain amount of a credit card. @@ -152,20 +152,20 @@ ); // run the service Map result = dispatcher.runSync("clearCommerceCCCredit",serviceMap); - + // verify the results String responseMessage = (String) result.get(ModelService.RESPONSE_MESSAGE); Debug.logInfo("[testCCCredit] responseMessage: " + responseMessage, module); TestCase.assertEquals("Service result is success", ModelService.RESPOND_SUCCESS, responseMessage); - + if (((Boolean) result.get("creditResult")).equals(new Boolean(false))) { // returnCode ok? - Debug.logInfo("[testCCCredit] Error Messages from ClearCommerce: " + result.get("internalRespMsgs"), module); + Debug.logInfo("[testCCCredit] Error Messages from ClearCommerce: " + result.get("internalRespMsgs"), module); TestCase.fail("Returned messages:" + result.get("internalRespMsgs")); - } + } } catch (GenericServiceException ex) { TestCase.fail(ex.getMessage()); } - + } /* * Test Purchase subscription @@ -173,45 +173,45 @@ public void testPurchaseSubscription() throws Exception { Debug.logInfo("=====[testPurchaseSubscription] starting....", module); try { - + Map serviceMap = UtilMisc.toMap( "paymentConfig", configFile, "orderId", orderId, "creditAmount", creditAmount, "billToEmail", emailAddr, "creditCard", creditCard, - "pbOrder", pbOrder // if supplied, the crediting is for a subscription and credit by period is managed by ClearCommerce + "pbOrder", pbOrder // if supplied, the crediting is for a subscription and credit by period is managed by ClearCommerce ); serviceMap.put("creditAmount", new BigDecimal("200.00")); // run the service Map result = dispatcher.runSync("clearCommerceCCCredit",serviceMap); - + // verify the results - String responseMessage = (String) result.get(ModelService.RESPONSE_MESSAGE); - Debug.logInfo("[testPurchaseDescription] responseMessage: " + responseMessage, module); + String responseMessage = (String) result.get(ModelService.RESPONSE_MESSAGE); + Debug.logInfo("[testPurchaseDescription] responseMessage: " + responseMessage, module); TestCase.assertEquals("Service result is success", ModelService.RESPOND_SUCCESS, responseMessage); // service completed ok? if (((Boolean) result.get("creditResult")).equals(new Boolean(false))) { // returnCode ok? - Debug.logInfo("[testPurchaseSubscription] Error Messages from ClearCommerce: " + result.get("internalRespMsgs"), module); + Debug.logInfo("[testPurchaseSubscription] Error Messages from ClearCommerce: " + result.get("internalRespMsgs"), module); TestCase.fail("Returned messages:" + result.get("internalRespMsgs")); } } catch (GenericServiceException ex) { TestCase.fail(ex.getMessage()); } } - + /* * Test Free subscription */ public void testFreeSubscription() throws Exception { - + // not communicate with CC. } /* * Test cancel subscription */ public void testCancelSubscription() throws Exception { - /* from the API doc: + /* from the API doc: After the Engine receives and processes an internally-managed periodic billing order, the order cannot be modified. An order can only be cancelled. If, for example, the credit card associated with a recurring order expires and a payment is rejected, the order must be @@ -219,7 +219,7 @@ --> Orders are cancelled by using the Store Administrator Tool. So cannot by program. - */ + */ } /* * Test Query subscription transaction status @@ -227,21 +227,21 @@ public void testCCReport() throws Exception{ Debug.logInfo("=====[testReport] starting....", module); try { - + Map serviceMap = UtilMisc.toMap( "orderId", "4488668f-2db0-3002-002b-0003ba1d84d5", "paymentConfig", configFile ); - + // run the service Map result = dispatcher.runSync("clearCommerceCCReport",serviceMap); - + // verify the results - String responseMessage = (String) result.get(ModelService.RESPONSE_MESSAGE); - Debug.logInfo("[testPurchaseDescription] responseMessage: " + responseMessage, module); + String responseMessage = (String) result.get(ModelService.RESPONSE_MESSAGE); + Debug.logInfo("[testPurchaseDescription] responseMessage: " + responseMessage, module); TestCase.assertEquals("Reporting service", ModelService.RESPOND_SUCCESS, responseMessage); // service completed ok? if (((Boolean) result.get("creditResult")).equals(new Boolean(false))) { // returnCode ok? - Debug.logInfo("[testReport] Error Messages from ClearCommerce: " + result.get("internalRespMsgs"), module); + Debug.logInfo("[testReport] Error Messages from ClearCommerce: " + result.get("internalRespMsgs"), module); TestCase.fail("Returned messages:" + result.get("internalRespMsgs")); } } catch (GenericServiceException ex) { Modified: ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/thirdparty/cybersource/IcsPaymentServices.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/thirdparty/cybersource/IcsPaymentServices.java?rev=757093&r1=757092&r2=757093&view=diff ============================================================================== --- ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/thirdparty/cybersource/IcsPaymentServices.java (original) +++ ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/thirdparty/cybersource/IcsPaymentServices.java Sat Mar 21 23:44:59 2009 @@ -6,9 +6,9 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY Modified: ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/thirdparty/gosoftware/PcChargeApi.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/thirdparty/gosoftware/PcChargeApi.java?rev=757093&r1=757092&r2=757093&view=diff ============================================================================== --- ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/thirdparty/gosoftware/PcChargeApi.java (original) +++ ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/thirdparty/gosoftware/PcChargeApi.java Sat Mar 21 23:44:59 2009 @@ -6,9 +6,9 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 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=757093&r1=757092&r2=757093&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 Sat Mar 21 23:44:59 2009 @@ -6,9 +6,9 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 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=757093&r1=757092&r2=757093&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 Sat Mar 21 23:44:59 2009 @@ -6,9 +6,9 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY @@ -226,7 +226,7 @@ br.close(); */ - LinkedHashMap docMap = new LinkedHashMap(); + 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=757093&r1=757092&r2=757093&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 Sat Mar 21 23:44:59 2009 @@ -6,9 +6,9 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY @@ -117,7 +117,7 @@ result.put("avsCode", out.get(RitaApi.AVS_CODE)); if (!passed) { - String respMsg = out.get(RitaApi.RESULT) + " / " + out.get(RitaApi.INTRN_SEQ_NUM); + String respMsg = out.get(RitaApi.RESULT) + " / " + out.get(RitaApi.INTRN_SEQ_NUM); result.put("customerRespMsgs", UtilMisc.toList(respMsg)); } Modified: ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/thirdparty/paypal/PayPalEvents.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/thirdparty/paypal/PayPalEvents.java?rev=757093&r1=757092&r2=757093&view=diff ============================================================================== --- ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/thirdparty/paypal/PayPalEvents.java (original) +++ ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/thirdparty/paypal/PayPalEvents.java Sat Mar 21 23:44:59 2009 @@ -6,9 +6,9 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY @@ -57,21 +57,21 @@ public class PayPalEvents { - + public static final String resource = "AccountingUiLabels"; public static final String resourceErr = "AccountingErrorUiLabels"; public static final String commonResource = "CommonUiLabels"; public static final String module = PayPalEvents.class.getName(); - + /** Initiate PayPal Request */ public static String callPayPal(HttpServletRequest request, HttpServletResponse response) { Locale locale = UtilHttp.getLocale(request); GenericDelegator delegator = (GenericDelegator) request.getAttribute("delegator"); - GenericValue userLogin = (GenericValue) request.getSession().getAttribute("userLogin"); - + GenericValue userLogin = (GenericValue) request.getSession().getAttribute("userLogin"); + // get the orderId String orderId = (String) request.getAttribute("orderId"); - + // get the order header GenericValue orderHeader = null; try { @@ -81,10 +81,10 @@ request.setAttribute("_ERROR_MESSAGE_", UtilProperties.getMessage(resourceErr, "payPalEvents.problemsGettingOrderHeader", locale)); return "error"; } - + // get the order total String orderTotal = orderHeader.getBigDecimal("grandTotal").toPlainString(); - + // get the product store GenericValue productStore = ProductStoreWorker.getProductStore(request); @@ -93,55 +93,55 @@ request.setAttribute("_ERROR_MESSAGE_", UtilProperties.getMessage(resourceErr, "payPalEvents.problemsGettingMerchantConfiguration", locale)); return "error"; } - - // get the payment properties file + + // get the payment properties file GenericValue paymentConfig = ProductStoreWorker.getProductStorePaymentSetting(delegator, productStore.getString("productStoreId"), "EXT_PAYPAL", null, true); String configString = null; if (paymentConfig != null) { - configString = paymentConfig.getString("paymentPropertiesPath"); + configString = paymentConfig.getString("paymentPropertiesPath"); } - + if (configString == null) { configString = "payment.properties"; } - + // get the company name String company = UtilFormatOut.checkEmpty(productStore.getString("companyName"), ""); - + // create the item name String itemName = UtilProperties.getMessage(resource, "AccountingOrderNr", locale) + orderId + " " + (company != null ? UtilProperties.getMessage(commonResource, "CommonFrom", locale) + " "+ company : ""); String itemNumber = "0"; - + // get the redirect url String redirectUrl = UtilProperties.getPropertyValue(configString, "payment.paypal.redirect"); - + // get the notify url String notifyUrl = UtilProperties.getPropertyValue(configString, "payment.paypal.notify"); - + // get the return urls String returnUrl = UtilProperties.getPropertyValue(configString, "payment.paypal.return"); - + // get the cancel return urls String cancelReturnUrl = UtilProperties.getPropertyValue(configString, "payment.paypal.cancelReturn"); - + // get the image url - String imageUrl = UtilProperties.getPropertyValue(configString, "payment.paypal.image"); - + String imageUrl = UtilProperties.getPropertyValue(configString, "payment.paypal.image"); + // get the paypal account String payPalAccount = UtilProperties.getPropertyValue(configString, "payment.paypal.business"); - - if (UtilValidate.isEmpty(redirectUrl) - || UtilValidate.isEmpty(notifyUrl) - || UtilValidate.isEmpty(returnUrl) - || UtilValidate.isEmpty(cancelReturnUrl) + + if (UtilValidate.isEmpty(redirectUrl) + || UtilValidate.isEmpty(notifyUrl) + || UtilValidate.isEmpty(returnUrl) + || UtilValidate.isEmpty(cancelReturnUrl) || UtilValidate.isEmpty(imageUrl) || UtilValidate.isEmpty(payPalAccount) ) { Debug.logError("Payment properties is not configured properly, some notify URL from PayPal is not correctly defined!", module); request.setAttribute("_ERROR_MESSAGE_", UtilProperties.getMessage(resourceErr, "payPalEvents.problemsGettingMerchantConfiguration", locale)); return "error"; } - + // create the redirect string Map <String, Object> parameters = new LinkedHashMap <String, Object>(); parameters.put("cmd", "_xclick"); @@ -150,20 +150,20 @@ parameters.put("item_number", itemNumber); parameters.put("invoice", orderId); parameters.put("custom", userLogin.getString("userLoginId")); - parameters.put("amount", orderTotal); + parameters.put("amount", orderTotal); parameters.put("return", returnUrl); parameters.put("cancel_return", cancelReturnUrl); parameters.put("notify_url", notifyUrl); parameters.put("image_url", imageUrl); parameters.put("no_note", "1"); // no notes allowed in paypal (not passed back) parameters.put("no_shipping", "1"); // no shipping address required (local shipping used) - + String encodedParameters = UtilHttp.urlEncodeArgs(parameters, false); - String redirectString = redirectUrl + "?" + encodedParameters; - + String redirectString = redirectUrl + "?" + encodedParameters; + // set the order in the session for cancelled orders - request.getSession().setAttribute("PAYPAL_ORDER", orderId); - + request.getSession().setAttribute("PAYPAL_ORDER", orderId); + // redirect to paypal try { response.sendRedirect(redirectString); @@ -172,16 +172,16 @@ request.setAttribute("_ERROR_MESSAGE_", UtilProperties.getMessage(resourceErr, "payPalEvents.problemsConnectingWithPayPal", locale)); return "error"; } - - return "success"; + + return "success"; } - + /** PayPal Call-Back Event */ public static String payPalIPN(HttpServletRequest request, HttpServletResponse response) { Locale locale = UtilHttp.getLocale(request); GenericDelegator delegator = (GenericDelegator) request.getAttribute("delegator"); - LocalDispatcher dispatcher = (LocalDispatcher) request.getAttribute("dispatcher"); - + LocalDispatcher dispatcher = (LocalDispatcher) request.getAttribute("dispatcher"); + // get the product store GenericValue productStore = ProductStoreWorker.getProductStore(request); if (productStore == null) { @@ -189,10 +189,10 @@ request.setAttribute("_ERROR_MESSAGE_", UtilProperties.getMessage(resourceErr, "payPalEvents.problemsGettingMerchantConfiguration", locale)); return "error"; } - + // get the payment properties file GenericValue paymentConfig = ProductStoreWorker.getProductStorePaymentSetting(delegator, productStore.getString("productStoreId"), "EXT_PAYPAL", null, true); - + String configString = null; if (paymentConfig != null) { configString = paymentConfig.getString("paymentPropertiesPath"); @@ -201,24 +201,24 @@ if (configString == null) { configString = "payment.properties"; } - + // get the confirm URL String confirmUrl = UtilProperties.getPropertyValue(configString, "payment.paypal.confirm"); - + // get the redirect URL String redirectUrl = UtilProperties.getPropertyValue(configString, "payment.paypal.redirect"); - + if (confirmUrl == null || redirectUrl == null) { Debug.logError("Payment properties is not configured properly, no confirm URL defined!", module); request.setAttribute("_ERROR_MESSAGE_", UtilProperties.getMessage(resourceErr, "payPalEvents.problemsGettingMerchantConfiguration", locale)); return "error"; } - + // first verify this is valid from PayPal Map <String, Object> parametersMap = UtilHttp.getParameterMap(request); - parametersMap.put("cmd", "_notify-validate"); - - // send off the confirm request + parametersMap.put("cmd", "_notify-validate"); + + // send off the confirm request String confirmResp = null; try { @@ -252,7 +252,7 @@ Debug.logError("### Param: " + name + " => " + value, module); } } - + // get the user GenericValue userLogin = null; String userLoginId = request.getParameter("custom"); @@ -265,7 +265,7 @@ request.setAttribute("_ERROR_MESSAGE_", UtilProperties.getMessage(resourceErr, "payPalEvents.problemsGettingAuthenticationUser", locale)); return "error"; } - + // get the orderId String orderId = request.getParameter("invoice"); @@ -357,28 +357,28 @@ return "success"; } - + /** Event called when customer cancels a paypal order */ public static String cancelPayPalOrder(HttpServletRequest request, HttpServletResponse response) { Locale locale = UtilHttp.getLocale(request); LocalDispatcher dispatcher = (LocalDispatcher) request.getAttribute("dispatcher"); - GenericValue userLogin = (GenericValue) request.getSession().getAttribute("userLogin"); - + GenericValue userLogin = (GenericValue) request.getSession().getAttribute("userLogin"); + // get the stored order id from the session String orderId = (String) request.getSession().getAttribute("PAYPAL_ORDER"); - + // attempt to start a transaction boolean beganTransaction = false; try { beganTransaction = TransactionUtil.begin(); } catch (GenericTransactionException gte) { Debug.logError(gte, "Unable to begin transaction", module); - } - + } + // cancel the order boolean okay = OrderChangeHelper.cancelOrder(dispatcher, userLogin, orderId); - - if (okay) { + + if (okay) { try { TransactionUtil.commit(beganTransaction); } catch (GenericTransactionException gte) { @@ -390,16 +390,16 @@ } catch (GenericTransactionException gte) { Debug.logError(gte, "Unable to rollback transaction", module); } - } - + } + // attempt to release the offline hold on the order (workflow) - if (okay) - OrderChangeHelper.releaseInitialOrderHold(dispatcher, orderId); - + if (okay) + OrderChangeHelper.releaseInitialOrderHold(dispatcher, orderId); + request.setAttribute("_EVENT_MESSAGE_", UtilProperties.getMessage(resourceErr, "payPalEvents.previousPayPalOrderHasBeenCancelled", locale)); - return "success"; - } - + return "success"; + } + private static boolean setPaymentPreferences(GenericDelegator delegator, LocalDispatcher dispatcher, GenericValue userLogin, String orderId, HttpServletRequest request) { Debug.logVerbose("Setting payment prefrences..", module); List <GenericValue> paymentPrefs = null; @@ -420,14 +420,14 @@ } } return true; - } - + } + private static boolean setPaymentPreference(LocalDispatcher dispatcher, GenericValue userLogin, GenericValue paymentPreference, HttpServletRequest request) { Locale locale = UtilHttp.getLocale(request); - String paymentDate = request.getParameter("payment_date"); - String paymentType = request.getParameter("payment_type"); - String paymentAmount = request.getParameter("mc_gross"); - String paymentStatus = request.getParameter("payment_status"); + String paymentDate = request.getParameter("payment_date"); + String paymentType = request.getParameter("payment_type"); + String paymentAmount = request.getParameter("mc_gross"); + String paymentStatus = request.getParameter("payment_status"); String transactionId = request.getParameter("txn_id"); List <GenericValue> toStore = new LinkedList <GenericValue> (); @@ -436,7 +436,7 @@ // Parse this into a valid Timestamp Object SimpleDateFormat sdf = new SimpleDateFormat("hh:mm:ss MMM d, yyyy z"); java.sql.Timestamp authDate = null; - try { + try { authDate = new java.sql.Timestamp(sdf.parse(paymentDate).getTime()); } catch (ParseException e) { Debug.logError(e, "Cannot parse date string: " + paymentDate, module); @@ -482,13 +482,13 @@ } catch (GenericEntityException e) { Debug.logError(e, "Cannot set payment preference/payment info", module); return false; - } - + } + // create a payment record too Map <String, Object> results = null; try { String comment = UtilProperties.getMessage(resource, "AccountingPaymentReceiveViaPayPal", locale); - results = dispatcher.runSync("createPaymentFromPreference", UtilMisc.toMap("userLogin", userLogin, + results = dispatcher.runSync("createPaymentFromPreference", UtilMisc.toMap("userLogin", userLogin, "orderPaymentPreferenceId", paymentPreference.get("orderPaymentPreferenceId"), "comments", comment)); } catch (GenericServiceException e) { Debug.logError(e, "Failed to execute service createPaymentFromPreference", module); @@ -497,11 +497,11 @@ } if ((results == null) || (results.get(ModelService.RESPONSE_MESSAGE).equals(ModelService.RESPOND_ERROR))) { - Debug.logError((String) results.get(ModelService.ERROR_MESSAGE), module); + Debug.logError((String) results.get(ModelService.ERROR_MESSAGE), module); request.setAttribute("_ERROR_MESSAGE_", (String) results.get(ModelService.ERROR_MESSAGE)); return false; } - return true; + return true; } } \ No newline at end of file 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=757093&r1=757092&r2=757093&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 Sat Mar 21 23:44:59 2009 @@ -6,9 +6,9 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY @@ -526,7 +526,7 @@ Debug.logError(e, module); } - byte[] des3 = copyBytes(desByte1, copyBytes(desByte2, desByte3, 0), 0); + byte[] des3 = copyBytes(desByte1, copyBytes(desByte2, desByte3, 0), 0); return generateMwk(des3); } else { Debug.log("Null DES keys returned", module); @@ -687,7 +687,7 @@ BigDecimal amountBd = new BigDecimal(amount); return amountBd.movePointLeft(2); } - + public String getCurrency(String currency) { return "840"; // todo make this multi-currency } 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=757093&r1=757092&r2=757093&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 Sat Mar 21 23:44:59 2009 @@ -6,9 +6,9 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY @@ -1449,7 +1449,7 @@ uiLabelMap.addBottomResourceBundle("CommonUiLabels"); answerMap.put("uiLabelMap", uiLabelMap); answerMap.put("locale", locale); - + String bodyScreenLocation = productStoreEmail.getString("bodyScreenLocation"); if (UtilValidate.isEmpty(bodyScreenLocation)) { bodyScreenLocation = ProductStoreWorker.getDefaultProductStoreEmailScreenLocation(emailType); Modified: ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/thirdparty/verisign/PayflowPro.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/thirdparty/verisign/PayflowPro.java?rev=757093&r1=757092&r2=757093&view=diff ============================================================================== --- ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/thirdparty/verisign/PayflowPro.java (original) +++ ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/thirdparty/verisign/PayflowPro.java Sat Mar 21 23:44:59 2009 @@ -6,9 +6,9 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY @@ -137,7 +137,7 @@ resp = pn.SubmitTransaction(params.toString()); } else { resp = "RESULT=0&AUTHCODE=T&PNREF=" + (new Date()).getTime() + "&RESPMSG=Testing"; - } + } if (Debug.verboseOn()) Debug.logVerbose("Response from Verisign: " + resp, module); @@ -324,7 +324,7 @@ resp = pn.SubmitTransaction(params.toString()); } else { resp = "RESULT=0&AUTHCODE=T&PNREF=" + (new Date()).getTime() + "&RESPMSG=Testing"; - } + } if (Debug.verboseOn()) Debug.logVerbose("Response from Verisign: " + resp, module); @@ -408,7 +408,7 @@ // other error Debug.logWarning("In PayflowPro failing authorization; respCode/RESULT=" + respCode + ", avsCheckOkay=" + avsCheckOkay + ", cvv2CheckOkay=" + cvv2CheckOkay + "; AUTHCODE=" + parameters.get("AUTHCODE"), module); result.put("authResult", Boolean.FALSE); - + // now check certain special conditions and report back through the generic params if ("12".equals(respCode)) { result.put("resultDeclined", Boolean.TRUE); @@ -547,7 +547,7 @@ } else { Debug.logWarning("In PayflowPro failing refund; respCode/RESULT=" + respCode + "; PNREF=" + parameters.get("PNREF") + "; AUTHCODE=" + parameters.get("AUTHCODE"), module); result.put("refundResult", Boolean.FALSE); - } + } result.put("refundRefNum", parameters.get("PNREF")); result.put("refundFlag", parameters.get("RESULT")); result.put("refundMessage", parameters.get("RESPMSG")); @@ -628,26 +628,26 @@ /* * RESULT values (and RESPMSG text) - * + * 0 Approved -1 User authentication failed. Error is caused by one or more of the following: -Login information is incorrect. Verify that USER, VENDOR, PARTNER, and -PASSWORD have been entered correctly. See Table 3.2 on page 26 for additional -information and field descriptions. -Invalid Processor information entered. Contact merchant bank to verify. -"Allowed IP Address" security feature implemented. The transaction is coming -from an unknown IP address. See VeriSign Manager online help for details on how -to use Manager to update the allowed IP addresses. -You are using a test (not active) account to submit a transaction to the live VeriSign -servers. Change the URL from test-payflow.verisign.com to payflow.verisign.com. +1 User authentication failed. Error is caused by one or more of the following: +Login information is incorrect. Verify that USER, VENDOR, PARTNER, and +PASSWORD have been entered correctly. See Table 3.2 on page 26 for additional +information and field descriptions. +Invalid Processor information entered. Contact merchant bank to verify. +"Allowed IP Address" security feature implemented. The transaction is coming +from an unknown IP address. See VeriSign Manager online help for details on how +to use Manager to update the allowed IP addresses. +You are using a test (not active) account to submit a transaction to the live VeriSign +servers. Change the URL from test-payflow.verisign.com to payflow.verisign.com. 2 Invalid tender type. Your merchant bank account does not support the following -credit card type that was submitted. +credit card type that was submitted. 3 Invalid transaction type. Transaction type is not appropriate for this transaction. For -example, you cannot credit an authorization-only transaction. +example, you cannot credit an authorization-only transaction. 4 Invalid amount format. Use the format: Ò#####.##Ó Do not include currency -symbols or commas. +symbols or commas. 5 Invalid merchant information. Processor does not recognize your merchant account -information. Contact your bank account acquirer to resolve this problem. +information. Contact your bank account acquirer to resolve this problem. 6 Invalid or unsupported currency code 7 Field format error. Invalid information entered. See RESPMSG. 8 Not a transaction server @@ -655,27 +655,27 @@ 10 Too many line items 11 Client time-out waiting for response 12 Declined. Check the credit card number, expiration date, and transaction information to -make sure they were entered correctly. If this does not resolve the problem, have the -customer call their card issuing bank to resolve. +make sure they were entered correctly. If this does not resolve the problem, have the +customer call their card issuing bank to resolve. 13 Referral. Transaction cannot be approved electronically but can be approved with a -verbal authorization. Contact your merchant bank to obtain an authorization and submit -a manual Voice Authorization transaction. +verbal authorization. Contact your merchant bank to obtain an authorization and submit +a manual Voice Authorization transaction. 14 Invalid Client Certification ID. Check the HTTP header. If the tag, X-VPS-VIT- -CLIENT-CERTIFICATION-ID, is missing, RESULT code 14 is returned. +CLIENT-CERTIFICATION-ID, is missing, RESULT code 14 is returned. 19 Original transaction ID not found. The transaction ID you entered for this -transaction is not valid. See RESPMSG. +transaction is not valid. See RESPMSG. 20 Cannot find the customer reference number 22 Invalid ABA number -23 Invalid account number. Check credit card number and re-submit. +23 Invalid account number. Check credit card number and re-submit. 24 Invalid expiration date. Check and re-submit. 25 Invalid Host Mapping. You are trying to process a tender type such as Discover Card, -but you are not set up with your merchant bank to accept this card type. +but you are not set up with your merchant bank to accept this card type. 26 Invalid vendor account 27 Insufficient partner permissions 28 Insufficient user permissions 29 Invalid XML document. This could be caused by an unrecognized XML tag or a bad -XML format that cannot be parsed by the system. +XML format that cannot be parsed by the system. 30 Duplicate transaction 31 Error in adding the recurring profile 32 Error in modifying the recurring profile @@ -692,151 +692,151 @@ 103 Error reading response from host 104 Timeout waiting for processor response. Try your transaction again. 105 Credit error. Make sure you have not already credited this transaction, or that this -transaction ID is for a creditable transaction. (For example, you cannot credit an -authorization.) -106 Host not available -107 Duplicate suppression time-out +transaction ID is for a creditable transaction. (For example, you cannot credit an +authorization.) +106 Host not available +107 Duplicate suppression time-out -108 Void error. See RESPMSG. Make sure the transaction ID entered has not already been -voided. If not, then look at the Transaction Detail screen for this transaction to see if it +108 Void error. See RESPMSG. Make sure the transaction ID entered has not already been +voided. If not, then look at the Transaction Detail screen for this transaction to see if it has settled. (The Batch field is set to a number greater than zero if the transaction has -been settled). If the transaction has already settled, your only recourse is a reversal -(credit a payment or submit a payment for a credit). -109 Time-out waiting for host response -111 Capture error. Either an attempt to capture a transaction that is not an authorization -transaction type, or an attempt to capture an authorization transaction that has already -been captured. -112 Failed AVS check. Address and ZIP code do not match. An authorization may still -exist on the cardholderÕs account. -113 Merchant sale total will exceed the sales cap with current transaction. ACH -transactions only. -114 Card Security Code (CSC) Mismatch. An authorization may still exist on the -cardholderÕs account. -115 System busy, try again later -116 VPS Internal error. Failed to lock terminal number -117 Failed merchant rule check. One or more of the following three failures occurred: +been settled). If the transaction has already settled, your only recourse is a reversal +(credit a payment or submit a payment for a credit). +109 Time-out waiting for host response +111 Capture error. Either an attempt to capture a transaction that is not an authorization +transaction type, or an attempt to capture an authorization transaction that has already +been captured. +112 Failed AVS check. Address and ZIP code do not match. An authorization may still +exist on the cardholderÕs account. +113 Merchant sale total will exceed the sales cap with current transaction. ACH +transactions only. +114 Card Security Code (CSC) Mismatch. An authorization may still exist on the +cardholderÕs account. +115 System busy, try again later +116 VPS Internal error. Failed to lock terminal number +117 Failed merchant rule check. One or more of the following three failures occurred: An attempt was made to submit a transaction that failed to meet the security settings -specified on the Payflow Pro Java SDK Security Settings page. If the transaction -exceeded the Maximum Amount security setting, then no values are returned for AVS -or CSC. -AVS validation failed. The AVS return value should appear in the RESPMSG. -CSC validation failed. The CSC return value should appear in the RESPMSG. +specified on the Payflow Pro Java SDK Security Settings page. If the transaction +exceeded the Maximum Amount security setting, then no values are returned for AVS +or CSC. +AVS validation failed. The AVS return value should appear in the RESPMSG. +CSC validation failed. The CSC return value should appear in the RESPMSG. 118 Invalid keywords found in string fields -122 Merchant sale total will exceed the credit cap with current transaction. ACH -transactions only. +122 Merchant sale total will exceed the credit cap with current transaction. ACH +transactions only. 125 Fraud Protection Services Filter Ñ Declined by filters 126 Fraud Protection Services Filter Ñ Flagged for review by filters -Important Note: Result code 126 indicates that a transaction triggered a fraud filter. -This is not an error, but a notice that the transaction is in a review status. The -transaction has been authorized but requires you to review and to manually accept the -transaction before it will be allowed to settle. +Important Note: Result code 126 indicates that a transaction triggered a fraud filter. +This is not an error, but a notice that the transaction is in a review status. The +transaction has been authorized but requires you to review and to manually accept the +transaction before it will be allowed to settle. Result code 126 is intended to give you an idea of the kind of transaction that is -considered suspicious to enable you to evaluate whether you can benefit from using the -Fraud Protection Services. -To eliminate result 126, turn the filters off. -For more information, see the UserÕs Guide for Payflow Pro With Fraud Protection -Services or UserÕs Guide for Payflow Link Guide With Fraud Protection Services. +considered suspicious to enable you to evaluate whether you can benefit from using the +Fraud Protection Services. +To eliminate result 126, turn the filters off. +For more information, see the UserÕs Guide for Payflow Pro With Fraud Protection +Services or UserÕs Guide for Payflow Link Guide With Fraud Protection Services. 127 Fraud Protection Services Filter Ñ Not processed by filters -128 Fraud Protection Services Filter Ñ Declined by merchant after being flagged for +128 Fraud Protection Services Filter Ñ Declined by merchant after being flagged for review by filters -131 Version 1 Payflow Pro SDK client no longer supported. Upgrade to the most recent -version of the Payflow Pro client. -150 Issuing bank timed out -151 Issuing bank unavailable -1000 Generic host error. This is a generic message returned by your credit card processor. -The RESPMSG will contain more information describing the error. -1001 Buyer Authentication Service unavailable -1002 Buyer Authentication Service Ñ Transaction timeout -1003 Buyer Authentication Service Ñ Invalid client version -1004 Buyer Authentication Service Ñ Invalid timeout value -1011 Buyer Authentication Service unavailable -1012 Buyer Authentication Service unavailable -1013 Buyer Authentication Service unavailable -1014 Buyer Authentication Service Ñ Merchant is not enrolled for Buyer -Authentication Service (3-D Secure). -1016 Buyer Authentication Service Ñ 3-D Secure error response received. Instead of -receiving a PARes response to a Validate Authentication transaction, an error response -was received. -1017 Buyer Authentication Service Ñ 3-D Secure error response is invalid. An error -response is received and the response is not well formed for a Validate Authentication -transaction. - -1021 Buyer Authentication Service Ñ Invalid card type -1022 Buyer Authentication Service Ñ Invalid or missing currency code -1023 Buyer Authentication Service Ñ merchant status for 3D secure is invalid -1041 Buyer Authentication Service Ñ Validate Authentication failed: missing or -invalid PARES +131 Version 1 Payflow Pro SDK client no longer supported. Upgrade to the most recent +version of the Payflow Pro client. +150 Issuing bank timed out +151 Issuing bank unavailable +1000 Generic host error. This is a generic message returned by your credit card processor. +The RESPMSG will contain more information describing the error. +1001 Buyer Authentication Service unavailable +1002 Buyer Authentication Service Ñ Transaction timeout +1003 Buyer Authentication Service Ñ Invalid client version +1004 Buyer Authentication Service Ñ Invalid timeout value +1011 Buyer Authentication Service unavailable +1012 Buyer Authentication Service unavailable +1013 Buyer Authentication Service unavailable +1014 Buyer Authentication Service Ñ Merchant is not enrolled for Buyer +Authentication Service (3-D Secure). +1016 Buyer Authentication Service Ñ 3-D Secure error response received. Instead of +receiving a PARes response to a Validate Authentication transaction, an error response +was received. +1017 Buyer Authentication Service Ñ 3-D Secure error response is invalid. An error +response is received and the response is not well formed for a Validate Authentication +transaction. + +1021 Buyer Authentication Service Ñ Invalid card type +1022 Buyer Authentication Service Ñ Invalid or missing currency code +1023 Buyer Authentication Service Ñ merchant status for 3D secure is invalid +1041 Buyer Authentication Service Ñ Validate Authentication failed: missing or +invalid PARES 1042 Buyer Authentication Service Ñ Validate Authentication failed: PARES format is -invalid -1043 Buyer Authentication Service Ñ Validate Authentication failed: Cannot find -successful Verify Enrollment -1044 Buyer Authentication Service Ñ Validate Authentication failed: Signature -validation failed for PARES -1045 Buyer Authentication Service Ñ Validate Authentication failed: Mismatched or -invalid amount in PARES -1046 Buyer Authentication Service Ñ Validate Authentication failed: Mismatched or -invalid acquirer in PARES -1047 Buyer Authentication Service Ñ Validate Authentication failed: Mismatched or -invalid Merchant ID in PARES -1048 Buyer Authentication Service Ñ Validate Authentication failed: Mismatched or -invalid card number in PARES -1049 Buyer Authentication Service Ñ Validate Authentication failed: Mismatched or -invalid currency code in PARES -1050 Buyer Authentication Service Ñ Validate Authentication failed: Mismatched or -invalid XID in PARES -1051 Buyer Authentication Service Ñ Validate Authentication failed: Mismatched or -invalid order date in PARES +invalid +1043 Buyer Authentication Service Ñ Validate Authentication failed: Cannot find +successful Verify Enrollment +1044 Buyer Authentication Service Ñ Validate Authentication failed: Signature +validation failed for PARES +1045 Buyer Authentication Service Ñ Validate Authentication failed: Mismatched or +invalid amount in PARES +1046 Buyer Authentication Service Ñ Validate Authentication failed: Mismatched or +invalid acquirer in PARES +1047 Buyer Authentication Service Ñ Validate Authentication failed: Mismatched or +invalid Merchant ID in PARES +1048 Buyer Authentication Service Ñ Validate Authentication failed: Mismatched or +invalid card number in PARES +1049 Buyer Authentication Service Ñ Validate Authentication failed: Mismatched or +invalid currency code in PARES +1050 Buyer Authentication Service Ñ Validate Authentication failed: Mismatched or +invalid XID in PARES +1051 Buyer Authentication Service Ñ Validate Authentication failed: Mismatched or +invalid order date in PARES 1052 Buyer Authentication Service Ñ Validate Authentication failed: This PARES was -already validated for a previous Validate Authentication transaction +already validated for a previous Validate Authentication transaction */ - + /* RESULT for communication errors (less than 0) - * --1 Failed to connect to host --2 Failed to resolve hostname --5 Failed to initialize SSL context --6 Parameter list format error: & in name --7 Parameter list format error: invalid [ ] name length clause --8 SSL failed to connect to host --9 SSL read failed --10 SSL write failed --11 Proxy authorization failed --12 Timeout waiting for response --13 Select failure + * +-1 Failed to connect to host +-2 Failed to resolve hostname +-5 Failed to initialize SSL context +-6 Parameter list format error: & in name +-7 Parameter list format error: invalid [ ] name length clause +-8 SSL failed to connect to host +-9 SSL read failed +-10 SSL write failed +-11 Proxy authorization failed +-12 Timeout waiting for response +-13 Select failure -14 Too many connections -15 Failed to set socket options --20 Proxy read failed --21 Proxy write failed --22 Failed to initialize SSL certificate --23 Host address not specified --24 Invalid transaction type --25 Failed to create a socket --26 Failed to initialize socket layer --27 Parameter list format error: invalid [ ] name length clause --28 Parameter list format error: name --29 Failed to initialize SSL connection +-20 Proxy read failed +-21 Proxy write failed +-22 Failed to initialize SSL certificate +-23 Host address not specified +-24 Invalid transaction type +-25 Failed to create a socket +-26 Failed to initialize socket layer +-27 Parameter list format error: invalid [ ] name length clause +-28 Parameter list format error: name +-29 Failed to initialize SSL connection -30 Invalid timeout value --31 The certificate chain did not validate, no local certificate found --32 The certificate chain did not validate, common name did not match URL -- 40 Unexpected Request ID found in request. -- 41 Required Request ID not found in request -- 42 Required Response ID not found in request -- 43 Unexpected Response ID found in request -- 44 Response ID not found in the response received from the server --99 Out of memory --100 Parameter list cannot be empty --103 Context initialization failed --104 Unexpected transaction state --105 Invalid name value pair request --106 Invalid response format --107 This XMLPay version is not supported --108 The server certificate chain did not validate --109 Unable to do logging --111 The following error occurred while initializing from message file: <Details of -the error message> --113 Unable to round and truncate the currency value simultaneously +-31 The certificate chain did not validate, no local certificate found +-32 The certificate chain did not validate, common name did not match URL +- 40 Unexpected Request ID found in request. +- 41 Required Request ID not found in request +- 42 Required Response ID not found in request +- 43 Unexpected Response ID found in request +- 44 Response ID not found in the response received from the server +-99 Out of memory +-100 Parameter list cannot be empty +-103 Context initialization failed +-104 Unexpected transaction state +-105 Invalid name value pair request +-106 Invalid response format +-107 This XMLPay version is not supported +-108 The server certificate chain did not validate +-109 Unable to do logging +-111 The following error occurred while initializing from message file: <Details of +the error message> +-113 Unable to round and truncate the currency value simultaneously */ } |
Free forum by Nabble | Edit this page |