svn commit: r771419 - in /ofbiz/trunk/applications/accounting: config/ data/ entitydef/ script/org/ofbiz/accounting/payment/ servicedef/ src/org/ofbiz/accounting/thirdparty/authorizedotnet/ webapp/accounting/WEB-INF/ widget/

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

svn commit: r771419 - in /ofbiz/trunk/applications/accounting: config/ data/ entitydef/ script/org/ofbiz/accounting/payment/ servicedef/ src/org/ofbiz/accounting/thirdparty/authorizedotnet/ webapp/accounting/WEB-INF/ widget/

mrisaliti
Author: mrisaliti
Date: Mon May  4 20:00:11 2009
New Revision: 771419

URL: http://svn.apache.org/viewvc?rev=771419&view=rev
Log:
Support of Authorize Dot Net v3.1 and use the new Payment Gateway Config features (OFBIZ-2417)

Modified:
    ofbiz/trunk/applications/accounting/config/AccountingUiLabels.xml
    ofbiz/trunk/applications/accounting/config/payment.properties
    ofbiz/trunk/applications/accounting/data/AccountingTypeData.xml
    ofbiz/trunk/applications/accounting/entitydef/entitymodel.xml
    ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/payment/PaymentGatewayConfigServices.xml
    ofbiz/trunk/applications/accounting/servicedef/services_authorizedotnet.xml
    ofbiz/trunk/applications/accounting/servicedef/services_paymentgateway.xml
    ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/thirdparty/authorizedotnet/AIMPaymentServices.java
    ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/controller.xml
    ofbiz/trunk/applications/accounting/widget/PaymentGatewayConfigForms.xml
    ofbiz/trunk/applications/accounting/widget/PaymentGatewayConfigScreens.xml

Modified: ofbiz/trunk/applications/accounting/config/AccountingUiLabels.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/config/AccountingUiLabels.xml?rev=771419&r1=771418&r2=771419&view=diff
==============================================================================
--- ofbiz/trunk/applications/accounting/config/AccountingUiLabels.xml (original)
+++ ofbiz/trunk/applications/accounting/config/AccountingUiLabels.xml Mon May  4 20:00:11 2009
@@ -980,6 +980,50 @@
         <value xml:lang="th">มอบอำนาจ</value>
         <value xml:lang="zh">授权</value>
     </property>
+    <property key="AccountingAuthorizeNetApiVersion">
+        <value xml:lang="en">Authorize Dot Net API Version</value>
+        <value xml:lang="it">Versione API Authorize Dot Net</value>
+    </property>
+    <property key="AccountingAuthorizeNetDelimiterChar">
+        <value xml:lang="en">Delimited Char</value>
+        <value xml:lang="it">Carattere delimitatore</value>
+    </property>
+    <property key="AccountingAuthorizeNetDelimitedData">
+        <value xml:lang="en">Delimited Data</value>
+        <value xml:lang="it">Dati delimitati da un carattere</value>
+    </property>
+    <property key="AccountingAuthorizeNetEmailCustomer">
+        <value xml:lang="en">Email to Customer</value>
+        <value xml:lang="it">Email al cliente</value>
+    </property>
+    <property key="AccountingAuthorizeNetEmailMerchant">
+        <value xml:lang="en">Email to Merchant</value>
+        <value xml:lang="it">Email al negoziante</value>
+    </property>
+    <property key="AccountingAuthorizeNetMethod">
+        <value xml:lang="en">Method (only CC supported)</value>
+        <value xml:lang="it">Metodo (solo Carta di credito supportata)</value>
+    </property>
+    <property key="AccountingAuthorizeNetMethodCC">
+        <value xml:lang="en">CC</value>
+        <value xml:lang="it">Carta di credito</value>
+    </property>
+    <property key="AccountingAuthorizeNetRelayResponse">
+        <value xml:lang="en">Relay Response</value>
+        <value xml:lang="it">Trasmettere risposta</value>
+    </property>
+    <property key="AccountingAuthorizeNetTestMode">
+        <value xml:lang="en">Test Mode</value>
+        <value xml:lang="it">Modalità di test</value>
+    </property>
+    <property key="AccountingAuthorizeNetTransKey">
+        <value xml:lang="en">Transaction Key</value>
+        <value xml:lang="it">Chiave Transazione</value>
+    </property>
+    <property key="AccountingAuthorizeNetTransactionUrl">
+        <value xml:lang="en">Transaction URL</value>
+        <value xml:lang="it">URL Transazione</value>
+    </property>
     <property key="AccountingAvailableInternalOrganizations">
         <value xml:lang="ar">المؤسسات الداخلية المتوفرة</value>
         <value xml:lang="de">Verfügbare interne Organisationen</value>
@@ -10961,6 +11005,10 @@
         <value xml:lang="en">Update Payment Gateway Config Type</value>
         <value xml:lang="it">Aggiorna tipo configurazione gateway pagamento</value>
     </property>
+    <property key="PageTitleUpdatePaymentGatewayConfigAuthorizeNet">
+        <value xml:lang="en">Update Payment Gateway Config Authorize Dot Net</value>
+        <value xml:lang="it">Aggiorna configurazione gateway pagamento Authorize Dot Net</value>
+    </property>
     <property key="PageTitleUpdatePaymentGatewayConfigClearCommerce">
         <value xml:lang="en">Update Payment Gateway Config Clear Commerce</value>
         <value xml:lang="it">Aggiorna configurazione gateway pagamento Clear Commerce</value>

Modified: ofbiz/trunk/applications/accounting/config/payment.properties
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/config/payment.properties?rev=771419&r1=771418&r2=771419&view=diff
==============================================================================
--- ofbiz/trunk/applications/accounting/config/payment.properties (original)
+++ ofbiz/trunk/applications/accounting/config/payment.properties Mon May  4 20:00:11 2009
@@ -328,8 +328,11 @@
 # Test Url
 payment.authorizedotnet.url=https://certification.authorize.net/gateway/transact.dll
 
+# Certificate Alias
+payment.authorizedotnet.certificateAlias=certification.authorize.net-1
+
 # Version - version 3.0 is currently the only supported version for ofbiz. eventually version 3.1 may be available
-payment.authorizedotnet.version=3.0
+payment.authorizedotnet.version=3.1
 
 # Delimited data - if the authorize.net response should delimited (no need to change this)
 payment.authorizedotnet.delimited=TRUE
@@ -362,7 +365,7 @@
 payment.authorizedotnet.password=
 
 # Default Transaction Description
-payment.authorizedotnet.transdescription=OfbizAuthNet
+payment.authorizedotnet.transdescription=OFBizAuthNet
 
 # For testing authorize.net, set the properties
 # payment.authorizedotnet.url=https://certification.authorize.net/gateway/transact.dll

Modified: ofbiz/trunk/applications/accounting/data/AccountingTypeData.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/data/AccountingTypeData.xml?rev=771419&r1=771418&r2=771419&view=diff
==============================================================================
--- ofbiz/trunk/applications/accounting/data/AccountingTypeData.xml (original)
+++ ofbiz/trunk/applications/accounting/data/AccountingTypeData.xml Mon May  4 20:00:11 2009
@@ -666,6 +666,10 @@
     <PaymentType description="POS Paid In" hasTable="N" parentTypeId="RECEIPT" paymentTypeId="POS_PAID_IN"/>
 
     <!-- Payment Gateway Config -->
+    <PaymentGatewayConfigType paymentGatewayConfigTypeId="AUTHORIZE_NET" hasTable="N" description="Authorize Dot Net Payment Gateway"/>
+    <PaymentGatewayConfig paymentGatewayConfigId="AUTHORIZE_NET_CONFIG" paymentGatewayConfigTypeId="AUTHORIZE_NET" description="Authorize Dot Net Config"/>
+    <PaymentGatewayAuthorizeNet paymentGatewayConfigId="AUTHORIZE_NET_CONFIG" transactionUrl="https://certification.authorize.net/gateway/transact.dll" certificateAlias="certification.authorize.net-1" apiVersion="3.1" delimitedData="TRUE" delimiterChar="|" method="CC" emailCustomer="FALSE" emailMerchant="FALSE" testMode="TRUE" relayResponse="FALSE" tranKey="" userId="" pwd="" transDescription="OFBizAuthNet"/>
+    
     <PaymentGatewayConfigType paymentGatewayConfigTypeId="CYBERSOURCE" hasTable="N" description="CyberSource Payment Gateway"/>
     <PaymentGatewayConfig paymentGatewayConfigId="CYBERSOURCE_CONFIG" paymentGatewayConfigTypeId="CYBERSOURCE" description="CyberSource Config"/>
     <PaymentGatewayCyberSource paymentGatewayConfigId="CYBERSOURCE_CONFIG" merchantId="[MerchantID]" apiVersion="1.43" production="false" keysDir="${sys:getProperty('ofbiz.home')}/applications/accounting/icskeys" keysFile="merchantID.p12" logEnabled="true" logDir="${sys:getProperty('ofbiz.home')}/runtime/logs" logFile="cybersource.log" logSize="10" merchantDescr="Some Nice Web Store" merchantContact="" autoBill="false" enableDav="N" fraudScore="N" ignoreAvs="false" disableBillAvs="Y" avsDeclineCodes=""/>
@@ -705,8 +709,8 @@
     <CustomMethod customMethodId="CC_AUTH_TEST" customMethodTypeId="CC_AUTH" customMethodName="testCCProcessor" description="CC Test authorize"/>
     <CustomMethod customMethodId="CC_AUTH_CAPTURE_TST" customMethodTypeId="CC_AUTH" customMethodName="testCCProcessorWithCapture" description="CC Test authorize and capture"/>
     <CustomMethod customMethodId="CC_AUTH_RANDOM_TEST" customMethodTypeId="CC_AUTH" customMethodName="testRandomAuthorize" description="CC Test random authorize"/>
