Author: jleroux
Date: Sat Sep 29 03:45:12 2007
New Revision: 580570

URL: http://svn.apache.org/viewvc?rev=580570&view=rev
Log:
Applied fix from trunk for revision: 580500

Modified:
    
ofbiz/branches/release4.0/applications/accounting/src/org/ofbiz/accounting/thirdparty/authorizedotnet/AIMPaymentServices.java

Modified: 
ofbiz/branches/release4.0/applications/accounting/src/org/ofbiz/accounting/thirdparty/authorizedotnet/AIMPaymentServices.java
URL: 
http://svn.apache.org/viewvc/ofbiz/branches/release4.0/applications/accounting/src/org/ofbiz/accounting/thirdparty/authorizedotnet/AIMPaymentServices.java?rev=580570&r1=580569&r2=580570&view=diff
==============================================================================
--- 
ofbiz/branches/release4.0/applications/accounting/src/org/ofbiz/accounting/thirdparty/authorizedotnet/AIMPaymentServices.java
 (original)
+++ 
ofbiz/branches/release4.0/applications/accounting/src/org/ofbiz/accounting/thirdparty/authorizedotnet/AIMPaymentServices.java
 Sat Sep 29 03:45:12 2007
@@ -475,17 +475,23 @@
             if (params.get("orderPaymentPreference") != null) {
                 GenericValue opp = (GenericValue) 
params.get("orderPaymentPreference");
                 if 
("CREDIT_CARD".equals(opp.getString("paymentMethodTypeId"))) {
-                    GenericValue creditCard = opp.getRelatedOne("CreditCard");
+                    // sometimes the ccAuthCapture interface is used, in which 
case the creditCard is passed directly
+                    GenericValue creditCard = (GenericValue) 
params.get("creditCard");
+                    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")));
                     if 
(UtilValidate.isNotEmpty(creditCard.getString("contactMechId"))) {
                         GenericValue address = 
creditCard.getRelatedOne("PostalAddress");
-                        
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")));
+                        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")));
+                        }
                     }
                 } else {
                     Debug.logWarning("Payment preference " + opp + " is not a 
credit card", module);


Reply via email to