You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ofbiz.apache.org by Jacques Le Roux <ja...@les7arts.com> on 2015/08/10 18:54:13 UTC

Re: svn commit: r1695126 [1/22] - in /ofbiz/trunk: applications/accounting/src/org/ofbiz/accounting/thirdparty/authorizedotnet / applications/accounting/src/org/ofbiz/accounting/thirdparty/securepay/ applications/content/src/org/ofbiz/content/webapp/ftl/ ap...

Nope, I was confused, see my next message :)

Jacques

Le 10/08/2015 18:24, Adrian Crum a écrit :
> I'm confused. We have always used the OFBiz-recommended Subversion settings:
>
> https://ofbiz.apache.org/svn/config
>
> Has that changed?
>
> Adrian Crum
> Sandglass Software
> www.sandglass-software.com
>
> On 8/10/2015 9:15 AM, jleroux@apache.org wrote:
>> Author: jleroux
>> Date: Mon Aug 10 16:15:37 2015
>> New Revision: 1695126
>>
>> URL: http://svn.apache.org/r1695126
>> Log:
>> Reverts r1044202. No functional change.
>> This reverts svn:eol-style=native on Java files which were forced by r1044202n, 89 Java files are concerned. This commit hopefully makes things 
>> more consistent.
>> It's indeed hard to see the impact of this change before it's committed. I'll check once done, I already found 116 Java files w/o 
>> svn:eol-style=native but there are 1231 Java files at all, so not sure how most are set...
>>
>> Modified:
>> ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/thirdparty/authorizedotnet/AIMRespPositions.java (contents, props changed)
>> ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/thirdparty/authorizedotnet/CPRespPositions.java (contents, props changed)
>> ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/thirdparty/securepay/SecurePayPaymentServices.java (contents, props changed)
>> ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/thirdparty/securepay/SecurePayServiceTest.java (contents, props changed)
>> ofbiz/trunk/applications/content/src/org/ofbiz/content/webapp/ftl/RenderContentAndSubContent.java (contents, props changed)
>> ofbiz/trunk/applications/content/src/org/ofbiz/content/webapp/ftl/RenderContentTransform.java (contents, props changed)
>> ofbiz/trunk/applications/marketing/src/org/ofbiz/marketing/marketing/MarketingServices.java (contents, props changed)
>> ofbiz/trunk/applications/order/src/org/ofbiz/order/requirement/RequirementServices.java (contents, props changed)
>> ofbiz/trunk/applications/product/src/org/ofbiz/product/inventory/InventoryWorker.java (contents, props changed)
>> ofbiz/trunk/framework/base/src/org/ofbiz/base/concurrent/ExecutionPool.java (contents, props changed)
>> ofbiz/trunk/framework/base/src/org/ofbiz/base/config/CoberturaInstrumenter.java (contents, props changed)
>> ofbiz/trunk/framework/base/src/org/ofbiz/base/container/JustLoadComponentsContainer.java (contents, props changed)
>> ofbiz/trunk/framework/base/src/org/ofbiz/base/conversion/GenericSingletonToList.java (contents, props changed)
>> ofbiz/trunk/framework/base/src/org/ofbiz/base/conversion/GenericSingletonToSet.java (contents, props changed)
>> ofbiz/trunk/framework/base/src/org/ofbiz/base/conversion/JSONConverters.java (contents, props changed)
>> ofbiz/trunk/framework/base/src/org/ofbiz/base/conversion/NetConverters.java (contents, props changed)
>> ofbiz/trunk/framework/base/src/org/ofbiz/base/conversion/test/DateTimeTests.java (contents, props changed)
>> ofbiz/trunk/framework/base/src/org/ofbiz/base/conversion/test/MiscTests.java (contents, props changed)
>> ofbiz/trunk/framework/base/src/org/ofbiz/base/lang/IsEmpty.java (contents, props changed)
>> ofbiz/trunk/framework/base/src/org/ofbiz/base/lang/LockedBy.java (contents, props changed)
>> ofbiz/trunk/framework/base/src/org/ofbiz/base/lang/SourceMonitored.java (contents, props changed)
>> ofbiz/trunk/framework/base/src/org/ofbiz/base/lang/test/ComparableRangeTests.java (contents, props changed)
>> ofbiz/trunk/framework/base/src/org/ofbiz/base/test/GenericTestCaseBase.java (contents, props changed)
>> ofbiz/trunk/framework/base/src/org/ofbiz/base/util/IndentingWriter.java (contents, props changed)
>> ofbiz/trunk/framework/base/src/org/ofbiz/base/util/RMIExtendedSocketFactory.java (contents, props changed)
>> ofbiz/trunk/framework/base/src/org/ofbiz/base/util/ReferenceCleaner.java (contents, props changed)
>> ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilIO.java (contents, props changed)
>> ofbiz/trunk/framework/base/src/org/ofbiz/base/util/cache/test/UtilCacheTests.java (contents, props changed)
>> ofbiz/trunk/framework/base/src/org/ofbiz/base/util/collections/GenericMap.java (contents, props changed)
>> ofbiz/trunk/framework/base/src/org/ofbiz/base/util/collections/GenericMapCollection.java (contents, props changed)
>> ofbiz/trunk/framework/base/src/org/ofbiz/base/util/collections/GenericMapEntry.java (contents, props changed)
>> ofbiz/trunk/framework/base/src/org/ofbiz/base/util/collections/GenericMapEntrySet.java (contents, props changed)
>> ofbiz/trunk/framework/base/src/org/ofbiz/base/util/collections/GenericMapKeySet.java (contents, props changed)
>> ofbiz/trunk/framework/base/src/org/ofbiz/base/util/collections/GenericMapSet.java (contents, props changed)
>> ofbiz/trunk/framework/base/src/org/ofbiz/base/util/collections/GenericMapValues.java (contents, props changed)
>> ofbiz/trunk/framework/base/src/org/ofbiz/base/util/collections/IteratorWrapper.java (contents, props changed)
>> ofbiz/trunk/framework/base/src/org/ofbiz/base/util/collections/MapContext.java (contents, props changed)
>> ofbiz/trunk/framework/base/src/org/ofbiz/base/util/collections/ReadOnlyMapEntry.java (contents, props changed)
>> ofbiz/trunk/framework/base/src/org/ofbiz/base/util/collections/test/FlexibleMapAccessorTests.java (contents, props changed)
>> ofbiz/trunk/framework/base/src/org/ofbiz/base/util/collections/test/GenericMapTest.java (contents, props changed)
>> ofbiz/trunk/framework/base/src/org/ofbiz/base/util/string/test/FlexibleStringExpanderTests.java (contents, props changed)
>> ofbiz/trunk/framework/base/src/org/ofbiz/base/util/test/IndentingWriterTests.java (contents, props changed)
>> ofbiz/trunk/framework/base/src/org/ofbiz/base/util/test/ObjectTypeTests.java (contents, props changed)
>> ofbiz/trunk/framework/base/src/org/ofbiz/base/util/test/ReferenceCleanerTests.java (contents, props changed)
>> ofbiz/trunk/framework/base/src/org/ofbiz/base/util/test/StringUtilTests.java (contents, props changed)
>> ofbiz/trunk/framework/base/src/org/ofbiz/base/util/test/UtilIOTests.java (contents, props changed)
>> ofbiz/trunk/framework/base/src/org/ofbiz/base/util/test/UtilObjectTests.java (contents, props changed)
>> ofbiz/trunk/framework/common/src/org/ofbiz/common/authentication/AuthHelper.java (contents, props changed)
>> ofbiz/trunk/framework/common/src/org/ofbiz/common/authentication/AuthenticationComparator.java (contents, props changed)
>> ofbiz/trunk/framework/common/src/org/ofbiz/common/authentication/api/Authenticator.java (contents, props changed)
>> ofbiz/trunk/framework/common/src/org/ofbiz/common/authentication/api/AuthenticatorException.java (contents, props changed)
>> ofbiz/trunk/framework/common/src/org/ofbiz/common/authentication/example/TestFailAuthenticator.java (contents, props changed)
>> ofbiz/trunk/framework/common/src/org/ofbiz/common/authentication/example/TestPassAuthenticator.java (contents, props changed)
>> ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/callops/CallScript.java (contents, props changed)
>> ofbiz/trunk/framework/start/src/org/ofbiz/base/start/Instrumenter.java (contents, props changed)
>> ofbiz/trunk/framework/start/src/org/ofbiz/base/start/InstrumenterWorker.java (contents, props changed)
>> ofbiz/trunk/framework/testtools/src/org/ofbiz/testtools/TestListContainer.java (contents, props changed)
>> ofbiz/trunk/specialpurpose/ebaystore/src/org/ofbiz/ebaystore/EbayAccount.java (contents, props changed)
>> ofbiz/trunk/specialpurpose/ebaystore/src/org/ofbiz/ebaystore/EbayBestOfferAutoPref.java (contents, props changed)
>> ofbiz/trunk/specialpurpose/ebaystore/src/org/ofbiz/ebaystore/EbayEvents.java (contents, props changed)
>> ofbiz/trunk/specialpurpose/ebaystore/src/org/ofbiz/ebaystore/EbayFeedback.java (contents, props changed)
>> ofbiz/trunk/specialpurpose/ebaystore/src/org/ofbiz/ebaystore/EbayStore.java (contents, props changed)
>> ofbiz/trunk/specialpurpose/ebaystore/src/org/ofbiz/ebaystore/EbayStoreAutoPrefEvents.java (contents, props changed)
>> ofbiz/trunk/specialpurpose/ebaystore/src/org/ofbiz/ebaystore/EbayStoreAutoPreferences.java (contents, props changed)
>> ofbiz/trunk/specialpurpose/ebaystore/src/org/ofbiz/ebaystore/EbayStoreCategoryFacade.java (contents, props changed)
>> ofbiz/trunk/specialpurpose/ebaystore/src/org/ofbiz/ebaystore/EbayStoreCustomerService.java (contents, props changed)
>> ofbiz/trunk/specialpurpose/ebaystore/src/org/ofbiz/ebaystore/EbayStoreHelper.java (contents, props changed)
>> ofbiz/trunk/specialpurpose/ebaystore/src/org/ofbiz/ebaystore/EbayStoreInventoryServices.java (contents, props changed)
>> ofbiz/trunk/specialpurpose/ebaystore/src/org/ofbiz/ebaystore/EbayStoreOptions.java (contents, props changed)
>> ofbiz/trunk/specialpurpose/ebaystore/src/org/ofbiz/ebaystore/EbayStoreOrder.java (contents, props changed)
>> ofbiz/trunk/specialpurpose/ebaystore/src/org/ofbiz/ebaystore/EbayStoreSiteFacade.java (contents, props changed)
>> ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/component/PromoStatusBar.java (contents, props changed)
>> ofbiz/trunk/specialpurpose/pos/src/org/ofbiz/pos/screen/ClientProfile.java (contents, props changed)
>>
>> Modified: ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/thirdparty/authorizedotnet/AIMRespPositions.java
>> URL: 
>> http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/thirdparty/authorizedotnet/AIMRespPositions.java?rev=1695126&r1=1695125&r2=1695126&view=diff
>> ==============================================================================
>> --- ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/thirdparty/authorizedotnet/AIMRespPositions.java (original)
>> +++ ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/thirdparty/authorizedotnet/AIMRespPositions.java Mon Aug 10 16:15:37 2015
>> @@ -1,53 +1,53 @@
>> -/*******************************************************************************
>> - * Licensed to the Apache Software Foundation (ASF) under one
>> - * or more contributor license agreements.  See the NOTICE file
>> - * distributed with this work for additional information
>> - * regarding copyright ownership.  The ASF licenses this file
>> - * 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
>> - * KIND, either express or implied.  See the License for the
>> - * specific language governing permissions and limitations
>> - * under the License.
>> - *******************************************************************************/
>> -
>> -package org.ofbiz.accounting.thirdparty.authorizedotnet;
>> -
>> -import java.util.LinkedHashMap;
>> -import java.util.Map;
>> -
>> -public class AIMRespPositions extends AuthorizeResponse.RespPositions {
>> -
>> -    // AIM v3.1 response positions
>> -    private static Map<String, Integer> positions = new LinkedHashMap<String, Integer>();
>> -    static {
>> -        positions.put(AuthorizeResponse.RESPONSE_CODE, 1);
>> -        positions.put(AuthorizeResponse.REASON_CODE, 3);
>> -        positions.put(AuthorizeResponse.REASON_TEXT, 4);
>> -        positions.put(AuthorizeResponse.AUTHORIZATION_CODE, 5);
>> -        positions.put(AuthorizeResponse.AVS_RESULT_CODE, 6);
>> -        positions.put(AuthorizeResponse.CVV_RESULT_CODE, 39);
>> -        positions.put(AuthorizeResponse.TRANSACTION_ID, 7);
>> -        positions.put(AuthorizeResponse.AMOUNT, 10);
>> -    }
>> -
>> -    @Override
>> -    public int getPosition(String name) {
>> -        if (positions.containsKey(name)) {
>> -            return positions.get(name);
>> -        } else {
>> -            return -1;
>> -        }
>> -    }
>> -
>> -    @Override
>> -    public String getApprovalString() {
>> -        return "1";
>> -    }
>> -}
>> +/*******************************************************************************
>> + * Licensed to the Apache Software Foundation (ASF) under one
>> + * or more contributor license agreements.  See the NOTICE file
>> + * distributed with this work for additional information
>> + * regarding copyright ownership.  The ASF licenses this file
>> + * 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
>> + * KIND, either express or implied.  See the License for the
>> + * specific language governing permissions and limitations
>> + * under the License.
>> + *******************************************************************************/
>> +
>> +package org.ofbiz.accounting.thirdparty.authorizedotnet;
>> +
>> +import java.util.LinkedHashMap;
>> +import java.util.Map;
>> +
>> +public class AIMRespPositions extends AuthorizeResponse.RespPositions {
>> +
>> +    // AIM v3.1 response positions
>> +    private static Map<String, Integer> positions = new LinkedHashMap<String, Integer>();
>> +    static {
>> +        positions.put(AuthorizeResponse.RESPONSE_CODE, 1);
>> +        positions.put(AuthorizeResponse.REASON_CODE, 3);
>> +        positions.put(AuthorizeResponse.REASON_TEXT, 4);
>> +        positions.put(AuthorizeResponse.AUTHORIZATION_CODE, 5);
>> +        positions.put(AuthorizeResponse.AVS_RESULT_CODE, 6);
>> +        positions.put(AuthorizeResponse.CVV_RESULT_CODE, 39);
>> +        positions.put(AuthorizeResponse.TRANSACTION_ID, 7);
>> +        positions.put(AuthorizeResponse.AMOUNT, 10);
>> +    }
>> +
>> +    @Override
>> +    public int getPosition(String name) {
>> +        if (positions.containsKey(name)) {
>> +            return positions.get(name);
>> +        } else {
>> +            return -1;
>> +        }
>> +    }
>> +
>> +    @Override
>> +    public String getApprovalString() {
>> +        return "1";
>> +    }
>> +}
>>
>> Propchange: ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/thirdparty/authorizedotnet/AIMRespPositions.java
>>              ('svn:eol-style' removed)
>>
>> Modified: ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/thirdparty/authorizedotnet/CPRespPositions.java
>> URL: 
>> http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/thirdparty/authorizedotnet/CPRespPositions.java?rev=1695126&r1=1695125&r2=1695126&view=diff
>> ==============================================================================
>> --- ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/thirdparty/authorizedotnet/CPRespPositions.java (original)
>> +++ ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/thirdparty/authorizedotnet/CPRespPositions.java Mon Aug 10 16:15:37 2015
>> @@ -1,53 +1,53 @@
>> -/*******************************************************************************
>> - * Licensed to the Apache Software Foundation (ASF) under one
>> - * or more contributor license agreements.  See the NOTICE file
>> - * distributed with this work for additional information
>> - * regarding copyright ownership.  The ASF licenses this file
>> - * 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
>> - * KIND, either express or implied.  See the License for the
>> - * specific language governing permissions and limitations
>> - * under the License.
>> - *******************************************************************************/
>> -
>> -package org.ofbiz.accounting.thirdparty.authorizedotnet;
>> -
>> -import java.util.LinkedHashMap;
>> -import java.util.Map;
>> -
>> -public class CPRespPositions extends AuthorizeResponse.RespPositions {
>> -
>> -    // Card-Present v1.0 response positions
>> -    private static Map<String, Integer> positions = new LinkedHashMap<String, Integer>();
>> -    static {
>> -        positions.put(AuthorizeResponse.RESPONSE_CODE, 2);
>> -        positions.put(AuthorizeResponse.REASON_CODE, 3);
>> -        positions.put(AuthorizeResponse.REASON_TEXT, 4);
>> -        positions.put(AuthorizeResponse.AUTHORIZATION_CODE, 5);
>> -        positions.put(AuthorizeResponse.AVS_RESULT_CODE, 6);
>> -        positions.put(AuthorizeResponse.CVV_RESULT_CODE, 7);
>> -        positions.put(AuthorizeResponse.TRANSACTION_ID, 8);
>> -        positions.put(AuthorizeResponse.AMOUNT, 25);
>> -    }
>> -
>> -    @Override
>> -    public int getPosition(String name) {
>> -        if (positions.containsKey(name)) {
>> -            return positions.get(name);
>> -        } else {
>> -            return -1;
>> -        }
>> -    }
>> -
>> -    @Override
>> -    public String getApprovalString() {
>> -        return "1";
>> -    }
>> -}
>> +/*******************************************************************************
>> + * Licensed to the Apache Software Foundation (ASF) under one
>> + * or more contributor license agreements.  See the NOTICE file
>> + * distributed with this work for additional information
>> + * regarding copyright ownership.  The ASF licenses this file
>> + * 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
>> + * KIND, either express or implied.  See the License for the
>> + * specific language governing permissions and limitations
>> + * under the License.
>> + *******************************************************************************/
>> +
>> +package org.ofbiz.accounting.thirdparty.authorizedotnet;
>> +
>> +import java.util.LinkedHashMap;
>> +import java.util.Map;
>> +
>> +public class CPRespPositions extends AuthorizeResponse.RespPositions {
>> +
>> +    // Card-Present v1.0 response positions
>> +    private static Map<String, Integer> positions = new LinkedHashMap<String, Integer>();
>> +    static {
>> +        positions.put(AuthorizeResponse.RESPONSE_CODE, 2);
>> +        positions.put(AuthorizeResponse.REASON_CODE, 3);
>> +        positions.put(AuthorizeResponse.REASON_TEXT, 4);
>> +        positions.put(AuthorizeResponse.AUTHORIZATION_CODE, 5);
>> +        positions.put(AuthorizeResponse.AVS_RESULT_CODE, 6);
>> +        positions.put(AuthorizeResponse.CVV_RESULT_CODE, 7);
>> +        positions.put(AuthorizeResponse.TRANSACTION_ID, 8);
>> +        positions.put(AuthorizeResponse.AMOUNT, 25);
>> +    }
>> +
>> +    @Override
>> +    public int getPosition(String name) {
>> +        if (positions.containsKey(name)) {
>> +            return positions.get(name);
>> +        } else {
>> +            return -1;
>> +        }
>> +    }
>> +
>> +    @Override
>> +    public String getApprovalString() {
>> +        return "1";
>> +    }
>> +}
>>
>> Propchange: ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/thirdparty/authorizedotnet/CPRespPositions.java
>>              ('svn:eol-style' removed)
>>
>> Modified: ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/thirdparty/securepay/SecurePayPaymentServices.java
>> URL: 
>> http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/thirdparty/securepay/SecurePayPaymentServices.java?rev=1695126&r1=1695125&r2=1695126&view=diff
>> ==============================================================================
>> --- ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/thirdparty/securepay/SecurePayPaymentServices.java (original)
>> +++ ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/thirdparty/securepay/SecurePayPaymentServices.java Mon Aug 10 16:15:37 2015
>> @@ -1,510 +1,510 @@
>> -/*******************************************************************************
>> - * Licensed to the Apache Software Foundation (ASF) under one
>> - * or more contributor license agreements.  See the NOTICE file
>> - * distributed with this work for additional information
>> - * regarding copyright ownership.  The ASF licenses this file
>> - * 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
>> - * KIND, either express or implied.  See the License for the
>> - * specific language governing permissions and limitations
>> - * under the License.
>> - *******************************************************************************/
>> -package org.ofbiz.accounting.thirdparty.securepay;
>> -
>> -import java.math.BigDecimal;
>> -import java.util.List;
>> -import java.util.Locale;
>> -import java.util.Map;
>> -import java.util.Properties;
>> -
>> -import org.ofbiz.accounting.payment.PaymentGatewayServices;
>> -import org.ofbiz.base.util.Debug;
>> -import org.ofbiz.base.util.UtilMisc;
>> -import org.ofbiz.base.util.UtilProperties;
>> -import org.ofbiz.base.util.UtilValidate;
>> -import org.ofbiz.entity.Delegator;
>> -import org.ofbiz.entity.GenericEntityException;
>> -import org.ofbiz.entity.GenericValue;
>> -import org.ofbiz.entity.util.EntityQuery;
>> -import org.ofbiz.entity.util.EntityUtilProperties;
>> -import org.ofbiz.service.DispatchContext;
>> -import org.ofbiz.service.ServiceUtil;
>> -
>> -import securepay.jxa.api.Payment;
>> -import securepay.jxa.api.Txn;
>> -
>> -public class SecurePayPaymentServices {
>> -
>> -    public static final String module = SecurePayPaymentServices.class.getName();
>> -    public final static String resource = "AccountingUiLabels";
>> -
>> -    public static Map<String, Object> doAuth(DispatchContext dctx, Map<String, Object> context) {
>> -        Locale locale = (Locale) context.get("locale");
>> -        Delegator delegator = dctx.getDelegator();
>> -        String orderId = (String) context.get("orderId");
>> -        BigDecimal processAmount = (BigDecimal) context.get("processAmount");
>> -        // generate the request/properties
>> -        Properties props = buildScProperties(context, delegator);
>> -        if (props == null) {
>> -            return ServiceUtil.returnError(UtilProperties.getMessage(resource,
>> - "AccountingSecurityPayNotProperlyConfigurated", locale));
>> -        }
>> -
>> -        String merchantId = props.getProperty("merchantID");
>> -        String serverURL = props.getProperty("serverurl");
>> -        String processtimeout = props.getProperty("processtimeout");
>> -        String pwd = props.getProperty("pwd");
>> -        String enableamountround = props.getProperty("enableamountround");
>> -        String currency = (String) context.get("currency");
>> -        BigDecimal multiplyAmount = new BigDecimal(100);
>> -        BigDecimal newAmount = null;
>> -        int amont;
>> -
>> -        if (enableamountround.equals("Y")) {
>> -            newAmount = new BigDecimal(processAmount.setScale(0, BigDecimal.ROUND_HALF_UP)+".00");
>> -        } else {
>> -            newAmount = processAmount;
>> -        }
>> -
>> -        if (currency.equals("JPY")) {
>> -            amont = newAmount.intValue();
>> -        } else {
>> -            amont = newAmount.multiply(multiplyAmount).intValue();
>> -        }
>> -
>> -        GenericValue creditCard = (GenericValue) context.get("creditCard");
>> -        String expiryDate = (String) creditCard.get("expireDate");
>> -        String cardSecurityCode = (String) context.get("cardSecurityCode");
>> -        Payment payment = new Payment();
>> -        payment.setServerURL(serverURL);
>> - payment.setProcessTimeout(Integer.valueOf(processtimeout));
>> -        payment.setMerchantId(merchantId);
>> -
>> -        Txn txn = payment.addTxn(10, orderId);
>> -        txn.setTxnSource(8);
>> -        txn.setAmount(Integer.toString(amont));
>> -        if (UtilValidate.isNotEmpty(currency)) {
>> -            txn.setCurrencyCode(currency);
>> -        } else {
>> -            txn.setCurrencyCode("AUD");
>> -        }
>> -
>> -        txn.setCardNumber((String) creditCard.get("cardNumber"));
>> -        txn.setExpiryDate(expiryDate.substring(0, 3) + expiryDate.substring(5));
>> -        if (UtilValidate.isNotEmpty(cardSecurityCode)) {
>> -            txn.setCVV(cardSecurityCode);
>> -        }
>> -        // Send payment to SecurePay for processing
>> -        boolean processed = payment.process(pwd);
>> -
>> -        Map<String, Object> result = ServiceUtil.returnSuccess();
>> -        if (UtilValidate.isEmpty(processed)) {
>> -            return ServiceUtil.returnError(UtilProperties.getMessage(resource,
>> -                    "AccountingSecurityPayPaymentWasNotSent", locale));
>> -        } else {
>> -            if (payment.getCount() == 1) {
>> -                Txn resp = payment.getTxn(0);
>> -                boolean approved = resp.getApproved();
>> -                if (approved == false){
>> -                    result.put("authResult", new Boolean(false));
>> -                    result.put("authRefNum", "N/A");
>> -                    result.put("processAmount", BigDecimal.ZERO);
>> -                } else {
>> -                    result.put("authRefNum", resp.getTxnId());
>> -                    result.put("authResult", new Boolean(true));
>> -                    result.put("processAmount", processAmount);
>> -                }
>> -                result.put("authCode", resp.getResponseCode());
>> -                result.put("authMessage", resp.getResponseText());
>> -            }
>> -        }
>> -        return result;
>> -    }
>> -
>> -    public static Map<String, Object> ccReAuth(DispatchContext dctx, Map<String, ? extends Object> context) {
>> -        return ServiceUtil.returnSuccess();
>> -    }
>> -
>> -    public static Map<String, Object> doCapture(DispatchContext dctx, Map<String, Object> context) {
>> -        Locale locale = (Locale) context.get("locale");
>> -        Delegator delegator = dctx.getDelegator();
>> -        GenericValue orderPaymentPreference = (GenericValue) context.get("orderPaymentPreference");
>> -        GenericValue authTransaction = (GenericValue) context.get("authTrans");
>> -        if (authTransaction == null) {
>> -            authTransaction = PaymentGatewayServices.getAuthTransaction(orderPaymentPreference);
>> -        }
>> -        if (authTransaction == null) {
>> -            return ServiceUtil.returnError(UtilProperties.getMessage(resource,
>> - "AccountingPaymentTransactionAuthorizationNotFoundCannotCapture", locale));
>> -        }
>> -
>> -        Properties props = buildScProperties(context, delegator);
>> -        if (props == null) {
>> -            return ServiceUtil.returnError(UtilProperties.getMessage(resource,
>> - "AccountingSecurityPayNotProperlyConfigurated", locale));
>> -        }
>> -
>> -        String merchantId = props.getProperty("merchantID");
>> -        String serverURL = props.getProperty("serverurl");
>> -        String processtimeout = props.getProperty("processtimeout");
>> -        String pwd = props.getProperty("pwd");
>> -        String enableamountround = props.getProperty("enableamountround");
>> -        String currency = authTransaction.getString("currencyUomId");
>> -        BigDecimal captureAmount = (BigDecimal) context.get("captureAmount");
>> -        BigDecimal multiplyAmount = new BigDecimal(100);
>> -        BigDecimal newAmount = null;
>> -        int amont;
>> -
>> -        if (enableamountround.equals("Y")) {
>> -            newAmount = new BigDecimal(captureAmount.setScale(0, BigDecimal.ROUND_HALF_UP)+".00");
>> -        } else {
>> -            newAmount = captureAmount;
>> -        }
>> -
>> -        if (currency.equals("JPY")) {
>> -            amont = newAmount.intValue();
>> -        } else {
>> -            amont = newAmount.multiply(multiplyAmount).intValue();
>> -        }
>> -
>> -        Payment payment = new Payment();
>> -        payment.setServerURL(serverURL);
>> - payment.setProcessTimeout(Integer.valueOf(processtimeout));
>> -        payment.setMerchantId(merchantId);
>> -        Txn txn = payment.addTxn(11, (String) orderPaymentPreference.get("orderId"));
>> -        txn.setTxnSource(8);
>> -        txn.setAmount(Integer.toString(amont));
>> - txn.setPreauthId(authTransaction.getString("referenceNum"));
>> -
>> -        // Send payment to SecurePay for processing
>> -        boolean processed = payment.process(pwd);
>> -
>> -        Map<String, Object> result = ServiceUtil.returnSuccess();
>> -        if (UtilValidate.isEmpty(processed)) {
>> -            return ServiceUtil.returnError(UtilProperties.getMessage(resource,
>> -                    "AccountingSecurityPayPaymentWasNotSent", locale));
>> -        } else {
>> -            if (payment.getCount() == 1){
>> -                Txn resp = payment.getTxn(0);
>> -                boolean approved = resp.getApproved();
>> -                if (approved == false){
>> -                    result.put("captureResult", false);
>> -                    result.put("captureRefNum", authTransaction.getString("referenceNum"));
>> -                    result.put("captureAmount", BigDecimal.ZERO);
>> -                } else {
>> -                    result.put("captureResult", true);
>> -                    result.put("captureAmount", captureAmount);
>> -                    result.put("captureRefNum", resp.getTxnId());
>> -                }
>> -                result.put("captureFlag", "C");
>> -                result.put("captureCode", resp.getResponseCode());
>> -                result.put("captureMessage", resp.getResponseText());
>> -            }
>> -        }
>> -        return result;
>> -    }
>> -
>> -    public static Map<String, Object> doVoid(DispatchContext dctx, Map<String, Object> context) {
>> -        Locale locale = (Locale) context.get("locale");
>> -        Delegator delegator = dctx.getDelegator();
>> -        GenericValue orderPaymentPreference = (GenericValue) context.get("orderPaymentPreference");
>> -        GenericValue authTransaction = (GenericValue) context.get("authTrans");
>> -        if (authTransaction == null) {
>> -            authTransaction = PaymentGatewayServices.getAuthTransaction(orderPaymentPreference);
>> -        }
>> -        if (authTransaction == null) {
>> -            return ServiceUtil.returnError(UtilProperties.getMessage(resource,
>> - "AccountingPaymentTransactionAuthorizationNotFoundCannotRelease", locale));
>> -        }
>> -
>> -        Properties props = buildScProperties(context, delegator);
>> -        if (props == null) {
>> -            return ServiceUtil.returnError(UtilProperties.getMessage(resource,
>> - "AccountingSecurityPayNotProperlyConfigurated", locale));
>> -        }
>> -
>> -        String merchantId = props.getProperty("merchantID");
>> -        String serverURL = props.getProperty("serverurl");
>> -        String processtimeout = props.getProperty("processtimeout");
>> -        String pwd = props.getProperty("pwd");
>> -        String enableamountround = props.getProperty("enableamountround");
>> -        String currency = authTransaction.getString("currencyUomId");
>> -        BigDecimal releaseAmount = (BigDecimal) context.get("releaseAmount");
>> -        BigDecimal multiplyAmount = new BigDecimal(100);
>> -        BigDecimal newAmount = null;
>> -        int amont;
>> -
>> -        if (enableamountround.equals("Y")) {
>> -            newAmount = new BigDecimal(releaseAmount.setScale(0, BigDecimal.ROUND_HALF_UP)+".00");
>> -        } else {
>> -            newAmount = releaseAmount;
>> -        }
>> -
>> -        if (currency.equals("JPY")) {
>> -            amont = newAmount.intValue();
>> -        } else {
>> -            amont = newAmount.multiply(multiplyAmount).intValue();
>> -        }
>> -
>> -        Payment payment = new Payment();
>> -        payment.setServerURL(serverURL);
>> - payment.setProcessTimeout(Integer.valueOf(processtimeout));
>> -        payment.setMerchantId(merchantId);
>> -        Txn txn = payment.addTxn(6, (String) orderPaymentPreference.get("orderId"));
>> -        txn.setTxnSource(8);
>> -        txn.setAmount(Integer.toString(amont));
>> - txn.setTxnId(authTransaction.getString("referenceNum"));
>> -
>> -        // Send payment to SecurePay for processing
>> -        boolean processed = payment.process(pwd);
>> -
>> -        Map<String, Object> result = ServiceUtil.returnSuccess();
>> -        if (UtilValidate.isEmpty(processed)) {
>> -            return ServiceUtil.returnError(UtilProperties.getMessage(resource,
>> -                    "AccountingSecurityPayPaymentWasNotSent", locale));
>> -        } else {
>> -            if (payment.getCount() == 1){
>> -                Txn resp = payment.getTxn(0);
>> -                boolean approved = resp.getApproved();
>> -                if (approved == false){
>> -                    result.put("releaseResult", false);
>> -                    result.put("releaseRefNum", authTransaction.getString("referenceNum"));
>> -                    result.put("releaseAmount", BigDecimal.ZERO);
>> -                } else {
>> -                    result.put("releaseResult", true);
>> -                    result.put("releaseAmount", releaseAmount);
>> -                    result.put("releaseRefNum", resp.getTxnId());
>> -                }
>> -                result.put("releaseFlag", "U");
>> -                result.put("releaseCode", resp.getResponseCode());
>> -                result.put("releaseMessage", resp.getResponseText());
>> -            }
>> -        }
>> -        return result;
>> -    }
>> -
>> -    public static Map<String, Object> doRefund(DispatchContext dctx, Map<String, Object> context) {
>> -        Locale locale = (Locale) context.get("locale");
>> -        Delegator delegator = dctx.getDelegator();
>> -        GenericValue orderPaymentPreference = (GenericValue) context.get("orderPaymentPreference");
>> -        GenericValue authTransaction = PaymentGatewayServices.getAuthTransaction(orderPaymentPreference);
>> -        if (authTransaction == null) {
>> -            return ServiceUtil.returnError(UtilProperties.getMessage(resource,
>> - "AccountingPaymentTransactionAuthorizationNotFoundCannotRefund", locale));
>> -        }
>> -
>> -        String referenceNum = null;
>> -        try {
>> -            GenericValue paymentGatewayResponse = EntityQuery.use(delegator).from("PaymentGatewayResponse")
>> -                    .where("orderPaymentPreferenceId", authTransaction.get("orderPaymentPreferenceId"),
>> -                            "paymentServiceTypeEnumId", "PRDS_PAY_CAPTURE")
>> -                    .queryFirst();
>> -            referenceNum = paymentGatewayResponse != null ? paymentGatewayResponse.get("referenceNum") : authTransaction.getString("referenceNum");
>> -        } catch (GenericEntityException e) {
>> -            e.printStackTrace();
>> -        }
>> -
>> -        Properties props = buildScProperties(context, delegator);
>> -        if (props == null) {
>> -            return ServiceUtil.returnError(UtilProperties.getMessage(resource,
>> - "AccountingSecurityPayNotProperlyConfigurated", locale));
>> -        }
>> -
>> -        String merchantId = props.getProperty("merchantID");
>> -        String serverURL = props.getProperty("serverurl");
>> -        String processtimeout = props.getProperty("processtimeout");
>> -        String pwd = props.getProperty("pwd");
>> -        String enableamountround = props.getProperty("enableamountround");
>> -        String currency = authTransaction.getString("currencyUomId");
>> -        BigDecimal refundAmount = (BigDecimal) context.get("refundAmount");
>> -        BigDecimal multiplyAmount = new BigDecimal(100);
>> -        BigDecimal newAmount = null;
>> -
>> -        if (enableamountround.equals("Y")) {
>> -            newAmount = new BigDecimal(refundAmount.setScale(0, BigDecimal.ROUND_HALF_UP)+".00");
>> -        } else {
>> -            newAmount = refundAmount;
>> -        }
>> -
>> -        int amont;
>> -        if (currency.equals("JPY")) {
>> -            amont = newAmount.intValue();
>> -        } else {
>> -            amont = newAmount.multiply(multiplyAmount).intValue();
>> -        }
>> -
>> -        Payment payment = new Payment();
>> -        payment.setServerURL(serverURL);
>> - payment.setProcessTimeout(Integer.valueOf(processtimeout));
>> -        payment.setMerchantId(merchantId);
>> -        Txn txn = payment.addTxn(4, (String) orderPaymentPreference.get("orderId"));
>> -        txn.setTxnSource(8);
>> -        txn.setAmount(Integer.toString(amont));
>> -        txn.setTxnId(referenceNum);
>> -
>> -        // Send payment to SecurePay for processing
>> -        boolean processed = payment.process(pwd);
>> -
>> -        Map<String, Object> result = ServiceUtil.returnSuccess();
>> -        if (UtilValidate.isEmpty(processed)) {
>> -            return ServiceUtil.returnError(UtilProperties.getMessage(resource,
>> -                    "AccountingSecurityPayPaymentWasNotSent", locale));
>> -        } else {
>> -            if (payment.getCount() == 1){
>> -                Txn resp = payment.getTxn(0);
>> -                boolean approved = resp.getApproved();
>> -                if (approved == false){
>> -                    result.put("refundResult", false);
>> -                    result.put("refundRefNum", authTransaction.getString("referenceNum"));
>> -                    result.put("refundAmount", BigDecimal.ZERO);
>> -                } else {
>> -                    result.put("refundResult", true);
>> -                    result.put("refundAmount", refundAmount);
>> -                    result.put("refundRefNum", resp.getTxnId());
>> -                }
>> -                result.put("refundCode", resp.getResponseCode());
>> -                result.put("refundMessage", resp.getResponseText());
>> -                result.put("refundFlag", "R");
>> -            }
>> -        }
>> -        return result;
>> -    }
>> -
>> -    public static Map<String, Object> doCredit(DispatchContext dctx, Map<String, Object> context) {
>> -        Locale locale = (Locale) context.get("locale");
>> -        Delegator delegator = dctx.getDelegator();
>> -        // generate the request/properties
>> -        Properties props = buildScProperties(context, delegator);
>> -        if (props == null) {
>> -            return ServiceUtil.returnError(UtilProperties.getMessage(resource,
>> - "AccountingSecurityPayNotProperlyConfigurated", locale));
>> -        }
>> -
>> -        String merchantId = props.getProperty("merchantID");
>> -        String serverURL = props.getProperty("serverurl");
>> -        String processtimeout = props.getProperty("processtimeout");
>> -        String pwd = props.getProperty("pwd");
>> -        String enableamountround = props.getProperty("enableamountround");
>> -        String referenceCode = (String) context.get("referenceCode");
>> -        String currency = (String) context.get("currency");
>> -        String cardSecurityCode = (String) context.get("cardSecurityCode");
>> -        BigDecimal creditAmount = (BigDecimal) context.get("creditAmount");
>> -        BigDecimal multiplyAmount = new BigDecimal(100);
>> -        BigDecimal newAmount = null;
>> -        int amont;
>> -
>> -        if (enableamountround.equals("Y")) {
>> -            newAmount = new BigDecimal(creditAmount.setScale(0, BigDecimal.ROUND_HALF_UP)+".00");
>> -        } else {
>> -            newAmount = creditAmount;
>> -        }
>> -
>> -        if (currency.equals("JPY")) {
>> -            amont = newAmount.intValue();
>> -        } else {
>> -            amont = newAmount.multiply(multiplyAmount).intValue();
>> -        }
>> -
>> -        GenericValue creditCard = (GenericValue) context.get("creditCard");
>> -        Payment payment = new Payment();
>> -        payment.setServerURL(serverURL);
>> - payment.setProcessTimeout(Integer.valueOf(processtimeout));
>> -        payment.setMerchantId(merchantId);
>> -
>> -        Txn txn = payment.addTxn(0, referenceCode);
>> -        txn.setTxnSource(8);
>> -        txn.setAmount(Integer.toString(amont));
>> -        txn.setCardNumber((String) creditCard.get("cardNumber"));
>> -        String expiryDate = (String) creditCard.get("expireDate");
>> -        txn.setExpiryDate(expiryDate.substring(0, 3) + expiryDate.substring(5));
>> -        if (UtilValidate.isNotEmpty(cardSecurityCode)) {
>> -            txn.setCVV(cardSecurityCode);
>> -        }
>> -
>> -        // Send payment to SecurePay for processing
>> -        boolean processed = payment.process(pwd);
>> -
>> -        Map<String, Object> result = ServiceUtil.returnSuccess();
>> -        if (UtilValidate.isEmpty(processed)) {
>> -            return ServiceUtil.returnError(UtilProperties.getMessage(resource,
>> -                    "AccountingSecurityPayPaymentWasNotSent", locale));
>> -        } else {
>> -            if (payment.getCount() == 1) {
>> -                Txn resp = payment.getTxn(0);
>> -                boolean approved = resp.getApproved();
>> -                if (approved == false){
>> -                    result.put("creditResult", false);
>> -                    result.put("creditRefNum", "N/A");
>> -                    result.put("creditAmount", BigDecimal.ZERO);
>> -                } else {
>> -                    result.put("creditResult", true);
>> -                    result.put("creditAmount", creditAmount);
>> -                    result.put("creditRefNum", resp.getTxnId());
>> -                }
>> -                result.put("creditCode", resp.getResponseCode());
>> -                result.put("creditMessage", resp.getResponseText());
>> -            }
>> -        }
>> -        return result;
>> -    }
>> -
>> -    private static Properties buildScProperties(Map<String, ? extends Object> context, Delegator delegator) {
>> -        String paymentGatewayConfigId = (String) context.get("paymentGatewayConfigId");
>> -        String configString = (String) context.get("paymentConfig");
>> -        if (configString == null) {
>> -            configString = "payment.properties";
>> -        }
>> -
>> -        String merchantId = getPaymentGatewayConfigValue(delegator, paymentGatewayConfigId, "merchantId", configString, 
>> "payment.securepay.merchantID", null);
>> -        String pwd = getPaymentGatewayConfigValue(delegator, paymentGatewayConfigId, "pwd", configString, "payment.securepay.pwd", null);
>> -        String serverURL = getPaymentGatewayConfigValue(delegator, paymentGatewayConfigId, "serverURL", configString, 
>> "payment.securepay.serverurl", null);
>> -        String processTimeout = getPaymentGatewayConfigValue(delegator, paymentGatewayConfigId, "processTimeout", configString, 
>> "payment.securepay.processtimeout", null);
>> -        String enableAmountRound = getPaymentGatewayConfigValue(delegator, paymentGatewayConfigId, "enableAmountRound", configString, 
>> "payment.securepay.enableamountround", null);
>> -
>> -        Properties props = new Properties();
>> -        props.put("merchantID", merchantId);
>> -        props.put("pwd", pwd);
>> -        props.put("serverurl", serverURL);
>> -        props.put("processtimeout", processTimeout);
>> -        props.put("enableamountround", enableAmountRound);
>> -        return props;
>> -    }
>> -
>> -    private static String getPaymentGatewayConfigValue(Delegator delegator, String paymentGatewayConfigId, String 
>> paymentGatewayConfigParameterName,String resource, String parameterName) {
>> -        String returnValue = "";
>> -        if (UtilValidate.isNotEmpty(paymentGatewayConfigId)) {
>> -            try {
>> -                GenericValue securePay = EntityQuery.use(delegator).from("PaymentGatewaySecurePay").where("paymentGatewayConfigId", 
>> paymentGatewayConfigId).queryOne();
>> -                if (UtilValidate.isNotEmpty(securePay)) {
>> -                    Object securePayField = securePay.get(paymentGatewayConfigParameterName);
>> -                    if (securePayField != null) {
>> -                        returnValue = securePayField.toString().trim();
>> -                    }
>> -                }
>> -            } catch (GenericEntityException e) {
>> -                Debug.logError(e, module);
>> -            }
>> -        } else {
>> -            String value = EntityUtilProperties.getPropertyValue(resource, parameterName, delegator);
>> -            if (value != null) {
>> -                returnValue = value.trim();
>> -            }
>> -        }
>> -        return returnValue;
>> -    }
>> -
>> -    private static String getPaymentGatewayConfigValue(Delegator delegator, String paymentGatewayConfigId, String 
>> paymentGatewayConfigParameterName,String resource, String parameterName, String defaultValue) {
>> -        String returnValue = getPaymentGatewayConfigValue(delegator, paymentGatewayConfigId, paymentGatewayConfigParameterName, resource, 
>> parameterName);
>> -        if (UtilValidate.isEmpty(returnValue)) {
>> -            returnValue = defaultValue;
>> -        }
>> -        return returnValue;
>> -    }
>> +/*******************************************************************************
>> + * Licensed to the Apache Software Foundation (ASF) under one
>> + * or more contributor license agreements.  See the NOTICE file
>> + * distributed with this work for additional information
>> + * regarding copyright ownership.  The ASF licenses this file
>> + * 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
>> + * KIND, either express or implied.  See the License for the
>> + * specific language governing permissions and limitations
>> + * under the License.
>> + *******************************************************************************/
>> +package org.ofbiz.accounting.thirdparty.securepay;
>> +
>> +import java.math.BigDecimal;
>> +import java.util.List;
>> +import java.util.Locale;
>> +import java.util.Map;
>> +import java.util.Properties;
>> +
>> +import org.ofbiz.accounting.payment.PaymentGatewayServices;
>> +import org.ofbiz.base.util.Debug;
>> +import org.ofbiz.base.util.UtilMisc;
>> +import org.ofbiz.base.util.UtilProperties;
>> +import org.ofbiz.base.util.UtilValidate;
>> +import org.ofbiz.entity.Delegator;
>> +import org.ofbiz.entity.GenericEntityException;
>> +import org.ofbiz.entity.GenericValue;
>> +import org.ofbiz.entity.util.EntityQuery;
>> +import org.ofbiz.entity.util.EntityUtilProperties;
>> +import org.ofbiz.service.DispatchContext;
>> +import org.ofbiz.service.ServiceUtil;
>> +
>> +import securepay.jxa.api.Payment;
>> +import securepay.jxa.api.Txn;
>> +
>> +public class SecurePayPaymentServices {
>> +
>> +    public static final String module = SecurePayPaymentServices.class.getName();
>> +    public final static String resource = "AccountingUiLabels";
>> +
>> +    public static Map<String, Object> doAuth(DispatchContext dctx, Map<String, Object> context) {
>> +        Locale locale = (Locale) context.get("locale");
>> +        Delegator delegator = dctx.getDelegator();
>> +        String orderId = (String) context.get("orderId");
>> +        BigDecimal processAmount = (BigDecimal) context.get("processAmount");
>> +        // generate the request/properties
>> +        Properties props = buildScProperties(context, delegator);
>> +        if (props == null) {
>> +            return ServiceUtil.returnError(UtilProperties.getMessage(resource,
>> + "AccountingSecurityPayNotProperlyConfigurated", locale));
>> +        }
>> +
>> +        String merchantId = props.getProperty("merchantID");
>> +        String serverURL = props.getProperty("serverurl");
>> +        String processtimeout = props.getProperty("processtimeout");
>> +        String pwd = props.getProperty("pwd");
>> +        String enableamountround = props.getProperty("enableamountround");
>> +        String currency = (String) context.get("currency");
>> +        BigDecimal multiplyAmount = new BigDecimal(100);
>> +        BigDecimal newAmount = null;
>> +        int amont;
>> +
>> +        if (enableamountround.equals("Y")) {
>> +            newAmount = new BigDecimal(processAmount.setScale(0, BigDecimal.ROUND_HALF_UP)+".00");
>> +        } else {
>> +            newAmount = processAmount;
>> +        }
>> +
>> +        if (currency.equals("JPY")) {
>> +            amont = newAmount.intValue();
>> +        } else {
>> +            amont = newAmount.multiply(multiplyAmount).intValue();
>> +        }
>> +
>> +        GenericValue creditCard = (GenericValue) context.get("creditCard");
>> +        String expiryDate = (String) creditCard.get("expireDate");
>> +        String cardSecurityCode = (String) context.get("cardSecurityCode");
>> +        Payment payment = new Payment();
>> +        payment.setServerURL(serverURL);
>> + payment.setProcessTimeout(Integer.valueOf(processtimeout));
>> +        payment.setMerchantId(merchantId);
>> +
>> +        Txn txn = payment.addTxn(10, orderId);
>> +        txn.setTxnSource(8);
>> +        txn.setAmount(Integer.toString(amont));
>> +        if (UtilValidate.isNotEmpty(currency)) {
>> +            txn.setCurrencyCode(currency);
>> +        } else {
>> +            txn.setCurrencyCode("AUD");
>> +        }
>> +
>> +        txn.setCardNumber((String) creditCard.get("cardNumber"));
>> +        txn.setExpiryDate(expiryDate.substring(0, 3) + expiryDate.substring(5));
>> +        if (UtilValidate.isNotEmpty(cardSecurityCode)) {
>> +            txn.setCVV(cardSecurityCode);
>> +        }
>> +        // Send payment to SecurePay for processing
>> +        boolean processed = payment.process(pwd);
>> +
>> +        Map<String, Object> result = ServiceUtil.returnSuccess();
>> +        if (UtilValidate.isEmpty(processed)) {
>> +            return ServiceUtil.returnError(UtilProperties.getMessage(resource,
>> +                    "AccountingSecurityPayPaymentWasNotSent", locale));
>> +        } else {
>> +            if (payment.getCount() == 1) {
>> +                Txn resp = payment.getTxn(0);
>> +                boolean approved = resp.getApproved();
>> +                if (approved == false){
>> +                    result.put("authResult", new Boolean(false));
>> +                    result.put("authRefNum", "N/A");
>> +                    result.put("processAmount", BigDecimal.ZERO);
>> +                } else {
>> +                    result.put("authRefNum", resp.getTxnId());
>> +                    result.put("authResult", new Boolean(true));
>> +                    result.put("processAmount", processAmount);
>> +                }
>> +                result.put("authCode", resp.getResponseCode());
>> +                result.put("authMessage", resp.getResponseText());
>> +            }
>> +        }
>> +        return result;
>> +    }
>> +
>> +    public static Map<String, Object> ccReAuth(DispatchContext dctx, Map<String, ? extends Object> context) {
>> +        return ServiceUtil.returnSuccess();
>> +    }
>> +
>> +    public static Map<String, Object> doCapture(DispatchContext dctx, Map<String, Object> context) {
>> +        Locale locale = (Locale) context.get("locale");
>> +        Delegator delegator = dctx.getDelegator();
>> +        GenericValue orderPaymentPreference = (GenericValue) context.get("orderPaymentPreference");
>> +        GenericValue authTransaction = (GenericValue) context.get("authTrans");
>> +        if (authTransaction == null) {
>> +            authTransaction = PaymentGatewayServices.getAuthTransaction(orderPaymentPreference);
>> +        }
>> +        if (authTransaction == null) {
>> +            return ServiceUtil.returnError(UtilProperties.getMessage(resource,
>> + "AccountingPaymentTransactionAuthorizationNotFoundCannotCapture", locale));
>> +        }
>> +
>> +        Properties props = buildScProperties(context, delegator);
>> +        if (props == null) {
>> +            return ServiceUtil.returnError(UtilProperties.getMessage(resource,
>> + "AccountingSecurityPayNotProperlyConfigurated", locale));
>> +        }
>> +
>> +        String merchantId = props.getProperty("merchantID");
>> +        String serverURL = props.getProperty("serverurl");
>> +        String processtimeout = props.getProperty("processtimeout");
>> +        String pwd = props.getProperty("pwd");
>> +        String enableamountround = props.getProperty("enableamountround");
>> +        String currency = authTransaction.getString("currencyUomId");
>> +        BigDecimal captureAmount = (BigDecimal) context.get("captureAmount");
>> +        BigDecimal multiplyAmount = new BigDecimal(100);
>> +        BigDecimal newAmount = null;
>> +        int amont;
>> +
>> +        if (enableamountround.equals("Y")) {
>> +            newAmount = new BigDecimal(captureAmount.setScale(0, BigDecimal.ROUND_HALF_UP)+".00");
>> +        } else {
>> +            newAmount = captureAmount;
>> +        }
>> +
>> +        if (currency.equals("JPY")) {
>> +            amont = newAmount.intValue();
>> +        } else {
>> +            amont = newAmount.multiply(multiplyAmount).intValue();
>> +        }
>> +
>> +        Payment payment = new Payment();
>> +        payment.setServerURL(serverURL);
>> + payment.setProcessTimeout(Integer.valueOf(processtimeout));
>> +        payment.setMerchantId(merchantId);
>> +        Txn txn = payment.addTxn(11, (String) orderPaymentPreference.get("orderId"));
>> +        txn.setTxnSource(8);
>> +        txn.setAmount(Integer.toString(amont));
>> + txn.setPreauthId(authTransaction.getString("referenceNum"));
>> +
>> +        // Send payment to SecurePay for processing
>> +        boolean processed = payment.process(pwd);
>> +
>> +        Map<String, Object> result = ServiceUtil.returnSuccess();
>> +        if (UtilValidate.isEmpty(processed)) {
>> +            return ServiceUtil.returnError(UtilProperties.getMessage(resource,
>> +                    "AccountingSecurityPayPaymentWasNotSent", locale));
>> +        } else {
>> +            if (payment.getCount() == 1){
>> +                Txn resp = payment.getTxn(0);
>> +                boolean approved = resp.getApproved();
>> +                if (approved == false){
>> +                    result.put("captureResult", false);
>> +                    result.put("captureRefNum", authTransaction.getString("referenceNum"));
>> +                    result.put("captureAmount", BigDecimal.ZERO);
>> +                } else {
>> +                    result.put("captureResult", true);
>> +                    result.put("captureAmount", captureAmount);
>> +                    result.put("captureRefNum", resp.getTxnId());
>> +                }
>> +                result.put("captureFlag", "C");
>> +                result.put("captureCode", resp.getResponseCode());
>> +                result.put("captureMessage", resp.getResponseText());
>> +            }
>> +        }
>> +        return result;
>> +    }
>> +
>> +    public static Map<String, Object> doVoid(DispatchContext dctx, Map<String, Object> context) {
>> +        Locale locale = (Locale) context.get("locale");
>> +        Delegator delegator = dctx.getDelegator();
>> +        GenericValue orderPaymentPreference = (GenericValue) context.get("orderPaymentPreference");
>> +        GenericValue authTransaction = (GenericValue) context.get("authTrans");
>> +        if (authTransaction == null) {
>> +            authTransaction = PaymentGatewayServices.getAuthTransaction(orderPaymentPreference);
>> +        }
>> +        if (authTransaction == null) {
>> +            return ServiceUtil.returnError(UtilProperties.getMessage(resource,
>> + "AccountingPaymentTransactionAuthorizationNotFoundCannotRelease", locale));
>> +        }
>> +
>> +        Properties props = buildScProperties(context, delegator);
>> +        if (props == null) {
>> +            return ServiceUtil.returnError(UtilProperties.getMessage(resource,
>> + "AccountingSecurityPayNotProperlyConfigurated", locale));
>> +        }
>> +
>> +        String merchantId = props.getProperty("merchantID");
>> +        String serverURL = props.getProperty("serverurl");
>> +        String processtimeout = props.getProperty("processtimeout");
>> +        String pwd = props.getProperty("pwd");
>> +        String enableamountround = props.getProperty("enableamountround");
>> +        String currency = authTransaction.getString("currencyUomId");
>> +        BigDecimal releaseAmount = (BigDecimal) context.get("releaseAmount");
>> +        BigDecimal multiplyAmount = new BigDecimal(100);
>> +        BigDecimal newAmount = null;
>> +        int amont;
>> +
>> +        if (enableamountround.equals("Y")) {
>> +            newAmount = new BigDecimal(releaseAmount.setScale(0, BigDecimal.ROUND_HALF_UP)+".00");
>> +        } else {
>> +            newAmount = releaseAmount;
>> +        }
>> +
>> +        if (currency.equals("JPY")) {
>> +            amont = newAmount.intValue();
>> +        } else {
>> +            amont = newAmount.multiply(multiplyAmount).intValue();
>> +        }
>> +
>> +        Payment payment = new Payment();
>> +        payment.setServerURL(serverURL);
>> + payment.setProcessTimeout(Integer.valueOf(processtimeout));
>> +        payment.setMerchantId(merchantId);
>> +        Txn txn = payment.addTxn(6, (String) orderPaymentPreference.get("orderId"));
>> +        txn.setTxnSource(8);
>> +        txn.setAmount(Integer.toString(amont));
>> + txn.setTxnId(authTransaction.getString("referenceNum"));
>> +
>> +        // Send payment to SecurePay for processing
>> +        boolean processed = payment.process(pwd);
>> +
>> +        Map<String, Object> result = ServiceUtil.returnSuccess();
>> +        if (UtilValidate.isEmpty(processed)) {
>> +            return ServiceUtil.returnError(UtilProperties.getMessage(resource,
>> +                    "AccountingSecurityPayPaymentWasNotSent", locale));
>> +        } else {
>> +            if (payment.getCount() == 1){
>> +                Txn resp = payment.getTxn(0);
>> +                boolean approved = resp.getApproved();
>> +                if (approved == false){
>> +                    result.put("releaseResult", false);
>> +                    result.put("releaseRefNum", authTransaction.getString("referenceNum"));
>> +                    result.put("releaseAmount", BigDecimal.ZERO);
>> +                } else {
>> +                    result.put("releaseResult", true);
>> +                    result.put("releaseAmount", releaseAmount);
>> +                    result.put("releaseRefNum", resp.getTxnId());
>> +                }
>> +                result.put("releaseFlag", "U");
>> +                result.put("releaseCode", resp.getResponseCode());
>> +                result.put("releaseMessage", resp.getResponseText());
>> +            }
>> +        }
>> +        return result;
>> +    }
>> +
>> +    public static Map<String, Object> doRefund(DispatchContext dctx, Map<String, Object> context) {
>> +        Locale locale = (Locale) context.get("locale");
>> +        Delegator delegator = dctx.getDelegator();
>> +        GenericValue orderPaymentPreference = (GenericValue) context.get("orderPaymentPreference");
>> +        GenericValue authTransaction = PaymentGatewayServices.getAuthTransaction(orderPaymentPreference);
>> +        if (authTransaction == null) {
>> +            return ServiceUtil.returnError(UtilProperties.getMessage(resource,
>> + "AccountingPaymentTransactionAuthorizationNotFoundCannotRefund", locale));
>> +        }
>> +
>> +        String referenceNum = null;
>> +        try {
>> +            GenericValue paymentGatewayResponse = EntityQuery.use(delegator).from("PaymentGatewayResponse")
>> +                    .where("orderPaymentPreferenceId", authTransaction.get("orderPaymentPreferenceId"),
>> +                            "paymentServiceTypeEnumId", "PRDS_PAY_CAPTURE")
>> +                    .queryFirst();
>> +            referenceNum = paymentGatewayResponse != null ? paymentGatewayResponse.get("referenceNum") : authTransaction.getString("referenceNum");
>> +        } catch (GenericEntityException e) {
>> +            e.printStackTrace();
>> +        }
>> +
>> +        Properties props = buildScProperties(context, delegator);
>> +        if (props == null) {
>> +            return ServiceUtil.returnError(UtilProperties.getMessage(resource,
>> + "AccountingSecurityPayNotProperlyConfigurated", locale));
>> +        }
>> +
>> +        String merchantId = props.getProperty("merchantID");
>> +        String serverURL = props.getProperty("serverurl");
>> +        String processtimeout = props.getProperty("processtimeout");
>> +        String pwd = props.getProperty("pwd");
>> +        String enableamountround = props.getProperty("enableamountround");
>> +        String currency = authTransaction.getString("currencyUomId");
>> +        BigDecimal refundAmount = (BigDecimal) context.get("refundAmount");
>> +        BigDecimal multiplyAmount = new BigDecimal(100);
>> +        BigDecimal newAmount = null;
>> +
>> +        if (enableamountround.equals("Y")) {
>> +            newAmount = new BigDecimal(refundAmount.setScale(0, BigDecimal.ROUND_HALF_UP)+".00");
>> +        } else {
>> +            newAmount = refundAmount;
>> +        }
>> +
>> +        int amont;
>> +        if (currency.equals("JPY")) {
>> +            amont = newAmount.intValue();
>> +        } else {
>> +            amont = newAmount.multiply(multiplyAmount).intValue();
>> +        }
>> +
>> +        Payment payment = new Payment();
>> +        payment.setServerURL(serverURL);
>> + payment.setProcessTimeout(Integer.valueOf(processtimeout));
>> +        payment.setMerchantId(merchantId);
>> +        Txn txn = payment.addTxn(4, (String) orderPaymentPreference.get("orderId"));
>> +        txn.setTxnSource(8);
>> +        txn.setAmount(Integer.toString(amont));
>> +        txn.setTxnId(referenceNum);
>> +
>> +        // Send payment to SecurePay for processing
>> +        boolean processed = payment.process(pwd);
>> +
>> +        Map<String, Object> result = ServiceUtil.returnSuccess();
>> +        if (UtilValidate.isEmpty(processed)) {
>> +            return ServiceUtil.returnError(UtilProperties.getMessage(resource,
>> +                    "AccountingSecurityPayPaymentWasNotSent", locale));
>> +        } else {
>> +            if (payment.getCount() == 1){
>> +                Txn resp = payment.getTxn(0);
>> +                boolean approved = resp.getApproved();
>> +                if (approved == false){
>> +                    result.put("refundResult", false);
>> +                    result.put("refundRefNum", authTransaction.getString("referenceNum"));
>> +                    result.put("refundAmount", BigDecimal.ZERO);
>> +                } else {
>> +                    result.put("refundResult", true);
>> +                    result.put("refundAmount", refundAmount);
>> +                    result.put("refundRefNum", resp.getTxnId());
>> +                }
>> +                result.put("refundCode", resp.getResponseCode());
>> +                result.put("refundMessage", resp.getResponseText());
>> +                result.put("refundFlag", "R");
>> +            }
>> +        }
>> +        return result;
>> +    }
>> +
>> +    public static Map<String, Object> doCredit(DispatchContext dctx, Map<String, Object> context) {
>> +        Locale locale = (Locale) context.get("locale");
>> +        Delegator delegator = dctx.getDelegator();
>> +        // generate the request/properties
>> +        Properties props = buildScProperties(context, delegator);
>> +        if (props == null) {
>> +            return ServiceUtil.returnError(UtilProperties.getMessage(resource,
>> + "AccountingSecurityPayNotProperlyConfigurated", locale));
>> +        }
>> +
>> +        String merchantId = props.getProperty("merchantID");
>> +        String serverURL = props.getProperty("serverurl");
>> +        String processtimeout = props.getProperty("processtimeout");
>> +        String pwd = props.getProperty("pwd");
>> +        String enableamountround = props.getProperty("enableamountround");
>> +        String referenceCode = (String) context.get("referenceCode");
>> +        String currency = (String) context.get("currency");
>> +        String cardSecurityCode = (String) context.get("cardSecurityCode");
>> +        BigDecimal creditAmount = (BigDecimal) context.get("creditAmount");
>> +        BigDecimal multiplyAmount = new BigDecimal(100);
>> +        BigDecimal newAmount = null;
>> +        int amont;
>> +
>> +        if (enableamountround.equals("Y")) {
>> +            newAmount = new BigDecimal(creditAmount.setScale(0, BigDecimal.ROUND_HALF_UP)+".00");
>> +        } else {
>> +            newAmount = creditAmount;
>> +        }
>> +
>> +        if (currency.equals("JPY")) {
>> +            amont = newAmount.intValue();
>> +        } else {
>> +            amont = newAmount.multiply(multiplyAmount).intValue();
>> +        }
>> +
>> +        GenericValue creditCard = (GenericValue) context.get("creditCard");
>> +        Payment payment = new Payment();
>> +        payment.setServerURL(serverURL);
>> + payment.setProcessTimeout(Integer.valueOf(processtimeout));
>> +        payment.setMerchantId(merchantId);
>> +
>> +        Txn txn = payment.addTxn(0, referenceCode);
>> +        txn.setTxnSource(8);
>> +        txn.setAmount(Integer.toString(amont));
>> +        txn.setCardNumber((String) creditCard.get("cardNumber"));
>> +        String expiryDate = (String) creditCard.get("expireDate");
>> +        txn.setExpiryDate(expiryDate.substring(0, 3) + expiryDate.substring(5));
>> +        if (UtilValidate.isNotEmpty(cardSecurityCode)) {
>> +            txn.setCVV(cardSecurityCode);
>> +        }
>> +
>> +        // Send payment to SecurePay for processing
>> +        boolean processed = payment.process(pwd);
>> +
>> +        Map<String, Object> result = ServiceUtil.returnSuccess();
>> +        if (UtilValidate.isEmpty(processed)) {
>> +            return ServiceUtil.returnError(UtilProperties.getMessage(resource,
>> +                    "AccountingSecurityPayPaymentWasNotSent", locale));
>> +        } else {
>> +            if (payment.getCount() == 1) {
>> +                Txn resp = payment.getTxn(0);
>> +                boolean approved = resp.getApproved();
>> +                if (approved == false){
>> +                    result.put("creditResult", false);
>> +                    result.put("creditRefNum", "N/A");
>> +                    result.put("creditAmount", BigDecimal.ZERO);
>> +                } else {
>> +                    result.put("creditResult", true);
>> +                    result.put("creditAmount", creditAmount);
>> +                    result.put("creditRefNum", resp.getTxnId());
>> +                }
>> +                result.put("creditCode", resp.getResponseCode());
>> +                result.put("creditMessage", resp.getResponseText());
>> +            }
>> +        }
>> +        return result;
>> +    }
>> +
>> +    private static Properties buildScProperties(Map<String, ? extends Object> context, Delegator delegator) {
>> +        String paymentGatewayConfigId = (String) context.get("paymentGatewayConfigId");
>> +        String configString = (String) context.get("paymentConfig");
>> +        if (configString == null) {
>> +            configString = "payment.properties";
>> +        }
>> +
>> +        String merchantId = getPaymentGatewayConfigValue(delegator, paymentGatewayConfigId, "merchantId", configString, 
>> "payment.securepay.merchantID", null);
>> +        String pwd = getPaymentGatewayConfigValue(delegator, paymentGatewayConfigId, "pwd", configString, "payment.securepay.pwd", null);
>> +        String serverURL = getPaymentGatewayConfigValue(delegator, paymentGatewayConfigId, "serverURL", configString, 
>> "payment.securepay.serverurl", null);
>> +        String processTimeout = getPaymentGatewayConfigValue(delegator, paymentGatewayConfigId, "processTimeout", configString, 
>> "payment.securepay.processtimeout", null);
>> +        String enableAmountRound = getPaymentGatewayConfigValue(delegator, paymentGatewayConfigId, "enableAmountRound", configString, 
>> "payment.securepay.enableamountround", null);
>> +
>> +        Properties props = new Properties();
>> +        props.put("merchantID", merchantId);
>> +        props.put("pwd", pwd);
>> +        props.put("serverurl", serverURL);
>> +        props.put("processtimeout", processTimeout);
>> +        props.put("enableamountround", enableAmountRound);
>> +        return props;
>> +    }
>> +
>> +    private static String getPaymentGatewayConfigValue(Delegator delegator, String paymentGatewayConfigId, String 
>> paymentGatewayConfigParameterName,String resource, String parameterName) {
>> +        String returnValue = "";
>> +        if (UtilValidate.isNotEmpty(paymentGatewayConfigId)) {
>> +            try {
>> +                GenericValue securePay = EntityQuery.use(delegator).from("PaymentGatewaySecurePay").where("paymentGatewayConfigId", 
>> paymentGatewayConfigId).queryOne();
>> +                if (UtilValidate.isNotEmpty(securePay)) {
>> +                    Object securePayField = securePay.get(paymentGatewayConfigParameterName);
>> +                    if (securePayField != null) {
>> +                        returnValue = securePayField.toString().trim();
>> +                    }
>> +                }
>> +            } catch (GenericEntityException e) {
>> +                Debug.logError(e, module);
>> +            }
>> +        } else {
>> +            String value = EntityUtilProperties.getPropertyValue(resource, parameterName, delegator);
>> +            if (value != null) {
>> +                returnValue = value.trim();
>> +            }
>> +        }
>> +        return returnValue;
>> +    }
>> +
>> +    private static String getPaymentGatewayConfigValue(Delegator delegator, String paymentGatewayConfigId, String 
>> paymentGatewayConfigParameterName,String resource, String parameterName, String defaultValue) {
>> +        String returnValue = getPaymentGatewayConfigValue(delegator, paymentGatewayConfigId, paymentGatewayConfigParameterName, resource, 
>> parameterName);
>> +        if (UtilValidate.isEmpty(returnValue)) {
>> +            returnValue = defaultValue;
>> +        }
>> +        return returnValue;
>> +    }
>>   }
>> \ No newline at end of file
>>
>> Propchange: ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/thirdparty/securepay/SecurePayPaymentServices.java
>>              ('svn:eol-style' removed)
>>
>>
>