-    <CustomMethod customMethodId="CC_AUTH_AIM" customMethodTypeId="CC_AUTH" customMethodName="AIMCCAuth" description="CC Authorize dot net authorize"/>
-    <CustomMethod customMethodId="CC_AUTH_CAPTURE_AIM" customMethodTypeId="CC_AUTH" customMethodName="AIMCCAuthCapture" description="CC Authorize dot net authorize and capture"/>
+    <CustomMethod customMethodId="CC_AUTH_AIM" customMethodTypeId="CC_AUTH" customMethodName="aimCCAuth" description="CC Authorize dot net authorize"/>
+    <CustomMethod customMethodId="CC_AUTH_CAPTURE_AIM" customMethodTypeId="CC_AUTH" customMethodName="aimCCAuthCapture" description="CC Authorize dot net authorize and capture"/>
     <CustomMethod customMethodId="CC_AUTH_CLEARCOMMERC" customMethodTypeId="CC_AUTH" customMethodName="clearCommerceCCAuth" description="CC Clear Commerce authorize"/>
     <CustomMethod customMethodId="CC_AUTH_CLEARCOM_REP" customMethodTypeId="CC_AUTH" customMethodName="clearCommerceCCReport" description="CC Clear Commerce authorize reporting facility"/>
     <CustomMethod customMethodId="CC_AUTH_CYBERSOURCE" customMethodTypeId="CC_AUTH" customMethodName="cyberSourceCCAuth" description="CC CyberSource authorize"/>
@@ -726,7 +730,7 @@
     <CustomMethod customMethodId="CC_CAPTURE_TEST" customMethodTypeId="CC_CAPTURE" customMethodName="testCCCapture" description="CC Test capture"/>
     <CustomMethod customMethodId="CC_CAPTURE_REAUTH" customMethodTypeId="CC_CAPTURE" customMethodName="testCCCaptureWithReAuth" description="CC Test reauth capture"/>
     <CustomMethod customMethodId="CC_CAPTURE_ALWAYSDEC" customMethodTypeId="CC_CAPTURE" customMethodName="testCCProcessorCaptureAlwaysDecline" description="CC Always decline capture"/>
-    <CustomMethod customMethodId="CC_CAPTURE_AIM" customMethodTypeId="CC_CAPTURE" customMethodName="AIMCCCapture" description="CC Authorize dot net capture"/>
+    <CustomMethod customMethodId="CC_CAPTURE_AIM" customMethodTypeId="CC_CAPTURE" customMethodName="aimCCCapture" description="CC Authorize dot net capture"/>
     <CustomMethod customMethodId="CC_CAPTURE_CLEARCOMM" customMethodTypeId="CC_CAPTURE" customMethodName="clearCommerceCCCapture" description="CC Clear Commerce capture"/>
     <CustomMethod customMethodId="CC_CAPTURE_CYBERSOUR" customMethodTypeId="CC_CAPTURE" customMethodName="cyberSourceCCCapture" description="CC CyberSource capture"/>
     <CustomMethod customMethodId="CC_CAPTURE_PAYFLOW" customMethodTypeId="CC_CAPTURE" customMethodName="payflowCCCapture" description="CC Payflow Pro capture"/>
@@ -736,7 +740,7 @@
     
     <CustomMethod customMethodId="CC_REFUND_TEST" customMethodTypeId="CC_REFUND" customMethodName="testCCRefund" description="CC Test refund"/>
     <CustomMethod customMethodId="CC_REFUND_TEST_FAIL" customMethodTypeId="CC_REFUND" customMethodName="testCCRefundFailure" description="CC Test refund failure"/>
-    <CustomMethod customMethodId="CC_REFUND_AIM" customMethodTypeId="CC_REFUND" customMethodName="AIMCCRefund" description="CC Authorize dot net refund"/>
+    <CustomMethod customMethodId="CC_REFUND_AIM" customMethodTypeId="CC_REFUND" customMethodName="aimCCRefund" description="CC Authorize dot net refund"/>
     <CustomMethod customMethodId="CC_REFUND_CLEARCOMME" customMethodTypeId="CC_REFUND" customMethodName="clearCommerceCCRefund" description="CC Clear Commerce refund"/>
     <CustomMethod customMethodId="CC_REFUND_CYBERSOURC" customMethodTypeId="CC_REFUND" customMethodName="cyberSourceCCRefund" description="CC CyberSource refund"/>
     <CustomMethod customMethodId="CC_REFUND_PAYFLOW" customMethodTypeId="CC_REFUND" customMethodName="payflowCCRefund" description="CC Payflow Pro refund"/>
@@ -745,7 +749,7 @@
     <CustomMethod customMethodId="CC_REFUND_RITA_REMOT" customMethodTypeId="CC_REFUND" customMethodName="ritaCCRefundRemote" description="CC RiTA remote refund"/>
     
     <CustomMethod customMethodId="CC_RELEASE_TEST" customMethodTypeId="CC_RELEASE" customMethodName="testCCRelease" description="CC Test release"/>
-    <CustomMethod customMethodId="CC_RELEASE_AIM" customMethodTypeId="CC_RELEASE" customMethodName="AIMCCRelease" description="CC Authorize dot net release"/>
+    <CustomMethod customMethodId="CC_RELEASE_AIM" customMethodTypeId="CC_RELEASE" customMethodName="aimCCRelease" description="CC Authorize dot net release"/>
     <CustomMethod customMethodId="CC_RELEASE_CLEARCOMM" customMethodTypeId="CC_RELEASE" customMethodName="clearCommerceCCRelease" description="CC Clear Commerce release"/>
     <CustomMethod customMethodId="CC_RELEASE_CYBERSOUR" customMethodTypeId="CC_RELEASE" customMethodName="cyberSourceCCRelease" description="CC CyberSource release"/>
     <CustomMethod customMethodId="CC_RELEASE_PAYFLOW" customMethodTypeId="CC_RELEASE" customMethodName="payflowCCVoid" description="CC Payflow Pro release"/>
@@ -753,7 +757,7 @@
     <CustomMethod customMethodId="CC_RELEASE_RITA" customMethodTypeId="CC_RELEASE" customMethodName="ritaCCRelease" description="CC RiTA release"/>
     <CustomMethod customMethodId="CC_RELEASE_RITA_REMO" customMethodTypeId="CC_RELEASE" customMethodName="ritaCCReleaseRemote" description="CC RiTA remote release"/>
     
-    <CustomMethod customMethodId="CC_CREDIT_AIM" customMethodTypeId="CC_CREDIT" customMethodName="AIMCCCredit" description="CC Authorize dot net credit"/>
+    <CustomMethod customMethodId="CC_CREDIT_AIM" customMethodTypeId="CC_CREDIT" customMethodName="aimCCCredit" description="CC Authorize dot net credit"/>
     <CustomMethod customMethodId="CC_CREDIT_CLEARCOMME" customMethodTypeId="CC_CREDIT" customMethodName="clearCommerceCCCredit" description="CC Clear Commerce credit"/>
     <CustomMethod customMethodId="CC_CREDIT_CYBERSOURC" customMethodTypeId="CC_CREDIT" customMethodName="cyberSourceCCCredit" description="CC CyberSource credit"/>
     <CustomMethod customMethodId="CC_CREDIT_RITA" customMethodTypeId="CC_CREDIT" customMethodName="ritaCCCreditRefund" description="CC RiTA credit"/>

Modified: ofbiz/trunk/applications/accounting/entitydef/entitymodel.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/entitydef/entitymodel.xml?rev=771419&r1=771418&r2=771419&view=diff
==============================================================================
--- ofbiz/trunk/applications/accounting/entitydef/entitymodel.xml (original)
+++ ofbiz/trunk/applications/accounting/entitydef/entitymodel.xml Mon May  4 20:00:11 2009
@@ -2991,6 +2991,29 @@
         <key-map field-name="paymentGatewayConfigTypeId" rel-field-name="paymentGatewayConfigTypeId"/>
       </relation>
     </entity>
+    <entity entity-name="PaymentGatewayAuthorizeNet"
+            package-name="org.ofbiz.accounting.payment"
+            title="Authorize Dot Net Payment Gateway Configuration">
+      <field name="paymentGatewayConfigId" type="id-ne"></field>
+      <field name="transactionUrl" type="value"><description>Transaction URL</description></field>
+      <field name="certificateAlias" type="value"><description>Certificate Alias</description></field>
+      <field name="apiVersion" type="short-varchar"><description>Target Authorize Dot Net API version</description></field>
+      <field name="delimitedData" type="short-varchar"><description>Delimited data (TRUE|FALSE)</description></field>
+      <field name="delimiterChar" type="short-varchar"><description>Delimited Character - the delimiter to use in the response</description></field>
+      <field name="method" type="short-varchar"><description>Method - CC for credit card processing</description></field>
+      <field name="emailCustomer" type="short-varchar"><description>Email Customer? - if should send an email to the customer for each transaction (TRUE|FALSE)</description></field>
+      <field name="emailMerchant" type="short-varchar"><description>Email Merchant? - if should send email to the merchant for each transaction (TRUE|FALSE)</description></field>
+      <field name="testMode" type="short-varchar"><description>Test Mode - forces the url property to the test url and adds more logging info to the logs (TRUE|FALSE)</description></field>
+      <field name="relayResponse" type="short-varchar"><description>Relay Response? - if should relay the reposnse to a different server (TRUE|FALSE)</description></field>
+      <field name="tranKey" type="value" encrypt="true"><description>Transaction Key</description></field>
+      <field name="userId" type="value"><description>Username - your authorize.net userid</description></field>
+      <field name="pwd" type="value" encrypt="true"><description>Password - your authorize.net password</description></field>
+      <field name="transDescription" type="value"><description>Default Transaction Description</description></field>
+      <prim-key field="paymentGatewayConfigId"/>
+      <relation type="one" fk-name="PGAN_PGC" rel-entity-name="PaymentGatewayConfig">
+        <key-map field-name="paymentGatewayConfigId"/>
+      </relation>
+    </entity>
     <entity entity-name="PaymentGatewayCyberSource"
             package-name="org.ofbiz.accounting.payment"
             title="CyberSource Payment Gateway Configuration">

Modified: ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/payment/PaymentGatewayConfigServices.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/payment/PaymentGatewayConfigServices.xml?rev=771419&r1=771418&r2=771419&view=diff
==============================================================================
--- ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/payment/PaymentGatewayConfigServices.xml (original)
+++ ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/payment/PaymentGatewayConfigServices.xml Mon May  4 20:00:11 2009
@@ -26,6 +26,12 @@
         <store-value value-field="lookedUpValue"/>
     </simple-method>
     
+    <simple-method method-name="updatePaymentGatewayConfigAuthorizeNet" short-description="Update Payment Gateway Config Authorize Dot Net">
+        <entity-one entity-name="PaymentGatewayAuthorizeNet" value-field="lookedUpValue"/>
+        <set-nonpk-fields map="parameters" value-field="lookedUpValue"/>
+        <store-value value-field="lookedUpValue"/>
+    </simple-method>
+    
     <simple-method method-name="updatePaymentGatewayConfigClearCommerce" short-description="Update Payment Gateway Config Clear Commerce">
         <entity-one entity-name="PaymentGatewayClearCommerce" value-field="lookedUpValue"/>
         <set-nonpk-fields map="parameters" value-field="lookedUpValue"/>

Modified: ofbiz/trunk/applications/accounting/servicedef/services_authorizedotnet.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/servicedef/services_authorizedotnet.xml?rev=771419&r1=771418&r2=771419&view=diff
==============================================================================
--- ofbiz/trunk/applications/accounting/servicedef/services_authorizedotnet.xml (original)
+++ ofbiz/trunk/applications/accounting/servicedef/services_authorizedotnet.xml Mon May  4 20:00:11 2009
@@ -25,32 +25,32 @@
     <version>1.0</version>
 
     <!-- Authorize.NET Implementations -->
-    <service name="AIMCCAuth" engine="java"
+    <service name="aimCCAuth" engine="java"
             location="org.ofbiz.accounting.thirdparty.authorizedotnet.AIMPaymentServices" invoke="ccAuth">
         <description>Authorize.NET Payment Authorization</description>
         <implements service="ccAuthInterface"/>
     </service>
-    <service name="AIMCCAuthCapture" engine="java"
+    <service name="aimCCAuthCapture" engine="java"
             location="org.ofbiz.accounting.thirdparty.authorizedotnet.AIMPaymentServices" invoke="ccAuthCapture">
         <description>Authorize.NET Payment Authorize and Capture service</description>
         <implements service="ccAuthInterface"/>
     </service>
-    <service name="AIMCCCapture" engine="java"
+    <service name="aimCCCapture" engine="java"
             location="org.ofbiz.accounting.thirdparty.authorizedotnet.AIMPaymentServices" invoke="ccCapture">
         <description>Authorize.NET Payment Capture Service</description>
         <implements service="ccCaptureInterface"/>
     </service>
-    <service name="AIMCCRelease" engine="java"
+    <service name="aimCCRelease" engine="java"
             location="org.ofbiz.accounting.thirdparty.authorizedotnet.AIMPaymentServices" invoke="ccRelease">
         <description>Authorize.NET Payment Release Service - NOT IMPLEMENTED YET</description>
         <implements service="paymentReleaseInterface"/>
     </service>
-    <service name="AIMCCRefund" engine="java"
+    <service name="aimCCRefund" engine="java"
             location="org.ofbiz.accounting.thirdparty.authorizedotnet.AIMPaymentServices" invoke="ccRefund">
         <description>Authorize.NET Payment Refund Service</description>
         <implements service="paymentRefundInterface"/>
     </service>
-    <service name="AIMCCCredit" engine="java"
+    <service name="aimCCCredit" engine="java"
             location="org.ofbiz.accounting.thirdparty.authorizedotnet.AIMPaymentServices" invoke="ccCredit">
         <description>Authorize.NET Credit Service - NOT IMPLEMENTED YET</description>
         <implements service="ccCreditInterface"/>

Modified: ofbiz/trunk/applications/accounting/servicedef/services_paymentgateway.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/servicedef/services_paymentgateway.xml?rev=771419&r1=771418&r2=771419&view=diff
==============================================================================
--- ofbiz/trunk/applications/accounting/servicedef/services_paymentgateway.xml (original)
+++ ofbiz/trunk/applications/accounting/servicedef/services_paymentgateway.xml Mon May  4 20:00:11 2009
@@ -31,6 +31,12 @@
         <auto-attributes entity-name="PaymentGatewayConfig" include="nonpk" mode="IN" optional="true"/>
     </service>
     
+    <service name="updatePaymentGatewayConfigAuthorizeNet" engine="simple" location="org/ofbiz/accounting/payment/PaymentGatewayConfigServices.xml" invoke="updatePaymentGatewayConfigAuthorizeNet">
+        <description>Update Payment Gateway Config Authorize Dot Net</description>
+        <auto-attributes entity-name="PaymentGatewayAuthorizeNet" include="pk" mode="IN" optional="false"/>
+        <auto-attributes entity-name="PaymentGatewayAuthorizeNet" include="nonpk" mode="IN" optional="true"/>
+    </service>
+    
     <service name="updatePaymentGatewayConfigClearCommerce" engine="simple" location="org/ofbiz/accounting/payment/PaymentGatewayConfigServices.xml" invoke="updatePaymentGatewayConfigClearCommerce">
         <description>Update Payment Gateway Config Clear Commerce</description>
         <auto-attributes entity-name="PaymentGatewayClearCommerce" include="pk" mode="IN" optional="false"/>

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=771419&r1=771418&r2=771419&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 Mon May  4 20:00:11 2009
@@ -19,8 +19,24 @@
 
 package org.ofbiz.accounting.thirdparty.authorizedotnet;
 
+import java.math.BigDecimal;
+import java.sql.Timestamp;
+import java.util.Calendar;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+
+import javolution.util.FastMap;
+
 import org.ofbiz.accounting.payment.PaymentGatewayServices;
-import org.ofbiz.base.util.*;
+import org.ofbiz.base.util.Debug;
+import org.ofbiz.base.util.HttpClient;
+import org.ofbiz.base.util.HttpClientException;
+import org.ofbiz.base.util.UtilDateTime;
+import org.ofbiz.base.util.UtilFormatOut;
+import org.ofbiz.base.util.UtilMisc;
+import org.ofbiz.base.util.UtilProperties;
+import org.ofbiz.base.util.UtilValidate;
 import org.ofbiz.entity.GenericDelegator;
 import org.ofbiz.entity.GenericEntityException;
 import org.ofbiz.entity.GenericValue;
@@ -28,34 +44,27 @@
 import org.ofbiz.service.ModelService;
 import org.ofbiz.service.ServiceUtil;
 
-import java.math.BigDecimal;
-import java.sql.Timestamp;
-import java.util.*;
-
-
 public class AIMPaymentServices {
-
+    
     public static final String module = AIMPaymentServices.class.getName();
-
-    // TODO: Reformat the comments below to fit JavaDocs specs
-
+    
     // The list of refund failure response codes that would cause the ccRefund service
     // to attempt to void the refund's associated authorization transaction.  This list
     // contains the responses where the voiding does not need to be done within a certain
     // time limit
-    private static final List VOIDABLE_RESPONSES_NO_TIME_LIMIT = UtilMisc.toList("50");
-
+    private static final List<String> VOIDABLE_RESPONSES_NO_TIME_LIMIT = UtilMisc.toList("50");
+    
     // A list of refund failure response codes that would cause the ccRefund service
     // to first check whether the refund's associated authorization transaction has occurred
     // within a certain time limit, and if so, cause it to void the transaction
-    private static final List VOIDABLE_RESPONSES_TIME_LIMIT = UtilMisc.toList("54");
-
+    private static final List<String> VOIDABLE_RESPONSES_TIME_LIMIT = UtilMisc.toList("54");
+    
     // The number of days in the time limit when one can safely consider an unsettled
     // transaction to be still valid
     private static final int TIME_LIMIT_VERIFICATION_DAYS = 120;
-
+    
     private static Properties AIMProperties = null;
-
+    
     // A routine to check whether a given refund failure response code will cause the
     // ccRefund service to attempt to void the refund's associated authorization transaction
     private static boolean isVoidableResponse(String responseCode) {
@@ -63,38 +72,34 @@
             VOIDABLE_RESPONSES_NO_TIME_LIMIT.contains(responseCode) ||
             VOIDABLE_RESPONSES_TIME_LIMIT.contains(responseCode);
     }
-
-    public static Map ccAuth(DispatchContext ctx, Map context) {
-        Map results = ServiceUtil.returnSuccess();
-        Map request = new HashMap();
-
-        Properties props = buildAIMProperties(context);
-        buildMerchantInfo(context,props,request);
-        buildGatewayResponeConfig(context,props,request);
-        buildCustomerBillingInfo(context,props,request);
-        buildEmailSettings(context,props,request);
-        buildInvoiceInfo(context,props,request);
-        props.put("transType","AUTH_ONLY");
-        buildAuthTransaction(context,props,request);
-
-        Map validateResults = validateRequest(context,props,request);
+    
+    public static Map<String, Object> ccAuth(DispatchContext ctx, Map<String, Object> context) {
+        GenericDelegator delegator = ctx.getDelegator();
+        Map<String, Object> results = ServiceUtil.returnSuccess();
+        Map<String, Object> request = FastMap.newInstance();
+        Properties props = buildAIMProperties(context, delegator);
+        buildMerchantInfo(context, props, request);
+        buildGatewayResponeConfig(context, props, request);
+        buildCustomerBillingInfo(context, props, request);
+        buildEmailSettings(context, props, request);
+        buildInvoiceInfo(context, props, request);
+        props.put("transType", "AUTH_ONLY");
+        buildAuthTransaction(context, props, request);
+        Map<String, Object> validateResults = validateRequest(context, props, request);
         String respMsg = (String)validateResults.get(ModelService.RESPONSE_MESSAGE);
         if (ModelService.RESPOND_ERROR.equals(respMsg)) {
             results.put(ModelService.ERROR_MESSAGE, "Validation Failed - invalid values");
             return results;
         }
-
-        Map reply = processCard(request, props);
-
+        Map<String, Object> reply = processCard(request, props);
         //now we need to process the result
         processAuthTransResult(reply, results);
         return results;
     }
-
-    public static Map ccCapture(DispatchContext ctx, Map context) {
+    
+    public static Map<String, Object> ccCapture(DispatchContext ctx, Map<String, Object> context) {
         GenericDelegator delegator = ctx.getDelegator();
         GenericValue orderPaymentPreference = (GenericValue) context.get("orderPaymentPreference");
-
         GenericValue creditCard = null;
         try {
             creditCard = delegator.getRelatedOne("CreditCard",orderPaymentPreference);
@@ -106,92 +111,78 @@
         if (authTransaction == null) {
             return ServiceUtil.returnError("No authorization transaction found for the OrderPaymentPreference; cannot Capture");
         }
-        context.put("creditCard",creditCard);
-        context.put("authTransaction",authTransaction);
-
-        Map results = ServiceUtil.returnSuccess();
-        Map request = new HashMap();
-
-        Properties props = buildAIMProperties(context);
-        buildMerchantInfo(context,props,request);
-        buildGatewayResponeConfig(context,props,request);
-        buildCustomerBillingInfo(context,props,request);
-        buildEmailSettings(context,props,request);
+        context.put("creditCard", creditCard);
+        context.put("authTransaction", authTransaction);
+        Map<String, Object> results = ServiceUtil.returnSuccess();
+        Map<String, Object> request = FastMap.newInstance();
+        Properties props = buildAIMProperties(context, delegator);
+        buildMerchantInfo(context, props, request);
+        buildGatewayResponeConfig(context, props, request);
+        buildCustomerBillingInfo(context, props, request);
+        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
-        props.put("transType","PRIOR_AUTH_CAPTURE");
+        props.put("transType", "PRIOR_AUTH_CAPTURE");
         //props.put("transType","CAPTURE_ONLY");
         props.put("cardtype", (String)creditCard.get("cardType"));
         buildCaptureTransaction(context,props,request);
-
-        Map validateResults = validateRequest(context,props,request);
+        Map<String, Object> validateResults = validateRequest(context, props, request);
         String respMsg = (String)validateResults.get(ModelService.RESPONSE_MESSAGE);
         if (ModelService.RESPOND_ERROR.equals(respMsg)) {
             results.put(ModelService.ERROR_MESSAGE, "Validation Failed - invalid values");
             return results;
         }
-
-        Map reply = processCard(request, props);
-
-        processCaptureTransResult(reply,results);
+        Map<String, Object> reply = processCard(request, props);
+        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 results;
     }
-
-    public static Map ccRefund(DispatchContext ctx, Map context) {
+    
+    public static Map<String, Object> ccRefund(DispatchContext ctx, Map<String, Object> context) {
         GenericDelegator delegator = ctx.getDelegator();
         GenericValue orderPaymentPreference = (GenericValue) context.get("orderPaymentPreference");
-
         GenericValue creditCard = null;
         try {
-            creditCard = delegator.getRelatedOne("CreditCard",orderPaymentPreference);
+            creditCard = delegator.getRelatedOne("CreditCard", orderPaymentPreference);
         } catch (GenericEntityException e) {
             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();
-        Map request = new HashMap();
-
-        Properties props = buildAIMProperties(context);
-        buildMerchantInfo(context,props,request);
-        buildGatewayResponeConfig(context,props,request);
-        buildEmailSettings(context,props,request);
-        props.put("transType","CREDIT");
+        Map<String, Object> results = ServiceUtil.returnSuccess();
+        Map<String, Object> request = FastMap.newInstance();
+        Properties props = buildAIMProperties(context, delegator);
+        buildMerchantInfo(context, props, request);
+        buildGatewayResponeConfig(context, props, request);
+        buildEmailSettings(context, props, request);
+        props.put("transType", "CREDIT");
         props.put("cardtype", (String)creditCard.get("cardType"));
-        buildRefundTransaction(context,props,request);
-
-        Map validateResults = validateRequest(context,props,request);
+        buildRefundTransaction(context, props, request);
+        Map<String, Object> validateResults = validateRequest(context, props, request);
         String respMsg = (String)validateResults.get(ModelService.RESPONSE_MESSAGE);
         if (ModelService.RESPOND_ERROR.equals(respMsg)) {
             results.put(ModelService.ERROR_MESSAGE, "Validation Failed - invalid values");
             return results;
         }
-
-        Map reply = processCard(request, props);
-        results.putAll( processRefundTransResult(reply) );
-
+        Map<String, Object> reply = processCard(request, props);
+        results.putAll(processRefundTransResult(reply));
         boolean refundResult = ((Boolean)results.get("refundResult")).booleanValue();
         String refundFlag = (String)results.get("refundFlag");
-
         // Since the refund failed, we are going to void the previous authorization against
         // which ccRefunds attempted to issue the refund.  This happens because Authorize.NET requires
         // that settled transactions need to be voided the same day.  unfortunately they provide no method for
         // determining what transactions can be voided and what can be refunded, so we'll have to try it with timestamps
         if (!refundResult && isVoidableResponse(refundFlag)) {
             boolean canDoVoid = false;
-
             if (VOIDABLE_RESPONSES_TIME_LIMIT.contains(refundFlag)) {
                 // We are calculating the timestamp that is at the beginning of a time limit,
                 // since we can safely assume that, within this time limit, an unsettled transaction
@@ -199,9 +190,7 @@
                 Calendar startCalendar = UtilDateTime.toCalendar(UtilDateTime.nowTimestamp());
                 startCalendar.add(Calendar.DATE, -TIME_LIMIT_VERIFICATION_DAYS);
                 Timestamp startTimestamp = new java.sql.Timestamp(startCalendar.getTime().getTime());
-
                 Timestamp authTimestamp = authTransaction.getTimestamp("transactionDate");
-
                 if (startTimestamp.before(authTimestamp)) {
                     canDoVoid = true;
                 }
@@ -210,23 +199,19 @@
                 // through as usual
                 canDoVoid = true;
             }
-
             if (canDoVoid) {
                 Debug.logWarning("Refund was unsuccessful; will now attempt a VOID transaction.", module);
                 BigDecimal authAmountObj = authTransaction.getBigDecimal("amount");
                 BigDecimal refundAmountObj = (BigDecimal)context.get("refundAmount");
-
                 BigDecimal authAmount = authAmountObj != null ? authAmountObj : BigDecimal.ZERO;
                 BigDecimal refundAmount = refundAmountObj != null ? refundAmountObj : BigDecimal.ZERO;
-
                 if (authAmount.compareTo(refundAmount) == 0) {
-                    reply = voidTransaction(authTransaction, context);
+                    reply = voidTransaction(authTransaction, context, delegator);
                     if (ServiceUtil.isError(reply)) {
                         return reply;
                     }
-
                     results = ServiceUtil.returnSuccess();
-                    results.putAll( processRefundTransResult(reply) );
+                    results.putAll(processRefundTransResult(reply));
                     return results;
                 } else {
                     // TODO: Modify the code to (a) do a void of the whole transaction, and (b)
@@ -235,87 +220,70 @@
                 }
             }
         }
-
         return results;
     }
-
-    public static Map ccRelease(DispatchContext ctx, Map context) {
+    
+    public static Map<String, Object> ccRelease(DispatchContext ctx, Map<String, Object> context) {
+        GenericDelegator delegator = ctx.getDelegator();
         GenericValue orderPaymentPreference = (GenericValue) context.get("orderPaymentPreference");
-
-        GenericValue creditCard = null;
-        try {
-            creditCard = orderPaymentPreference.getRelatedOne("CreditCard");
-        } catch (GenericEntityException e) {
-            Debug.logError(e, module);
-            return ServiceUtil.returnError("Unable to obtain cc information from payment preference [ID = " + orderPaymentPreference.getString("orderPaymentPreferenceId") + "]");
-        }
-
         GenericValue authTransaction = PaymentGatewayServices.getAuthTransaction(orderPaymentPreference);
         if (authTransaction == null) {
             return ServiceUtil.returnError("No authorization transaction found for the OrderPaymentPreference [ID = " + orderPaymentPreference.getString("orderPaymentPreferenceId") + "]; cannot void");
         }
-
-        Map reply = voidTransaction(authTransaction, context);
+        Map<String, Object> reply = voidTransaction(authTransaction, context, delegator);
         if (ServiceUtil.isError(reply)) {
             return reply;
         }
-
-        Map results = ServiceUtil.returnSuccess();
-        results.putAll( processReleaseTransResult(reply) );
+        Map<String, Object> results = ServiceUtil.returnSuccess();
+        results.putAll(processReleaseTransResult(reply));
         return results;
     }
-
-    private static Map voidTransaction(GenericValue authTransaction, Map context) {
-        context.put("authTransaction",authTransaction);
-        Map results = ServiceUtil.returnSuccess();
-        Map request = new HashMap();
-
-        Properties props = buildAIMProperties(context);
-        buildMerchantInfo(context,props,request);
-        buildGatewayResponeConfig(context,props,request);
-        buildEmailSettings(context,props,request);
-        props.put("transType","VOID");
-        buildVoidTransaction(context,props,request);
-
-        Map validateResults = validateRequest(context,props,request);
+    
+    private static Map<String, Object> voidTransaction(GenericValue authTransaction, Map<String, Object> context, GenericDelegator delegator) {
+        context.put("authTransaction", authTransaction);
+        Map<String, Object> results = ServiceUtil.returnSuccess();
+        Map<String, Object> request = FastMap.newInstance();
+        Properties props = buildAIMProperties(context, delegator);
+        buildMerchantInfo(context, props, request);
+        buildGatewayResponeConfig(context, props, request);
+        buildEmailSettings(context, props, request);
+        props.put("transType", "VOID");
+        buildVoidTransaction(context, props, request);
+        Map<String, Object> validateResults = validateRequest(context, props, request);
         String respMsg = (String)validateResults.get(ModelService.RESPONSE_MESSAGE);
         if (ModelService.RESPOND_ERROR.equals(respMsg)) {
             results.put(ModelService.ERROR_MESSAGE, "Validation Failed - invalid values");
             return results;
         }
-
         return processCard(request, props);
     }
-
-    public static Map ccCredit(DispatchContext ctx, Map context) {
-        Map results = new HashMap();
+    
+    public static Map<String, Object> ccCredit(DispatchContext ctx, Map<String, Object> context) {
+        Map<String, Object> results = FastMap.newInstance();
         results.put(ModelService.RESPONSE_MESSAGE, ModelService.RESPOND_ERROR);
-        results.put(ModelService.ERROR_MESSAGE, "Authorize.net ccCredit unsupported with version 3.0");
+        results.put(ModelService.ERROR_MESSAGE, "Authorize.net ccCredit unsupported with version 3.1");
         return results;
     }
-
-    public static Map ccAuthCapture(DispatchContext ctx, Map context) {
-        Map results = ServiceUtil.returnSuccess();
-        Map request = new HashMap();
-
-        Properties props = buildAIMProperties(context);
-        buildMerchantInfo(context,props,request);
-        buildGatewayResponeConfig(context,props,request);
-        buildCustomerBillingInfo(context,props,request);
-        buildEmailSettings(context,props,request);
-        buildInvoiceInfo(context,props,request);
-        props.put("transType","AUTH_CAPTURE");
-        buildAuthTransaction(context,props,request);
-
-        Map validateResults = validateRequest(context,props,request);
+    
+    public static Map<String, Object> ccAuthCapture(DispatchContext ctx, Map<String, Object> context) {
+        GenericDelegator delegator = ctx.getDelegator();
+        Map<String, Object> results = ServiceUtil.returnSuccess();
+        Map<String, Object> request = FastMap.newInstance();
+        Properties props = buildAIMProperties(context, delegator);
+        buildMerchantInfo(context, props, request);
+        buildGatewayResponeConfig(context, props, request);
+        buildCustomerBillingInfo(context, props, request);
+        buildEmailSettings(context, props, request);
+        buildInvoiceInfo(context, props, request);
+        props.put("transType", "AUTH_CAPTURE");
+        buildAuthTransaction(context, props, request);
+        Map<String, Object> validateResults = validateRequest(context, props, request);
         String respMsg = (String)validateResults.get(ModelService.RESPONSE_MESSAGE);
         if (ModelService.RESPOND_ERROR.equals(respMsg)) {
             results.put(ModelService.ERROR_MESSAGE, "Validation Failed - invalid values");
             return results;
         }
-
-        Map reply = processCard(request, props);
-
+        Map<String, Object> reply = processCard(request, props);
         //now we need to process the result
         processAuthCaptureTransResult(reply, results);
         // if there is no captureRefNum, then the capture failed
@@ -324,32 +292,26 @@
         }
         return results;
     }
-
-    private static HashMap processCard(Map request, Properties props) {
-        HashMap result = new HashMap();
-
+    
+    private static Map<String, Object> processCard(Map<String, Object> request, Properties props) {
+        Map<String, Object> result = FastMap.newInstance();
         String url = props.getProperty("url");
         if (url == null || url.length() == 0) {
-            url = "https://certification.authorize.net/gateway/transact.dll"; // test url
-            Debug.logWarning("No payment.authorizedotnet.url found.  Using a default of [" + url + "]", module);
+            return ServiceUtil.returnFailure("No payment.authorizedotnet.url found.");
         }
         if (isTestMode()) {
             Debug.logInfo("TEST Authorize.net using url [" + url + "]", module);
             Debug.logInfo("TEST Authorize.net request string " + request.toString(),module);
             Debug.logInfo("TEST Authorize.net properties string " + props.toString(),module);
         }
-
         try {
             HttpClient httpClient = new HttpClient(url, request);
-
-            httpClient.setClientCertificateAlias("AUTHORIZE_NET");
+            String certificateAlias = props.getProperty("certificateAlias");
+            httpClient.setClientCertificateAlias(certificateAlias);
             String httpResponse = httpClient.post();
-
             Debug.logInfo("transaction response: " + httpResponse,module);
-
             AuthorizeResponse ar = new AuthorizeResponse(httpResponse);
             String resp = ar.getResponseCode();
-
             if (resp.equals(AuthorizeResponse.APPROVED)) {
                 result.put("authResult", Boolean.TRUE);
             } else {
@@ -358,75 +320,62 @@
                 Debug.logInfo("responseReason: " + ar.getResponseField(AuthorizeResponse.RESPONSE_REASON_CODE),module);
                 Debug.logInfo("reasonText:     " + ar.getResponseField(AuthorizeResponse.RESPONSE_REASON_TEXT),module);
             }
-
             result.put("httpResponse", httpResponse);
             result.put("authorizeResponse", ar);
-
         } catch (HttpClientException e) {
             Debug.logInfo("Could not complete Authorize.Net transaction: " + e.toString(),module);
         }
-
         result.put(ModelService.RESPONSE_MESSAGE, ModelService.RESPOND_SUCCESS);
         return result;
     }
-
+    
     private static boolean isTestMode() {
         return "true".equalsIgnoreCase((String)AIMProperties.get("testReq"));
     }
-
-    private static String getVersion() {
-        return (String)AIMProperties.get("ver");
-    }
-
-    private static Properties buildAIMProperties(Map context) {
-        String configStr = (String)context.get("paymentConfig");
+    
+    private static Properties buildAIMProperties(Map<String, Object> context, GenericDelegator delegator) {
+        String paymentGatewayConfigId = (String) context.get("paymentGatewayConfigId");
+        String configStr = (String) context.get("paymentConfig");
         if (configStr == null) {
             configStr = "payment.properties";
         }
-
         GenericValue cc = (GenericValue)context.get("creditCard");
-
-        String url = UtilProperties.getPropertyValue(configStr, "payment.authorizedotnet.url");
-        String ver = UtilProperties.getPropertyValue(configStr, "payment.authorizedotnet.version");
-        String delimited = UtilProperties.getPropertyValue(configStr, "payment.authorizedotnet.delimited");
-        String delimiter = UtilProperties.getPropertyValue(configStr, "payment.authorizedotnet.delimiter");
-        String method = UtilProperties.getPropertyValue(configStr, "payment.authorizedotnet.method");
-        //String transType = UtilProperties.getPropertyValue(configStr, "payment.authorizedotnet.type");
-        String emailCustomer = UtilProperties.getPropertyValue(configStr, "payment.authorizedotnet.emailcustomer");
-        String emailMerchant = UtilProperties.getPropertyValue(configStr, "payment.authorizedotnet.emailmerchant");
-        String testReq = UtilProperties.getPropertyValue(configStr, "payment.authorizedotnet.test");
-        String relay = UtilProperties.getPropertyValue(configStr, "payment.authorizedotnet.relay");
-        String login = UtilProperties.getPropertyValue(configStr, "payment.authorizedotnet.login");
-        String transDescription = UtilProperties.getPropertyValue(configStr, "payment.authorizedotnet.transdescription");
-        String tranKey = UtilProperties.getPropertyValue(configStr, "payment.authorizedotnet.trankey");
-        String password = UtilProperties.getPropertyValue(configStr, "payment.authorizedotnet.password");
-
+        String url = getPaymentGatewayConfigValue(delegator, paymentGatewayConfigId, "transactionUrl", configStr, "payment.authorizedotnet.url");
+        String certificateAlias = getPaymentGatewayConfigValue(delegator, paymentGatewayConfigId, "certificateAlias", configStr, "payment.authorizedotnet.certificateAlias");
+        String ver = getPaymentGatewayConfigValue(delegator, paymentGatewayConfigId, "apiVersion", configStr, "payment.authorizedotnet.version");
+        String delimited = getPaymentGatewayConfigValue(delegator, paymentGatewayConfigId, "delimitedData", configStr, "payment.authorizedotnet.delimited");
+        String delimiter = getPaymentGatewayConfigValue(delegator, paymentGatewayConfigId, "delimiterChar", configStr, "payment.authorizedotnet.delimiter");
+        String method = getPaymentGatewayConfigValue(delegator, paymentGatewayConfigId, "method", configStr, "payment.authorizedotnet.method");
+        String emailCustomer = getPaymentGatewayConfigValue(delegator, paymentGatewayConfigId, "emailCustomer", configStr, "payment.authorizedotnet.emailcustomer");
+        String emailMerchant = getPaymentGatewayConfigValue(delegator, paymentGatewayConfigId, "emailMerchant", configStr, "payment.authorizedotnet.emailmerchant");
+        String testReq = getPaymentGatewayConfigValue(delegator, paymentGatewayConfigId, "testMode", configStr, "payment.authorizedotnet.test");
+        String relay = getPaymentGatewayConfigValue(delegator, paymentGatewayConfigId, "relayResponse", configStr, "payment.authorizedotnet.relay");
+        String tranKey = getPaymentGatewayConfigValue(delegator, paymentGatewayConfigId, "tranKey", configStr, "payment.authorizedotnet.trankey");
+        String login = getPaymentGatewayConfigValue(delegator, paymentGatewayConfigId, "userId", configStr, "payment.authorizedotnet.login");
+        String password = getPaymentGatewayConfigValue(delegator, paymentGatewayConfigId, "pwd", configStr, "payment.authorizedotnet.password");
+        String transDescription = getPaymentGatewayConfigValue(delegator, paymentGatewayConfigId, "transDescription", configStr, "payment.authorizedotnet.transdescription");
         if (ver == null || ver.length() == 0) {
             ver = "3.0";
         }
-
         if (login == null || login.length() == 0) {
-            Debug.logInfo("the login property in " + configStr + " is not configured.",module);
+            Debug.logInfo("the login property in " + configStr + " is not configured.", module);
         }
-
-        if (password == null || password.length() == 0) {
-            Debug.logInfo("The password property in " + configStr + " is not configured.",module);
+        if ((password == null || password.length() == 0) && !("3.1".equals(ver))) {
+            Debug.logInfo("The password property in " + configStr + " is not configured.", module);
         }
-
-        if (ver.equals("3.1")) {
+        if ("3.1".equals(ver)) {
             if (tranKey == null || tranKey.length() <= 0) {
                 Debug.logInfo("Trankey property required for version 3.1 reverting to 3.0",module);
                 ver = "3.0";
             }
         }
-
         Properties props = new Properties();
         props.put("url", url);
+        props.put("certificateAlias", certificateAlias);
         props.put("ver", ver);
         props.put("delimited", delimited);
         props.put("delimiter", delimiter);
         props.put("method", method);
-        //props.put("transType", transType);
         props.put("emailCustomer", emailCustomer);
         props.put("emailMerchant", emailMerchant);
         props.put("testReq", testReq);
@@ -435,39 +384,34 @@
         props.put("login", login);
         props.put("password", password);
         props.put("trankey", tranKey);
-
         if (cc != null) {
             props.put("cardtype", (String)cc.get("cardType"));
         }
-
         if (AIMProperties == null) {
             AIMProperties = props;
         }
-
         if (isTestMode()) {
-            Debug.logInfo("Created Authorize.Net properties file: " + props.toString(),module);
+            Debug.logInfo("Created Authorize.Net properties file: " + props.toString(), module);
         }
-
         return props;
-
     }
-
-    private static void buildMerchantInfo(Map params, Properties props, Map AIMRequest) {
+    
+    private static void buildMerchantInfo(Map<String, Object> params, Properties props, Map<String, Object> AIMRequest) {
         AIMRequest.put("x_Login", props.getProperty("login"));
         String trankey = props.getProperty("trankey");
         if (trankey != null && trankey.length() > 0) {
-            AIMRequest.put("x_Tran_Key",props.getProperty("trankey"));
+            AIMRequest.put("x_Tran_Key", props.getProperty("trankey"));
         }
         AIMRequest.put("x_Password",props.getProperty("password"));
         AIMRequest.put("x_Version", props.getProperty("ver"));
     }
-
-    private static void buildGatewayResponeConfig(Map params, Properties props, Map AIMRequest) {
+    
+    private static void buildGatewayResponeConfig(Map<String, Object> params, Properties props, Map<String, Object> AIMRequest) {
         AIMRequest.put("x_Delim_Data", props.getProperty("delimited"));
         AIMRequest.put("x_Delim_Char", props.getProperty("delimiter"));
     }
-
-    private static void buildCustomerBillingInfo(Map params, Properties props, Map AIMRequest) {
+    
+    private static void buildCustomerBillingInfo(Map<String, Object> params, Properties props, Map<String, Object> AIMRequest) {
         try {
             // this would be used in the case of a capture, where one of the parameters is an OrderPaymentPreference
             if (params.get("orderPaymentPreference") != null) {
@@ -478,17 +422,17 @@
                     if (creditCard == null || ! (opp.get("paymentMethodId").equals(creditCard.get("paymentMethodId")))) {
                         creditCard = opp.getRelatedOne("CreditCard");
                     }
-                    AIMRequest.put("x_First_Name",UtilFormatOut.checkNull(creditCard.getString("firstNameOnCard")));
-                    AIMRequest.put("x_Last_Name",UtilFormatOut.checkNull(creditCard.getString("lastNameOnCard")));
-                    AIMRequest.put("x_Company",UtilFormatOut.checkNull(creditCard.getString("companyNameOnCard")));
+                    AIMRequest.put("x_First_Name", UtilFormatOut.checkNull(creditCard.getString("firstNameOnCard")));
+                    AIMRequest.put("x_Last_Name", UtilFormatOut.checkNull(creditCard.getString("lastNameOnCard")));
+                    AIMRequest.put("x_Company", UtilFormatOut.checkNull(creditCard.getString("companyNameOnCard")));
                     if (UtilValidate.isNotEmpty(creditCard.getString("contactMechId"))) {
                         GenericValue address = creditCard.getRelatedOne("PostalAddress");
                         if (address != null) {
-                            AIMRequest.put("x_Address",UtilFormatOut.checkNull(address.getString("address1")));
-                            AIMRequest.put("x_City",UtilFormatOut.checkNull(address.getString("city")));
-                            AIMRequest.put("x_State",UtilFormatOut.checkNull(address.getString("stateProvinceGeoId")));
-                            AIMRequest.put("x_Zip",UtilFormatOut.checkNull(address.getString("postalCode")));
-                            AIMRequest.put("x_Country",UtilFormatOut.checkNull(address.getString("countryGeoId")));
+                            AIMRequest.put("x_Address", UtilFormatOut.checkNull(address.getString("address1")));
+                            AIMRequest.put("x_City", UtilFormatOut.checkNull(address.getString("city")));
+                            AIMRequest.put("x_State", UtilFormatOut.checkNull(address.getString("stateProvinceGeoId")));
+                            AIMRequest.put("x_Zip", UtilFormatOut.checkNull(address.getString("postalCode")));
+                            AIMRequest.put("x_Country", UtilFormatOut.checkNull(address.getString("countryGeoId")));
                         }
                     }
                 } else {
@@ -498,126 +442,113 @@
                 // this would be the case for an authorization
                 GenericValue cp = (GenericValue)params.get("billToParty");
                 GenericValue ba = (GenericValue)params.get("billingAddress");
-
-                AIMRequest.put("x_First_Name",UtilFormatOut.checkNull(cp.getString("firstName")));
-                AIMRequest.put("x_Last_Name",UtilFormatOut.checkNull(cp.getString("lastName")));
-                AIMRequest.put("x_Address",UtilFormatOut.checkNull(ba.getString("address1")));
-                AIMRequest.put("x_City",UtilFormatOut.checkNull(ba.getString("city")));
-                AIMRequest.put("x_State",UtilFormatOut.checkNull(ba.getString("stateProvinceGeoId")));
-                AIMRequest.put("x_Zip",UtilFormatOut.checkNull(ba.getString("postalCode")));
-                AIMRequest.put("x_Country",UtilFormatOut.checkNull(ba.getString("countryGeoId")));
+                AIMRequest.put("x_First_Name", UtilFormatOut.checkNull(cp.getString("firstName")));
+                AIMRequest.put("x_Last_Name", UtilFormatOut.checkNull(cp.getString("lastName")));
+                AIMRequest.put("x_Address", UtilFormatOut.checkNull(ba.getString("address1")));
+                AIMRequest.put("x_City", UtilFormatOut.checkNull(ba.getString("city")));
+                AIMRequest.put("x_State", UtilFormatOut.checkNull(ba.getString("stateProvinceGeoId")));
+                AIMRequest.put("x_Zip", UtilFormatOut.checkNull(ba.getString("postalCode")));
+                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) {
+    
+    private static void buildEmailSettings(Map<String, Object> params, Properties props, Map<String, Object> AIMRequest) {
         GenericValue ea = (GenericValue)params.get("billToEmail");
         AIMRequest.put("x_Email_Customer", props.getProperty("emailCustomer"));
         AIMRequest.put("x_Email_Merchant", props.getProperty("emailMerchant"));
-
         if (ea != null) {
-            AIMRequest.put("x_Email",UtilFormatOut.checkNull(ea.getString("infoString")));
+            AIMRequest.put("x_Email", UtilFormatOut.checkNull(ea.getString("infoString")));
         }
     }
-
-    private static void buildInvoiceInfo(Map params, Properties props, Map AIMRequest) {
+    
+    private static void buildInvoiceInfo(Map<String, Object> params, Properties props, Map<String, Object> AIMRequest) {
         String description = UtilFormatOut.checkNull(props.getProperty("transDescription"));
         String orderId = UtilFormatOut.checkNull((String)params.get("orderId"));
-        AIMRequest.put("x_Invoice_Num","Order " + orderId);
+        AIMRequest.put("x_Invoice_Num", "Order " + orderId);
         AIMRequest.put("x_Description", description);
     }
-
-    private static void buildAuthTransaction(Map params, Properties props, Map AIMRequest) {
-        GenericValue cc = (GenericValue)params.get("creditCard");
+    
+    private static void buildAuthTransaction(Map<String, Object> params, Properties props, Map<String, Object> AIMRequest) {
+        GenericValue cc = (GenericValue) params.get("creditCard");
         String currency = (String) params.get("currency");
         String amount = ((BigDecimal)params.get("processAmount")).toString();
         String number = UtilFormatOut.checkNull(cc.getString("cardNumber"));
         String expDate = UtilFormatOut.checkNull(cc.getString("expireDate"));
         String cardSecurityCode = (String) params.get("cardSecurityCode");
-
-        AIMRequest.put("x_Amount",amount);
-        AIMRequest.put("x_Currency_Code",currency);
+        AIMRequest.put("x_Amount", amount);
+        AIMRequest.put("x_Currency_Code", currency);
         AIMRequest.put("x_Method", props.getProperty("method"));
         AIMRequest.put("x_Type", props.getProperty("transType"));
-        AIMRequest.put("x_Card_Num",number);
-        AIMRequest.put("x_Exp_Date",expDate);
+        AIMRequest.put("x_Card_Num", number);
+        AIMRequest.put("x_Exp_Date", expDate);
         if (UtilValidate.isNotEmpty(cardSecurityCode)) {
             AIMRequest.put("x_card_code", cardSecurityCode);
         }
     }
-
-    private static void buildCaptureTransaction(Map params, Properties props, Map AIMRequest) {
-
-        GenericValue at = (GenericValue)params.get("authTransaction");
-        GenericValue cc = (GenericValue)params.get("creditCard");
+    
+    private static void buildCaptureTransaction(Map<String, Object> params, Properties props, Map<String, Object> AIMRequest) {
+        GenericValue at = (GenericValue) params.get("authTransaction");
+        GenericValue cc = (GenericValue) params.get("creditCard");
         String currency = (String) params.get("currency");
-        String amount = ((BigDecimal)params.get("captureAmount")).toString();
+        String amount = ((BigDecimal) params.get("captureAmount")).toString();
         String number = UtilFormatOut.checkNull(cc.getString("cardNumber"));
         String expDate = UtilFormatOut.checkNull(cc.getString("expireDate"));
-
-        AIMRequest.put("x_Amount",amount);
-        AIMRequest.put("x_Currency_Code",currency);
+        AIMRequest.put("x_Amount", amount);
+        AIMRequest.put("x_Currency_Code", currency);
         AIMRequest.put("x_Method", props.getProperty("method"));
         AIMRequest.put("x_Type", props.getProperty("transType"));
-        AIMRequest.put("x_Card_Num",number);
-        AIMRequest.put("x_Exp_Date",expDate);
-        AIMRequest.put("x_Trans_ID",at.get("referenceNum"));
-        AIMRequest.put("x_Auth_Code",at.get("gatewayCode"));
-    }
-
-    private static void buildRefundTransaction(Map params, Properties props, Map AIMRequest) {
-        GenericValue at = (GenericValue)params.get("authTransaction");
-        GenericValue cc = (GenericValue)params.get("creditCard");
+        AIMRequest.put("x_Card_Num", number);
+        AIMRequest.put("x_Exp_Date", expDate);
+        AIMRequest.put("x_Trans_ID", at.get("referenceNum"));
+        AIMRequest.put("x_Auth_Code", at.get("gatewayCode"));
+    }
+    
+    private static void buildRefundTransaction(Map<String, Object> params, Properties props, Map<String, Object> AIMRequest) {
+        GenericValue at = (GenericValue) params.get("authTransaction");
+        GenericValue cc = (GenericValue) params.get("creditCard");
         String currency = (String) params.get("currency");
-        String amount = ((BigDecimal)params.get("refundAmount")).toString();
+        String amount = ((BigDecimal) params.get("refundAmount")).toString();
         String number = UtilFormatOut.checkNull(cc.getString("cardNumber"));
         String expDate = UtilFormatOut.checkNull(cc.getString("expireDate"));
-
-        AIMRequest.put("x_Amount",amount);
-        AIMRequest.put("x_Currency_Code",currency);
+        AIMRequest.put("x_Amount", amount);
+        AIMRequest.put("x_Currency_Code", currency);
         AIMRequest.put("x_Method", props.getProperty("method"));
         AIMRequest.put("x_Type", props.getProperty("transType"));
-        AIMRequest.put("x_Card_Num",number);
-        AIMRequest.put("x_Exp_Date",expDate);
-        AIMRequest.put("x_Trans_ID",at.get("referenceNum"));
-        AIMRequest.put("x_Auth_Code",at.get("gatewayCode"));
-
-        Debug.logInfo("buildCaptureTransaction. " + at.toString(),module);
-    }
-
-    private static void buildVoidTransaction(Map params, Properties props, Map AIMRequest) {
-        GenericValue at = (GenericValue)params.get("authTransaction");
+        AIMRequest.put("x_Card_Num", number);
+        AIMRequest.put("x_Exp_Date", expDate);
+        AIMRequest.put("x_Trans_ID", at.get("referenceNum"));
+        AIMRequest.put("x_Auth_Code", at.get("gatewayCode"));
+        Debug.logInfo("buildCaptureTransaction. " + at.toString(), module);
+    }
+    
+    private static void buildVoidTransaction(Map<String, Object> params, Properties props, Map<String, Object> AIMRequest) {
+        GenericValue at = (GenericValue) params.get("authTransaction");
         String currency = (String) params.get("currency");
-
-        AIMRequest.put("x_Currency_Code",currency);
+        AIMRequest.put("x_Currency_Code", currency);
         AIMRequest.put("x_Method", props.getProperty("method"));
         AIMRequest.put("x_Type", props.getProperty("transType"));
-        AIMRequest.put("x_Trans_ID",at.get("referenceNum"));
-        AIMRequest.put("x_Auth_Code",at.get("gatewayCode"));
-
-        Debug.logInfo("buildVoidTransaction. " + at.toString(),module);
-    }
-
-    private static Map validateRequest(Map params, Properties props, Map AIMRequest) {
-        Map result = new HashMap();
+        AIMRequest.put("x_Trans_ID", at.get("referenceNum"));
+        AIMRequest.put("x_Auth_Code", at.get("gatewayCode"));
+        Debug.logInfo("buildVoidTransaction. " + at.toString(), module);
+    }
+    
+    private static Map<String, Object> validateRequest(Map<String, Object> params, Properties props, Map<String, Object> AIMRequest) {
+        Map<String, Object> result = FastMap.newInstance();
         result.put(ModelService.RESPONSE_MESSAGE, ModelService.RESPOND_SUCCESS);
         return result;
     }
-
-
-    private static void processAuthTransResult(Map reply, Map results) {
-        AuthorizeResponse ar = (AuthorizeResponse)reply.get("authorizeResponse");
-        Boolean authResult = (Boolean)reply.get("authResult");
+    
+    private static void processAuthTransResult(Map<String, Object> reply, Map<String, Object> results) {
+        AuthorizeResponse ar = (AuthorizeResponse) reply.get("authorizeResponse");
+        Boolean authResult = (Boolean) reply.get("authResult");
         results.put("authResult", new Boolean(authResult.booleanValue()));
-        results.put("authFlag",ar.getReasonCode());
-        results.put("authMessage",ar.getReasonText());
-
-
+        results.put("authFlag", ar.getReasonCode());
+        results.put("authMessage", ar.getReasonText());
         if (authResult.booleanValue()) { //passed
             results.put("authCode", ar.getResponseField(AuthorizeResponse.AUTHORIZATION_CODE));
             results.put("authRefNum", ar.getResponseField(AuthorizeResponse.TRANSACTION_ID));
@@ -628,83 +559,72 @@
             results.put("authCode", ar.getResponseCode());
             results.put("processAmount", new BigDecimal("0.00"));
             results.put("authRefNum", AuthorizeResponse.ERROR);
-
         }
-
         Debug.logInfo("processAuthTransResult: " + results.toString(),module);
     }
-
-    private static void processCaptureTransResult(Map reply, Map results) {
-        AuthorizeResponse ar = (AuthorizeResponse)reply.get("authorizeResponse");
-        Boolean captureResult = (Boolean)reply.get("authResult");
+    
+    private static void processCaptureTransResult(Map<String, Object> reply, Map<String, Object> results) {
+        AuthorizeResponse ar = (AuthorizeResponse) reply.get("authorizeResponse");
+        Boolean captureResult = (Boolean) reply.get("authResult");
         results.put("captureResult", new Boolean(captureResult.booleanValue()));
-        results.put("captureFlag",ar.getReasonCode());
-        results.put("captureMessage",ar.getReasonText());
+        results.put("captureFlag", ar.getReasonCode());
+        results.put("captureMessage", ar.getReasonText());
         results.put("captureRefNum", ar.getResponseField(AuthorizeResponse.TRANSACTION_ID));
-
         if (captureResult.booleanValue()) { //passed
             results.put("captureCode", ar.getResponseField(AuthorizeResponse.AUTHORIZATION_CODE));
             results.put("captureAmount", new BigDecimal(ar.getResponseField(AuthorizeResponse.AMOUNT)));
         } else {
             results.put("captureAmount", new BigDecimal("0.00"));
-
         }
-
         Debug.logInfo("processCaptureTransResult: " + results.toString(),module);
     }
-
-    private static Map processRefundTransResult(Map reply) {
-        Map results = new HashMap();
-        AuthorizeResponse ar = (AuthorizeResponse)reply.get("authorizeResponse");
-        Boolean captureResult = (Boolean)reply.get("authResult");
+    
+    private static Map<String, Object> processRefundTransResult(Map<String, Object> reply) {
+        Map<String, Object> results = FastMap.newInstance();
+        AuthorizeResponse ar = (AuthorizeResponse) reply.get("authorizeResponse");
+        Boolean captureResult = (Boolean) reply.get("authResult");
         results.put("refundResult", new Boolean(captureResult.booleanValue()));
-        results.put("refundFlag",ar.getReasonCode());
-        results.put("refundMessage",ar.getReasonText());
+        results.put("refundFlag", ar.getReasonCode());
+        results.put("refundMessage", ar.getReasonText());
         results.put("refundRefNum", ar.getResponseField(AuthorizeResponse.TRANSACTION_ID));
-
         if (captureResult.booleanValue()) { //passed
             results.put("refundCode", ar.getResponseField(AuthorizeResponse.AUTHORIZATION_CODE));
             results.put("refundAmount", new BigDecimal(ar.getResponseField(AuthorizeResponse.AMOUNT)));
         } else {
             results.put("refundAmount", new BigDecimal("0.00"));
         }
-
         Debug.logInfo("processRefundTransResult: " + results.toString(),module);
         return results;
     }
-
-    private static Map processReleaseTransResult(Map reply) {
-        Map results = new HashMap();
-        AuthorizeResponse ar = (AuthorizeResponse)reply.get("authorizeResponse");
-        Boolean captureResult = (Boolean)reply.get("authResult");
+    
+    private static Map<String, Object> processReleaseTransResult(Map<String, Object> reply) {
+        Map<String, Object> results = FastMap.newInstance();
+        AuthorizeResponse ar = (AuthorizeResponse) reply.get("authorizeResponse");
+        Boolean captureResult = (Boolean) reply.get("authResult");
         results.put("releaseResult", new Boolean(captureResult.booleanValue()));
-        results.put("releaseFlag",ar.getReasonCode());
-        results.put("releaseMessage",ar.getReasonText());
+        results.put("releaseFlag", ar.getReasonCode());
+        results.put("releaseMessage", ar.getReasonText());
         results.put("releaseRefNum", ar.getResponseField(AuthorizeResponse.TRANSACTION_ID));
-
         if (captureResult.booleanValue()) { //passed
             results.put("releaseCode", ar.getResponseField(AuthorizeResponse.AUTHORIZATION_CODE));
             results.put("releaseAmount", new BigDecimal(ar.getResponseField(AuthorizeResponse.AMOUNT)));
         } else {
             results.put("releaseAmount", new BigDecimal("0.00"));
-
         }
-
         Debug.logInfo("processReleaseTransResult: " + results.toString(),module);
         return results;
     }
-
-    private static void processAuthCaptureTransResult(Map reply, Map results) {
-        AuthorizeResponse ar = (AuthorizeResponse)reply.get("authorizeResponse");
-        Boolean authResult = (Boolean)reply.get("authResult");
+    
+    private static void processAuthCaptureTransResult(Map<String, Object> reply, Map<String, Object> results) {
+        AuthorizeResponse ar = (AuthorizeResponse) reply.get("authorizeResponse");
+        Boolean authResult = (Boolean) reply.get("authResult");
         results.put("authResult", new Boolean(authResult.booleanValue()));
-        results.put("authFlag",ar.getReasonCode());
-        results.put("authMessage",ar.getReasonText());
+        results.put("authFlag", ar.getReasonCode());
+        results.put("authMessage", ar.getReasonText());
         results.put("captureResult", new Boolean(authResult.booleanValue()));
-        results.put("captureFlag",ar.getReasonCode());
-        results.put("captureMessage",ar.getReasonText());
+        results.put("captureFlag", ar.getReasonCode());
+        results.put("captureMessage", ar.getReasonText());
         results.put("captureRefNum", ar.getResponseField(AuthorizeResponse.TRANSACTION_ID));
-
         if (authResult.booleanValue()) { //passed
             results.put("authCode", ar.getResponseField(AuthorizeResponse.AUTHORIZATION_CODE));
             results.put("authRefNum", ar.getResponseField(AuthorizeResponse.TRANSACTION_ID));
@@ -716,7 +636,30 @@
             results.put("processAmount", new BigDecimal("0.00"));
             results.put("authRefNum", AuthorizeResponse.ERROR);
         }
-
         Debug.logInfo("processAuthTransResult: " + results.toString(),module);
     }
+    
+    private static String getPaymentGatewayConfigValue(GenericDelegator delegator, String paymentGatewayConfigId, String paymentGatewayConfigParameterName,
+                                                       String resource, String parameterName) {
+        String returnValue = "";
+        if (UtilValidate.isNotEmpty(paymentGatewayConfigId)) {
+            try {
+                GenericValue payflowPro = delegator.findOne("PaymentGatewayAuthorizeNet", UtilMisc.toMap("paymentGatewayConfigId", paymentGatewayConfigId), false);
+                if (UtilValidate.isNotEmpty(payflowPro)) {
+                    Object payflowProField = payflowPro.get(paymentGatewayConfigParameterName);
+                    if (payflowProField != null) {
+                        returnValue = payflowProField.toString().trim();
+                    }
+                }
+            } catch (GenericEntityException e) {
+                Debug.logError(e, module);
+            }
+        } else {
+            String value = UtilProperties.getPropertyValue(resource, parameterName);
+            if (value != null) {
+                returnValue = value.trim();
+            }
+        }
+        return returnValue;
+    }
 }

Modified: ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/controller.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/controller.xml?rev=771419&r1=771418&r2=771419&view=diff
==============================================================================
--- ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/controller.xml (original)
+++ ofbiz/trunk/applications/accounting/webapp/accounting/WEB-INF/controller.xml Mon May  4 20:00:11 2009
@@ -421,6 +421,12 @@
         <response name="success" type="view" value="EditPaymentGatewayConfig"/>
         <response name="error" type="view" value="EditPaymentGatewayConfig"/>
     </request-map>
+    <request-map uri="UpdatePaymentGatewayConfigAuthorizeNet">
+        <security https="true" auth="true"/>
+        <event type="service" invoke="updatePaymentGatewayConfigAuthorizeNet"/>
+        <response name="success" type="view" value="EditPaymentGatewayConfig"/>
+        <response name="error" type="view" value="EditPaymentGatewayConfig"/>
+    </request-map>
     <request-map uri="UpdatePaymentGatewayConfigClearCommerce">
         <security https="true" auth="true"/>
         <event type="service" invoke="updatePaymentGatewayConfigClearCommerce"/>

Modified: ofbiz/trunk/applications/accounting/widget/PaymentGatewayConfigForms.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/widget/PaymentGatewayConfigForms.xml?rev=771419&r1=771418&r2=771419&view=diff
==============================================================================
--- ofbiz/trunk/applications/accounting/widget/PaymentGatewayConfigForms.xml (original)
+++ ofbiz/trunk/applications/accounting/widget/PaymentGatewayConfigForms.xml Mon May  4 20:00:11 2009
@@ -42,14 +42,14 @@
             <service service-name="performFind" result-map="result" result-map-list="listIt">
                 <field-map field-name="inputFields" from-field="parameters"/>
                 <field-map field-name="entityName" value="PaymentGatewayConfig"/>
-                <field-map field-name="orderBy" value="description DESC"/>
+                <field-map field-name="orderBy" value="description"/>
             </service>
         </actions>
         <auto-fields-entity entity-name="PaymentGatewayConfig" default-field-type="display"/>
-        <field name="paymentGatewayConfigId" widget-style="buttontext" title="${uiLabelMap.AccountingPaymentGatewayConfigId}">
-          <hyperlink description="${paymentGatewayConfigId}" target="EditPaymentGatewayConfig?paymentGatewayConfigId=${paymentGatewayConfigId}"/>
+        <field name="paymentGatewayConfigId"><hidden/></field>
+        <field name="description" title="${uiLabelMap.AccountingPaymentGatewayConfigDescription}">
+            <hyperlink description="${description}" target="EditPaymentGatewayConfig?paymentGatewayConfigId=${paymentGatewayConfigId}"/>
         </field>
-        <field name="description" title="${uiLabelMap.AccountingPaymentGatewayConfigDescription}"/>
         <field name="paymentGatewayConfigTypeId" title="${uiLabelMap.AccountingPaymentGatewayConfigTypeId}">
             <display-entity entity-name="PaymentGatewayConfigType" key-field-name="paymentGatewayConfigTypeId" description="${description}"/>
         </field>
@@ -66,6 +66,61 @@
         </field>
     </form>
     
+    <form name="EditPaymentGatewayConfigAuthorizeNet" type="single" target="UpdatePaymentGatewayConfigAuthorizeNet" default-map-name="paymentGatewayAuthorizeNet" header-row-style="header-row" default-table-style="basic-table">
+        <auto-fields-entity entity-name="PaymentGatewayAuthorizeNet" default-field-type="edit"/>
+        <field name="paymentGatewayConfigId"><hidden/></field>
+        <field name="transactionUrl" title="${uiLabelMap.AccountingAuthorizeNetTransactionUrl}">
+            <text size="60" maxlength="60"/>
+        </field>
+        <field name="apiVersion" title="${uiLabelMap.AccountingAuthorizeNetApiVersion}">
+            <text size="10" maxlength="10"/>
+        </field>
+        <field name="delimitedData" title="${uiLabelMap.AccountingAuthorizeNetDelimitedData}">
+            <drop-down>
+                <option key="TRUE" description="${uiLabelMap.CommonTrue}"/>
+                <option key="FALSE" description="${uiLabelMap.CommonFalse}"/>
+            </drop-down>
+        </field>
+        <field name="delimiterChar" title="${uiLabelMap.AccountingAuthorizeNetDelimiterChar}">
+            <text size="1" maxlength="1"/>
+        </field>
+        <field name="method" title="${uiLabelMap.AccountingAuthorizeNetMethod}">
+            <drop-down>
+                <option key="CC" description="${uiLabelMap.AccountingAuthorizeNetMethodCC}"/>
+            </drop-down>
+        </field>
+        <field name="emailCustomer" title="${uiLabelMap.AccountingAuthorizeNetEmailCustomer}">
+            <drop-down>
+                <option key="TRUE" description="${uiLabelMap.CommonTrue}"/>
+                <option key="FALSE" description="${uiLabelMap.CommonFalse}"/>
+            </drop-down>
+        </field>
+        <field name="emailMerchant" title="${uiLabelMap.AccountingAuthorizeNetEmailMerchant}">
+            <drop-down>
+                <option key="TRUE" description="${uiLabelMap.CommonTrue}"/>
+                <option key="FALSE" description="${uiLabelMap.CommonFalse}"/>
+            </drop-down>
+        </field>
+        <field name="testMode" title="${uiLabelMap.AccountingAuthorizeNetTestMode}">
+            <drop-down>
+                <option key="TRUE" description="${uiLabelMap.CommonTrue}"/>
+                <option key="FALSE" description="${uiLabelMap.CommonFalse}"/>
+            </drop-down>
+        </field>
+        <field name="relayResponse" title="${uiLabelMap.AccountingAuthorizeNetRelayResponse}">
+            <drop-down>
+                <option key="TRUE" description="${uiLabelMap.CommonTrue}"/>
+                <option key="FALSE" description="${uiLabelMap.CommonFalse}"/>
+            </drop-down>
+        </field>
+        <field name="tranKey" title="${uiLabelMap.AccountingAuthorizeNetTransKey}">
+            <text size="60" maxlength="60"/>
+        </field>
+        <field name="submitButton" title="${uiLabelMap.CommonUpdate}" widget-style="smallSubmit">
+            <submit button-type="button"/>
+        </field>
+    </form>
+    
     <form name="EditPaymentGatewayConfigCyberSource" type="single" target="UpdatePaymentGatewayConfigCyberSource" default-map-name="paymentGatewayCyberSource" header-row-style="header-row" default-table-style="basic-table">
         <auto-fields-entity entity-name="PaymentGatewayCyberSource" default-field-type="edit"/>
         <field name="paymentGatewayConfigId"><hidden/></field>
@@ -218,10 +273,10 @@
             </service>
         </actions>
         <auto-fields-entity entity-name="PaymentGatewayConfigType" default-field-type="display"/>
-        <field name="paymentGatewayConfigTypeId" widget-style="buttontext" title="${uiLabelMap.AccountingPaymentGatewayConfigTypeId}">
-          <hyperlink description="${paymentGatewayConfigTypeId}" target="EditPaymentGatewayConfigType?paymentGatewayConfigTypeId=${paymentGatewayConfigTypeId}"/>
+        <field name="paymentGatewayConfigTypeId"><hidden/></field>
+        <field name="description" title="${uiLabelMap.AccountingPaymentGatewayConfigTypeDescription}">
+            <hyperlink description="${description}" target="EditPaymentGatewayConfigType?paymentGatewayConfigTypeId=${paymentGatewayConfigTypeId}"/>
         </field>
-        <field name="description" title="${uiLabelMap.AccountingPaymentGatewayConfigTypeDescription}"/>
     </form>
     
     <form name="EditPaymentGatewayConfigType" type="single" target="UpdatePaymentGatewayConfigType" default-map-name="paymentGatewayConfigType" header-row-style="header-row" default-table-style="basic-table">

Modified: ofbiz/trunk/applications/accounting/widget/PaymentGatewayConfigScreens.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/widget/PaymentGatewayConfigScreens.xml?rev=771419&r1=771418&r2=771419&view=diff
==============================================================================
--- ofbiz/trunk/applications/accounting/widget/PaymentGatewayConfigScreens.xml (original)
+++ ofbiz/trunk/applications/accounting/widget/PaymentGatewayConfigScreens.xml Mon May  4 20:00:11 2009
@@ -85,6 +85,9 @@
                 
                 <set field="paymentGatewayConfigId" from-field="parameters.paymentGatewayConfigId"/>
                 <entity-one entity-name="PaymentGatewayConfig" value-field="paymentGatewayConfig"/>
+                <entity-one entity-name="PaymentGatewayAuthorizeNet" value-field="paymentGatewayAuthorizeNet">
+                    <field-map field-name="paymentGatewayConfigId" from-field="parameters.paymentGatewayConfigId"/>
+                </entity-one>
                 <entity-one entity-name="PaymentGatewayCyberSource" value-field="paymentGatewayCyberSource">
                     <field-map field-name="paymentGatewayConfigId" from-field="parameters.paymentGatewayConfigId"/>
                 </entity-one>
@@ -117,6 +120,27 @@
                         </container>
                         <section>
                             <condition>
+                                <not><if-empty field="paymentGatewayAuthorizeNet"/></not>
+                            </condition>
+                            <widgets>
+                                <container style="screenlet">
+                                    <container style="screenlet-title-bar">
+                                        <container style="h3">
+                                            <label text="${uiLabelMap.PageTitleUpdatePaymentGatewayConfigAuthorizeNet}"/>
+                                        </container>
+                                    </container>
+                                    <container style="screenlet-body">
+                                        <section>
+                                            <widgets>
+                                                <include-form name="EditPaymentGatewayConfigAuthorizeNet" location="component://accounting/widget/PaymentGatewayConfigForms.xml"/>
+                                            </widgets>
+                                        </section>
+                                    </container>
+                                </container>
+                            </widgets>
+                        </section>
+                        <section>
+                            <condition>
                                 <not><if-empty field="paymentGatewayCyberSource"/></not>
                             </condition>
                             <widgets>