You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by ha...@apache.org on 2011/02/17 07:57:51 UTC

svn commit: r1071517 - in /ofbiz/trunk/applications: accounting/config/ accounting/servicedef/ accounting/src/org/ofbiz/accounting/payment/ accounting/src/org/ofbiz/accounting/thirdparty/cybersource/ order/src/org/ofbiz/order/shoppingcart/

Author: hansbak
Date: Thu Feb 17 06:57:51 2011
New Revision: 1071517

URL: http://svn.apache.org/viewvc?rev=1071517&view=rev
Log:
update to cybersource payment gateway: added a properties setting that orders are still accepted but put into the created stage when a credit card fails authorisation. The default is the current setting: order is not created

Modified:
    ofbiz/trunk/applications/accounting/config/payment.properties
    ofbiz/trunk/applications/accounting/servicedef/services_paymentmethod.xml
    ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/payment/PaymentGatewayServices.java
    ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/thirdparty/cybersource/IcsPaymentServices.java
    ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/CheckOutHelper.java

Modified: ofbiz/trunk/applications/accounting/config/payment.properties
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/config/payment.properties?rev=1071517&r1=1071516&r2=1071517&view=diff
==============================================================================
--- ofbiz/trunk/applications/accounting/config/payment.properties (original)
+++ ofbiz/trunk/applications/accounting/config/payment.properties Thu Feb 17 06:57:51 2011
@@ -118,6 +118,12 @@ payment.cybersource.ignoreAvs=false
 # AVS Decline Codes -- May not be supported any longer
 #payment.cybersource.avsDeclineCodes=
 
+# Ignore status of cybersource transaction reply  (Y|N) (if cybersource response transaction status not equals "ACCEPT" then OFBiz will still create the order but in status 'created'.
+# default N = Don't create order if cybersource reported transaction status not equals "ACCEPT".
+payment.cybersource.ignoreStatus=N
+# It happens pretty often that a creditcard is rejected for not valid reasons, one can check to Cybersource fraud queue and after that the order can still be rejected or approved.
+
+
 ############################################
 # ClearCommerce Configuration
 ############################################

Modified: ofbiz/trunk/applications/accounting/servicedef/services_paymentmethod.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/servicedef/services_paymentmethod.xml?rev=1071517&r1=1071516&r2=1071517&view=diff
==============================================================================
--- ofbiz/trunk/applications/accounting/servicedef/services_paymentmethod.xml (original)
+++ ofbiz/trunk/applications/accounting/servicedef/services_paymentmethod.xml Thu Feb 17 06:57:51 2011
@@ -267,6 +267,7 @@ under the License.
         <attribute name="errors" type="Boolean" mode="OUT" optional="false"/>
         <attribute name="messages" type="List" mode="OUT" optional="true"/>
         <attribute name="processAmount" type="BigDecimal" mode="OUT" optional="true"/>
+        <attribute name="authCode" type="String" mode="OUT" optional="true"/>
     </service>
 
     <service name="authOrderPayments" engine="java"
@@ -276,6 +277,7 @@ under the License.
         <attribute name="processResult" type="String" mode="OUT" optional="false"/>
         <attribute name="authResultMsgs" type="List" mode="OUT" optional="true"/>
         <attribute name="reAuth" type="Boolean" mode="IN" optional="true"/>
+        <attribute name="authCode" type="String" mode="OUT" optional="true"/>
     </service>
 
     <service name="releaseOrderPayments" engine="java"

Modified: ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/payment/PaymentGatewayServices.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/payment/PaymentGatewayServices.java?rev=1071517&r1=1071516&r2=1071517&view=diff
==============================================================================
--- ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/payment/PaymentGatewayServices.java (original)
+++ ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/payment/PaymentGatewayServices.java Thu Feb 17 06:57:51 2011
@@ -201,6 +201,7 @@ public class PaymentGatewayServices {
                         results.put("processAmount", thisAmount);
                         results.put("finished", Boolean.TRUE);
                         results.put("errors", Boolean.FALSE);
+                        results.put("authCode", authPaymentResult.get("authCode"));
                         return results;
                     } else {
                         boolean needsNsfRetry = needsNsfRetry(orderPaymentPreference, authPaymentResult, delegator);
@@ -399,6 +400,9 @@ public class PaymentGatewayServices {
                 continue;
             }
 
+            // add authorization code to the result
+            result.put("authCode", results.get("authCode"));
+
             if (ServiceUtil.isError(results)) {
                 hadError += 1;
                 messages.add("Could not authorize OrderPaymentPreference [" + paymentPref.getString("orderPaymentPreferenceId") + "] for order [" + orderId + "]: " + results.get(ModelService.ERROR_MESSAGE));

Modified: ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/thirdparty/cybersource/IcsPaymentServices.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/thirdparty/cybersource/IcsPaymentServices.java?rev=1071517&r1=1071516&r2=1071517&view=diff
==============================================================================
--- ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/thirdparty/cybersource/IcsPaymentServices.java (original)
+++ ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/thirdparty/cybersource/IcsPaymentServices.java Thu Feb 17 06:57:51 2011
@@ -536,12 +536,17 @@ public class IcsPaymentServices {
 
     private static void processAuthResult(Map<String, Object> reply, Map<String, Object> result) {
         String decision = getDecision(reply);
+        String checkModeStatus = UtilProperties.getPropertyValue("payment.properties", "payment.cybersource.ignoreStatus");
         if ("ACCEPT".equalsIgnoreCase(decision)) {
             result.put("authCode", reply.get("ccAuthReply_authorizationCode"));
             result.put("authResult", Boolean.TRUE);
         } else {
             result.put("authCode", decision);
-            result.put("authResult", Boolean.FALSE);
+            if ("N".equals(checkModeStatus)) {
+                result.put("authResult", Boolean.FALSE);
+            } else {
+                result.put("authResult", Boolean.TRUE);
+            }
             // TODO: based on reasonCode populate the following flags as applicable: resultDeclined, resultNsf, resultBadExpire, resultBadCardNumber
         }
 

Modified: ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/CheckOutHelper.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/CheckOutHelper.java?rev=1071517&r1=1071516&r2=1071517&view=diff
==============================================================================
--- ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/CheckOutHelper.java (original)
+++ ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/CheckOutHelper.java Thu Feb 17 06:57:51 2011
@@ -1067,9 +1067,27 @@ public class CheckOutHelper {
 
                     // set the order and item status to approved
                     if (autoApproveOrder) {
-                        boolean ok = OrderChangeHelper.approveOrder(dispatcher, userLogin, orderId, manualHold);
-                        if (!ok) {
-                            throw new GeneralException("Problem with order change; see above error");
+                        List<GenericValue> productStorePaymentSettingList = delegator.findByAnd("ProductStorePaymentSetting", UtilMisc.toMap("productStoreId", productStore.getString("productStoreId"), "paymentMethodTypeId", "CREDIT_CARD", "paymentService", "cyberSourceCCAuth"));
+                        if (productStorePaymentSettingList.size() > 0) {
+                            String decision = (String) paymentResult.get("authCode");
+                            if (UtilValidate.isNotEmpty(decision)) {
+                                if ("ACCEPT".equalsIgnoreCase(decision)) {
+                                    boolean ok = OrderChangeHelper.approveOrder(dispatcher, userLogin, orderId, manualHold);
+                                    if (!ok) {
+                                        throw new GeneralException("Problem with order change; see above error");
+                                    }
+                                }
+                            } else {
+                                boolean ok = OrderChangeHelper.approveOrder(dispatcher, userLogin, orderId, manualHold);
+                                if (!ok) {
+                                    throw new GeneralException("Problem with order change; see above error");
+                                }
+                            }
+                        } else {
+                            boolean ok = OrderChangeHelper.approveOrder(dispatcher, userLogin, orderId, manualHold);
+                            if (!ok) {
+                                throw new GeneralException("Problem with order change; see above error");
+                            }
                         }
                     }
                 } else if (authResp.equals("ERROR")) {



Re: svn commit: r1071517 - in /ofbiz/trunk/applications: accounting/config/ accounting/servicedef/ accounting/src/org/ofbiz/accounting/payment/ accounting/src/org/ofbiz/accounting/thirdparty/cybersource/ order/src/org/ofbiz/order/shoppingcart/

Posted by David E Jones <de...@me.com>.
I agree, this is the wrong place for it.

What's more, isn't it a bad thing to change this such that it considers failed auths successful in any way?

Why not just change your ProductStore settings to go into the Created status on auth failure instead of the Rejected status?

Benefits include no code changes, can be different for different stores in the same system, order history data shows actual payment processing results, and so on.

-David


On Feb 17, 2011, at 1:11 AM, Scott Gray wrote:

> Hi Hans,
> 
> Isn't that more of an order related setting rather than anything the payment gateway needs to worry about?  Surely we already have processes for this sort of thing?
> 
> Also, we're going to end up with a hell of a mess if we keep putting payment processor specific code in the order logic.
> 
> Regards
> Scott
> 
> On 17/02/2011, at 7:57 PM, hansbak@apache.org wrote:
> 
>> Author: hansbak
>> Date: Thu Feb 17 06:57:51 2011
>> New Revision: 1071517
>> 
>> URL: http://svn.apache.org/viewvc?rev=1071517&view=rev
>> Log:
>> update to cybersource payment gateway: added a properties setting that orders are still accepted but put into the created stage when a credit card fails authorisation. The default is the current setting: order is not created
>> 
>> Modified:
>>   ofbiz/trunk/applications/accounting/config/payment.properties
>>   ofbiz/trunk/applications/accounting/servicedef/services_paymentmethod.xml
>>   ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/payment/PaymentGatewayServices.java
>>   ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/thirdparty/cybersource/IcsPaymentServices.java
>>   ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/CheckOutHelper.java
>> 
>> Modified: ofbiz/trunk/applications/accounting/config/payment.properties
>> URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/config/payment.properties?rev=1071517&r1=1071516&r2=1071517&view=diff
>> ==============================================================================
>> --- ofbiz/trunk/applications/accounting/config/payment.properties (original)
>> +++ ofbiz/trunk/applications/accounting/config/payment.properties Thu Feb 17 06:57:51 2011
>> @@ -118,6 +118,12 @@ payment.cybersource.ignoreAvs=false
>> # AVS Decline Codes -- May not be supported any longer
>> #payment.cybersource.avsDeclineCodes=
>> 
>> +# Ignore status of cybersource transaction reply  (Y|N) (if cybersource response transaction status not equals "ACCEPT" then OFBiz will still create the order but in status 'created'.
>> +# default N = Don't create order if cybersource reported transaction status not equals "ACCEPT".
>> +payment.cybersource.ignoreStatus=N
>> +# It happens pretty often that a creditcard is rejected for not valid reasons, one can check to Cybersource fraud queue and after that the order can still be rejected or approved.
>> +
>> +
>> ############################################
>> # ClearCommerce Configuration
>> ############################################
>> 
>> Modified: ofbiz/trunk/applications/accounting/servicedef/services_paymentmethod.xml
>> URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/servicedef/services_paymentmethod.xml?rev=1071517&r1=1071516&r2=1071517&view=diff
>> ==============================================================================
>> --- ofbiz/trunk/applications/accounting/servicedef/services_paymentmethod.xml (original)
>> +++ ofbiz/trunk/applications/accounting/servicedef/services_paymentmethod.xml Thu Feb 17 06:57:51 2011
>> @@ -267,6 +267,7 @@ under the License.
>>        <attribute name="errors" type="Boolean" mode="OUT" optional="false"/>
>>        <attribute name="messages" type="List" mode="OUT" optional="true"/>
>>        <attribute name="processAmount" type="BigDecimal" mode="OUT" optional="true"/>
>> +        <attribute name="authCode" type="String" mode="OUT" optional="true"/>
>>    </service>
>> 
>>    <service name="authOrderPayments" engine="java"
>> @@ -276,6 +277,7 @@ under the License.
>>        <attribute name="processResult" type="String" mode="OUT" optional="false"/>
>>        <attribute name="authResultMsgs" type="List" mode="OUT" optional="true"/>
>>        <attribute name="reAuth" type="Boolean" mode="IN" optional="true"/>
>> +        <attribute name="authCode" type="String" mode="OUT" optional="true"/>
>>    </service>
>> 
>>    <service name="releaseOrderPayments" engine="java"
>> 
>> Modified: ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/payment/PaymentGatewayServices.java
>> URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/payment/PaymentGatewayServices.java?rev=1071517&r1=1071516&r2=1071517&view=diff
>> ==============================================================================
>> --- ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/payment/PaymentGatewayServices.java (original)
>> +++ ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/payment/PaymentGatewayServices.java Thu Feb 17 06:57:51 2011
>> @@ -201,6 +201,7 @@ public class PaymentGatewayServices {
>>                        results.put("processAmount", thisAmount);
>>                        results.put("finished", Boolean.TRUE);
>>                        results.put("errors", Boolean.FALSE);
>> +                        results.put("authCode", authPaymentResult.get("authCode"));
>>                        return results;
>>                    } else {
>>                        boolean needsNsfRetry = needsNsfRetry(orderPaymentPreference, authPaymentResult, delegator);
>> @@ -399,6 +400,9 @@ public class PaymentGatewayServices {
>>                continue;
>>            }
>> 
>> +            // add authorization code to the result
>> +            result.put("authCode", results.get("authCode"));
>> +
>>            if (ServiceUtil.isError(results)) {
>>                hadError += 1;
>>                messages.add("Could not authorize OrderPaymentPreference [" + paymentPref.getString("orderPaymentPreferenceId") + "] for order [" + orderId + "]: " + results.get(ModelService.ERROR_MESSAGE));
>> 
>> Modified: ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/thirdparty/cybersource/IcsPaymentServices.java
>> URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/thirdparty/cybersource/IcsPaymentServices.java?rev=1071517&r1=1071516&r2=1071517&view=diff
>> ==============================================================================
>> --- ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/thirdparty/cybersource/IcsPaymentServices.java (original)
>> +++ ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/thirdparty/cybersource/IcsPaymentServices.java Thu Feb 17 06:57:51 2011
>> @@ -536,12 +536,17 @@ public class IcsPaymentServices {
>> 
>>    private static void processAuthResult(Map<String, Object> reply, Map<String, Object> result) {
>>        String decision = getDecision(reply);
>> +        String checkModeStatus = UtilProperties.getPropertyValue("payment.properties", "payment.cybersource.ignoreStatus");
>>        if ("ACCEPT".equalsIgnoreCase(decision)) {
>>            result.put("authCode", reply.get("ccAuthReply_authorizationCode"));
>>            result.put("authResult", Boolean.TRUE);
>>        } else {
>>            result.put("authCode", decision);
>> -            result.put("authResult", Boolean.FALSE);
>> +            if ("N".equals(checkModeStatus)) {
>> +                result.put("authResult", Boolean.FALSE);
>> +            } else {
>> +                result.put("authResult", Boolean.TRUE);
>> +            }
>>            // TODO: based on reasonCode populate the following flags as applicable: resultDeclined, resultNsf, resultBadExpire, resultBadCardNumber
>>        }
>> 
>> 
>> Modified: ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/CheckOutHelper.java
>> URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/CheckOutHelper.java?rev=1071517&r1=1071516&r2=1071517&view=diff
>> ==============================================================================
>> --- ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/CheckOutHelper.java (original)
>> +++ ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/CheckOutHelper.java Thu Feb 17 06:57:51 2011
>> @@ -1067,9 +1067,27 @@ public class CheckOutHelper {
>> 
>>                    // set the order and item status to approved
>>                    if (autoApproveOrder) {
>> -                        boolean ok = OrderChangeHelper.approveOrder(dispatcher, userLogin, orderId, manualHold);
>> -                        if (!ok) {
>> -                            throw new GeneralException("Problem with order change; see above error");
>> +                        List<GenericValue> productStorePaymentSettingList = delegator.findByAnd("ProductStorePaymentSetting", UtilMisc.toMap("productStoreId", productStore.getString("productStoreId"), "paymentMethodTypeId", "CREDIT_CARD", "paymentService", "cyberSourceCCAuth"));
>> +                        if (productStorePaymentSettingList.size() > 0) {
>> +                            String decision = (String) paymentResult.get("authCode");
>> +                            if (UtilValidate.isNotEmpty(decision)) {
>> +                                if ("ACCEPT".equalsIgnoreCase(decision)) {
>> +                                    boolean ok = OrderChangeHelper.approveOrder(dispatcher, userLogin, orderId, manualHold);
>> +                                    if (!ok) {
>> +                                        throw new GeneralException("Problem with order change; see above error");
>> +                                    }
>> +                                }
>> +                            } else {
>> +                                boolean ok = OrderChangeHelper.approveOrder(dispatcher, userLogin, orderId, manualHold);
>> +                                if (!ok) {
>> +                                    throw new GeneralException("Problem with order change; see above error");
>> +                                }
>> +                            }
>> +                        } else {
>> +                            boolean ok = OrderChangeHelper.approveOrder(dispatcher, userLogin, orderId, manualHold);
>> +                            if (!ok) {
>> +                                throw new GeneralException("Problem with order change; see above error");
>> +                            }
>>                        }
>>                    }
>>                } else if (authResp.equals("ERROR")) {
>> 
>> 
> 


Re: svn commit: r1071517 - in /ofbiz/trunk/applications: accounting/config/ accounting/servicedef/ accounting/src/org/ofbiz/accounting/payment/ accounting/src/org/ofbiz/accounting/thirdparty/cybersource/ order/src/org/ofbiz/order/shoppingcart/

Posted by Anil Patel <an...@hotwaxmedia.com>.
Its interesting how serious issues are getting handled, In last two weeks I have seen interesting comments by same person, see 

See, 
http://mail-archives.apache.org/mod_mbox/ofbiz-dev/201102.mbox/%3C1296861866.2554.9.camel@hans-laptop%3E
http://ofbiz.135035.n4.nabble.com/Re-svn-commit-r1068279-1-2-in-ofbiz-trunk-applications-order-entitydef-order-script-org-ofbiz-order--td3275530.html#a3276070

There are few others. 

Is contribution so important for Ofbiz community that they will ignore all these poor quality commits?  

Thanks and Regards
Anil Patel
On Feb 17, 2011, at 5:04 AM, Scott Gray wrote:

> That's really not good enough, but I'm not going to waste my time arguing with you.
> 
> Regards
> Scott
> 
> On 17/02/2011, at 11:00 PM, Hans Bakker wrote:
> 
>> no sorry Scott, this option is only for this payment method, other
>> payment methods used: paypal, google.
>> 
>> One could sure have this setting at a higher level, however still it
>> needs an override at a lower level too.....
>> 
>> I am sorry, but this is all I can say and do not have more time to spend
>> on this.
>> 
>> Regards,
>> Hans
>> 
>> 
>> 
>> On Thu, 2011-02-17 at 22:52 +1300, Scott Gray wrote:
>>> But you're typically only using one payment processor per store right?  So the store settings should be sufficient, but even if not this should really be solved in a more generic way with some sort of setting at a higher level.
>>> 
>>> Also it looks like your using the deprecated payment.properties for configuration instead of the PaymentGatewayConfig entities.
>>> 
>>> Regards
>>> Scott
>>> 
>>> On 17/02/2011, at 10:28 PM, Hans Bakker wrote:
>>> 
>>>> This feature is not always for all paymentmethods for every order.
>>>> 
>>>> Certain payment processors can be easily checked and approved afterwards
>>>> with the payment processor while others do not have this feature.
>>>> 
>>>> Regards,
>>>> Hans
>>>> 
>>>> 
>>>> On Thu, 2011-02-17 at 22:11 +1300, Scott Gray wrote:
>>>>> Hi Hans,
>>>>> 
>>>>> Isn't that more of an order related setting rather than anything the payment gateway needs to worry about?  Surely we already have processes for this sort of thing?
>>>>> 
>>>>> Also, we're going to end up with a hell of a mess if we keep putting payment processor specific code in the order logic.
>>>>> 
>>>>> Regards
>>>>> Scott
>>>>> 
>>>>> On 17/02/2011, at 7:57 PM, hansbak@apache.org wrote:
>>>>> 
>>>>>> Author: hansbak
>>>>>> Date: Thu Feb 17 06:57:51 2011
>>>>>> New Revision: 1071517
>>>>>> 
>>>>>> URL: http://svn.apache.org/viewvc?rev=1071517&view=rev
>>>>>> Log:
>>>>>> update to cybersource payment gateway: added a properties setting that orders are still accepted but put into the created stage when a credit card fails authorisation. The default is the current setting: order is not created
>>>>>> 
>>>>>> Modified:
>>>>>> ofbiz/trunk/applications/accounting/config/payment.properties
>>>>>> ofbiz/trunk/applications/accounting/servicedef/services_paymentmethod.xml
>>>>>> ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/payment/PaymentGatewayServices.java
>>>>>> ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/thirdparty/cybersource/IcsPaymentServices.java
>>>>>> ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/CheckOutHelper.java
>>>>>> 
>>>>>> Modified: ofbiz/trunk/applications/accounting/config/payment.properties
>>>>>> URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/config/payment.properties?rev=1071517&r1=1071516&r2=1071517&view=diff
>>>>>> ==============================================================================
>>>>>> --- ofbiz/trunk/applications/accounting/config/payment.properties (original)
>>>>>> +++ ofbiz/trunk/applications/accounting/config/payment.properties Thu Feb 17 06:57:51 2011
>>>>>> @@ -118,6 +118,12 @@ payment.cybersource.ignoreAvs=false
>>>>>> # AVS Decline Codes -- May not be supported any longer
>>>>>> #payment.cybersource.avsDeclineCodes=
>>>>>> 
>>>>>> +# Ignore status of cybersource transaction reply  (Y|N) (if cybersource response transaction status not equals "ACCEPT" then OFBiz will still create the order but in status 'created'.
>>>>>> +# default N = Don't create order if cybersource reported transaction status not equals "ACCEPT".
>>>>>> +payment.cybersource.ignoreStatus=N
>>>>>> +# It happens pretty often that a creditcard is rejected for not valid reasons, one can check to Cybersource fraud queue and after that the order can still be rejected or approved.
>>>>>> +
>>>>>> +
>>>>>> ############################################
>>>>>> # ClearCommerce Configuration
>>>>>> ############################################
>>>>>> 
>>>>>> Modified: ofbiz/trunk/applications/accounting/servicedef/services_paymentmethod.xml
>>>>>> URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/servicedef/services_paymentmethod.xml?rev=1071517&r1=1071516&r2=1071517&view=diff
>>>>>> ==============================================================================
>>>>>> --- ofbiz/trunk/applications/accounting/servicedef/services_paymentmethod.xml (original)
>>>>>> +++ ofbiz/trunk/applications/accounting/servicedef/services_paymentmethod.xml Thu Feb 17 06:57:51 2011
>>>>>> @@ -267,6 +267,7 @@ under the License.
>>>>>>      <attribute name="errors" type="Boolean" mode="OUT" optional="false"/>
>>>>>>      <attribute name="messages" type="List" mode="OUT" optional="true"/>
>>>>>>      <attribute name="processAmount" type="BigDecimal" mode="OUT" optional="true"/>
>>>>>> +        <attribute name="authCode" type="String" mode="OUT" optional="true"/>
>>>>>>  </service>
>>>>>> 
>>>>>>  <service name="authOrderPayments" engine="java"
>>>>>> @@ -276,6 +277,7 @@ under the License.
>>>>>>      <attribute name="processResult" type="String" mode="OUT" optional="false"/>
>>>>>>      <attribute name="authResultMsgs" type="List" mode="OUT" optional="true"/>
>>>>>>      <attribute name="reAuth" type="Boolean" mode="IN" optional="true"/>
>>>>>> +        <attribute name="authCode" type="String" mode="OUT" optional="true"/>
>>>>>>  </service>
>>>>>> 
>>>>>>  <service name="releaseOrderPayments" engine="java"
>>>>>> 
>>>>>> Modified: ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/payment/PaymentGatewayServices.java
>>>>>> URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/payment/PaymentGatewayServices.java?rev=1071517&r1=1071516&r2=1071517&view=diff
>>>>>> ==============================================================================
>>>>>> --- ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/payment/PaymentGatewayServices.java (original)
>>>>>> +++ ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/payment/PaymentGatewayServices.java Thu Feb 17 06:57:51 2011
>>>>>> @@ -201,6 +201,7 @@ public class PaymentGatewayServices {
>>>>>>                      results.put("processAmount", thisAmount);
>>>>>>                      results.put("finished", Boolean.TRUE);
>>>>>>                      results.put("errors", Boolean.FALSE);
>>>>>> +                        results.put("authCode", authPaymentResult.get("authCode"));
>>>>>>                      return results;
>>>>>>                  } else {
>>>>>>                      boolean needsNsfRetry = needsNsfRetry(orderPaymentPreference, authPaymentResult, delegator);
>>>>>> @@ -399,6 +400,9 @@ public class PaymentGatewayServices {
>>>>>>              continue;
>>>>>>          }
>>>>>> 
>>>>>> +            // add authorization code to the result
>>>>>> +            result.put("authCode", results.get("authCode"));
>>>>>> +
>>>>>>          if (ServiceUtil.isError(results)) {
>>>>>>              hadError += 1;
>>>>>>              messages.add("Could not authorize OrderPaymentPreference [" + paymentPref.getString("orderPaymentPreferenceId") + "] for order [" + orderId + "]: " + results.get(ModelService.ERROR_MESSAGE));
>>>>>> 
>>>>>> Modified: ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/thirdparty/cybersource/IcsPaymentServices.java
>>>>>> URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/thirdparty/cybersource/IcsPaymentServices.java?rev=1071517&r1=1071516&r2=1071517&view=diff
>>>>>> ==============================================================================
>>>>>> --- ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/thirdparty/cybersource/IcsPaymentServices.java (original)
>>>>>> +++ ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/thirdparty/cybersource/IcsPaymentServices.java Thu Feb 17 06:57:51 2011
>>>>>> @@ -536,12 +536,17 @@ public class IcsPaymentServices {
>>>>>> 
>>>>>>  private static void processAuthResult(Map<String, Object> reply, Map<String, Object> result) {
>>>>>>      String decision = getDecision(reply);
>>>>>> +        String checkModeStatus = UtilProperties.getPropertyValue("payment.properties", "payment.cybersource.ignoreStatus");
>>>>>>      if ("ACCEPT".equalsIgnoreCase(decision)) {
>>>>>>          result.put("authCode", reply.get("ccAuthReply_authorizationCode"));
>>>>>>          result.put("authResult", Boolean.TRUE);
>>>>>>      } else {
>>>>>>          result.put("authCode", decision);
>>>>>> -            result.put("authResult", Boolean.FALSE);
>>>>>> +            if ("N".equals(checkModeStatus)) {
>>>>>> +                result.put("authResult", Boolean.FALSE);
>>>>>> +            } else {
>>>>>> +                result.put("authResult", Boolean.TRUE);
>>>>>> +            }
>>>>>>          // TODO: based on reasonCode populate the following flags as applicable: resultDeclined, resultNsf, resultBadExpire, resultBadCardNumber
>>>>>>      }
>>>>>> 
>>>>>> 
>>>>>> Modified: ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/CheckOutHelper.java
>>>>>> URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/CheckOutHelper.java?rev=1071517&r1=1071516&r2=1071517&view=diff
>>>>>> ==============================================================================
>>>>>> --- ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/CheckOutHelper.java (original)
>>>>>> +++ ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/CheckOutHelper.java Thu Feb 17 06:57:51 2011
>>>>>> @@ -1067,9 +1067,27 @@ public class CheckOutHelper {
>>>>>> 
>>>>>>                  // set the order and item status to approved
>>>>>>                  if (autoApproveOrder) {
>>>>>> -                        boolean ok = OrderChangeHelper.approveOrder(dispatcher, userLogin, orderId, manualHold);
>>>>>> -                        if (!ok) {
>>>>>> -                            throw new GeneralException("Problem with order change; see above error");
>>>>>> +                        List<GenericValue> productStorePaymentSettingList = delegator.findByAnd("ProductStorePaymentSetting", UtilMisc.toMap("productStoreId", productStore.getString("productStoreId"), "paymentMethodTypeId", "CREDIT_CARD", "paymentService", "cyberSourceCCAuth"));
>>>>>> +                        if (productStorePaymentSettingList.size() > 0) {
>>>>>> +                            String decision = (String) paymentResult.get("authCode");
>>>>>> +                            if (UtilValidate.isNotEmpty(decision)) {
>>>>>> +                                if ("ACCEPT".equalsIgnoreCase(decision)) {
>>>>>> +                                    boolean ok = OrderChangeHelper.approveOrder(dispatcher, userLogin, orderId, manualHold);
>>>>>> +                                    if (!ok) {
>>>>>> +                                        throw new GeneralException("Problem with order change; see above error");
>>>>>> +                                    }
>>>>>> +                                }
>>>>>> +                            } else {
>>>>>> +                                boolean ok = OrderChangeHelper.approveOrder(dispatcher, userLogin, orderId, manualHold);
>>>>>> +                                if (!ok) {
>>>>>> +                                    throw new GeneralException("Problem with order change; see above error");
>>>>>> +                                }
>>>>>> +                            }
>>>>>> +                        } else {
>>>>>> +                            boolean ok = OrderChangeHelper.approveOrder(dispatcher, userLogin, orderId, manualHold);
>>>>>> +                            if (!ok) {
>>>>>> +                                throw new GeneralException("Problem with order change; see above error");
>>>>>> +                            }
>>>>>>                      }
>>>>>>                  }
>>>>>>              } else if (authResp.equals("ERROR")) {
>>>>>> 
>>>>>> 
>>>>> 
>>>> 
>>>> -- 
>>>> Ofbiz on twitter: http://twitter.com/apache_ofbiz
>>>> Myself on twitter: http://twitter.com/hansbak
>>>> Antwebsystems.com: Quality services for competitive rates.
>>>> 
>>> 
>> 
>> -- 
>> Ofbiz on twitter: http://twitter.com/apache_ofbiz
>> Myself on twitter: http://twitter.com/hansbak
>> Antwebsystems.com: Quality services for competitive rates.
>> 
> 


Re: svn commit: r1071517 - in /ofbiz/trunk/applications: accounting/config/ accounting/servicedef/ accounting/src/org/ofbiz/accounting/payment/ accounting/src/org/ofbiz/accounting/thirdparty/cybersource/ order/src/org/ofbiz/order/shoppingcart/

Posted by Scott Gray <sc...@hotwaxmedia.com>.
That's really not good enough, but I'm not going to waste my time arguing with you.

Regards
Scott

On 17/02/2011, at 11:00 PM, Hans Bakker wrote:

> no sorry Scott, this option is only for this payment method, other
> payment methods used: paypal, google.
> 
> One could sure have this setting at a higher level, however still it
> needs an override at a lower level too.....
> 
> I am sorry, but this is all I can say and do not have more time to spend
> on this.
> 
> Regards,
> Hans
> 
> 
> 
> On Thu, 2011-02-17 at 22:52 +1300, Scott Gray wrote:
>> But you're typically only using one payment processor per store right?  So the store settings should be sufficient, but even if not this should really be solved in a more generic way with some sort of setting at a higher level.
>> 
>> Also it looks like your using the deprecated payment.properties for configuration instead of the PaymentGatewayConfig entities.
>> 
>> Regards
>> Scott
>> 
>> On 17/02/2011, at 10:28 PM, Hans Bakker wrote:
>> 
>>> This feature is not always for all paymentmethods for every order.
>>> 
>>> Certain payment processors can be easily checked and approved afterwards
>>> with the payment processor while others do not have this feature.
>>> 
>>> Regards,
>>> Hans
>>> 
>>> 
>>> On Thu, 2011-02-17 at 22:11 +1300, Scott Gray wrote:
>>>> Hi Hans,
>>>> 
>>>> Isn't that more of an order related setting rather than anything the payment gateway needs to worry about?  Surely we already have processes for this sort of thing?
>>>> 
>>>> Also, we're going to end up with a hell of a mess if we keep putting payment processor specific code in the order logic.
>>>> 
>>>> Regards
>>>> Scott
>>>> 
>>>> On 17/02/2011, at 7:57 PM, hansbak@apache.org wrote:
>>>> 
>>>>> Author: hansbak
>>>>> Date: Thu Feb 17 06:57:51 2011
>>>>> New Revision: 1071517
>>>>> 
>>>>> URL: http://svn.apache.org/viewvc?rev=1071517&view=rev
>>>>> Log:
>>>>> update to cybersource payment gateway: added a properties setting that orders are still accepted but put into the created stage when a credit card fails authorisation. The default is the current setting: order is not created
>>>>> 
>>>>> Modified:
>>>>>  ofbiz/trunk/applications/accounting/config/payment.properties
>>>>>  ofbiz/trunk/applications/accounting/servicedef/services_paymentmethod.xml
>>>>>  ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/payment/PaymentGatewayServices.java
>>>>>  ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/thirdparty/cybersource/IcsPaymentServices.java
>>>>>  ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/CheckOutHelper.java
>>>>> 
>>>>> Modified: ofbiz/trunk/applications/accounting/config/payment.properties
>>>>> URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/config/payment.properties?rev=1071517&r1=1071516&r2=1071517&view=diff
>>>>> ==============================================================================
>>>>> --- ofbiz/trunk/applications/accounting/config/payment.properties (original)
>>>>> +++ ofbiz/trunk/applications/accounting/config/payment.properties Thu Feb 17 06:57:51 2011
>>>>> @@ -118,6 +118,12 @@ payment.cybersource.ignoreAvs=false
>>>>> # AVS Decline Codes -- May not be supported any longer
>>>>> #payment.cybersource.avsDeclineCodes=
>>>>> 
>>>>> +# Ignore status of cybersource transaction reply  (Y|N) (if cybersource response transaction status not equals "ACCEPT" then OFBiz will still create the order but in status 'created'.
>>>>> +# default N = Don't create order if cybersource reported transaction status not equals "ACCEPT".
>>>>> +payment.cybersource.ignoreStatus=N
>>>>> +# It happens pretty often that a creditcard is rejected for not valid reasons, one can check to Cybersource fraud queue and after that the order can still be rejected or approved.
>>>>> +
>>>>> +
>>>>> ############################################
>>>>> # ClearCommerce Configuration
>>>>> ############################################
>>>>> 
>>>>> Modified: ofbiz/trunk/applications/accounting/servicedef/services_paymentmethod.xml
>>>>> URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/servicedef/services_paymentmethod.xml?rev=1071517&r1=1071516&r2=1071517&view=diff
>>>>> ==============================================================================
>>>>> --- ofbiz/trunk/applications/accounting/servicedef/services_paymentmethod.xml (original)
>>>>> +++ ofbiz/trunk/applications/accounting/servicedef/services_paymentmethod.xml Thu Feb 17 06:57:51 2011
>>>>> @@ -267,6 +267,7 @@ under the License.
>>>>>       <attribute name="errors" type="Boolean" mode="OUT" optional="false"/>
>>>>>       <attribute name="messages" type="List" mode="OUT" optional="true"/>
>>>>>       <attribute name="processAmount" type="BigDecimal" mode="OUT" optional="true"/>
>>>>> +        <attribute name="authCode" type="String" mode="OUT" optional="true"/>
>>>>>   </service>
>>>>> 
>>>>>   <service name="authOrderPayments" engine="java"
>>>>> @@ -276,6 +277,7 @@ under the License.
>>>>>       <attribute name="processResult" type="String" mode="OUT" optional="false"/>
>>>>>       <attribute name="authResultMsgs" type="List" mode="OUT" optional="true"/>
>>>>>       <attribute name="reAuth" type="Boolean" mode="IN" optional="true"/>
>>>>> +        <attribute name="authCode" type="String" mode="OUT" optional="true"/>
>>>>>   </service>
>>>>> 
>>>>>   <service name="releaseOrderPayments" engine="java"
>>>>> 
>>>>> Modified: ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/payment/PaymentGatewayServices.java
>>>>> URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/payment/PaymentGatewayServices.java?rev=1071517&r1=1071516&r2=1071517&view=diff
>>>>> ==============================================================================
>>>>> --- ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/payment/PaymentGatewayServices.java (original)
>>>>> +++ ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/payment/PaymentGatewayServices.java Thu Feb 17 06:57:51 2011
>>>>> @@ -201,6 +201,7 @@ public class PaymentGatewayServices {
>>>>>                       results.put("processAmount", thisAmount);
>>>>>                       results.put("finished", Boolean.TRUE);
>>>>>                       results.put("errors", Boolean.FALSE);
>>>>> +                        results.put("authCode", authPaymentResult.get("authCode"));
>>>>>                       return results;
>>>>>                   } else {
>>>>>                       boolean needsNsfRetry = needsNsfRetry(orderPaymentPreference, authPaymentResult, delegator);
>>>>> @@ -399,6 +400,9 @@ public class PaymentGatewayServices {
>>>>>               continue;
>>>>>           }
>>>>> 
>>>>> +            // add authorization code to the result
>>>>> +            result.put("authCode", results.get("authCode"));
>>>>> +
>>>>>           if (ServiceUtil.isError(results)) {
>>>>>               hadError += 1;
>>>>>               messages.add("Could not authorize OrderPaymentPreference [" + paymentPref.getString("orderPaymentPreferenceId") + "] for order [" + orderId + "]: " + results.get(ModelService.ERROR_MESSAGE));
>>>>> 
>>>>> Modified: ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/thirdparty/cybersource/IcsPaymentServices.java
>>>>> URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/thirdparty/cybersource/IcsPaymentServices.java?rev=1071517&r1=1071516&r2=1071517&view=diff
>>>>> ==============================================================================
>>>>> --- ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/thirdparty/cybersource/IcsPaymentServices.java (original)
>>>>> +++ ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/thirdparty/cybersource/IcsPaymentServices.java Thu Feb 17 06:57:51 2011
>>>>> @@ -536,12 +536,17 @@ public class IcsPaymentServices {
>>>>> 
>>>>>   private static void processAuthResult(Map<String, Object> reply, Map<String, Object> result) {
>>>>>       String decision = getDecision(reply);
>>>>> +        String checkModeStatus = UtilProperties.getPropertyValue("payment.properties", "payment.cybersource.ignoreStatus");
>>>>>       if ("ACCEPT".equalsIgnoreCase(decision)) {
>>>>>           result.put("authCode", reply.get("ccAuthReply_authorizationCode"));
>>>>>           result.put("authResult", Boolean.TRUE);
>>>>>       } else {
>>>>>           result.put("authCode", decision);
>>>>> -            result.put("authResult", Boolean.FALSE);
>>>>> +            if ("N".equals(checkModeStatus)) {
>>>>> +                result.put("authResult", Boolean.FALSE);
>>>>> +            } else {
>>>>> +                result.put("authResult", Boolean.TRUE);
>>>>> +            }
>>>>>           // TODO: based on reasonCode populate the following flags as applicable: resultDeclined, resultNsf, resultBadExpire, resultBadCardNumber
>>>>>       }
>>>>> 
>>>>> 
>>>>> Modified: ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/CheckOutHelper.java
>>>>> URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/CheckOutHelper.java?rev=1071517&r1=1071516&r2=1071517&view=diff
>>>>> ==============================================================================
>>>>> --- ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/CheckOutHelper.java (original)
>>>>> +++ ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/CheckOutHelper.java Thu Feb 17 06:57:51 2011
>>>>> @@ -1067,9 +1067,27 @@ public class CheckOutHelper {
>>>>> 
>>>>>                   // set the order and item status to approved
>>>>>                   if (autoApproveOrder) {
>>>>> -                        boolean ok = OrderChangeHelper.approveOrder(dispatcher, userLogin, orderId, manualHold);
>>>>> -                        if (!ok) {
>>>>> -                            throw new GeneralException("Problem with order change; see above error");
>>>>> +                        List<GenericValue> productStorePaymentSettingList = delegator.findByAnd("ProductStorePaymentSetting", UtilMisc.toMap("productStoreId", productStore.getString("productStoreId"), "paymentMethodTypeId", "CREDIT_CARD", "paymentService", "cyberSourceCCAuth"));
>>>>> +                        if (productStorePaymentSettingList.size() > 0) {
>>>>> +                            String decision = (String) paymentResult.get("authCode");
>>>>> +                            if (UtilValidate.isNotEmpty(decision)) {
>>>>> +                                if ("ACCEPT".equalsIgnoreCase(decision)) {
>>>>> +                                    boolean ok = OrderChangeHelper.approveOrder(dispatcher, userLogin, orderId, manualHold);
>>>>> +                                    if (!ok) {
>>>>> +                                        throw new GeneralException("Problem with order change; see above error");
>>>>> +                                    }
>>>>> +                                }
>>>>> +                            } else {
>>>>> +                                boolean ok = OrderChangeHelper.approveOrder(dispatcher, userLogin, orderId, manualHold);
>>>>> +                                if (!ok) {
>>>>> +                                    throw new GeneralException("Problem with order change; see above error");
>>>>> +                                }
>>>>> +                            }
>>>>> +                        } else {
>>>>> +                            boolean ok = OrderChangeHelper.approveOrder(dispatcher, userLogin, orderId, manualHold);
>>>>> +                            if (!ok) {
>>>>> +                                throw new GeneralException("Problem with order change; see above error");
>>>>> +                            }
>>>>>                       }
>>>>>                   }
>>>>>               } else if (authResp.equals("ERROR")) {
>>>>> 
>>>>> 
>>>> 
>>> 
>>> -- 
>>> Ofbiz on twitter: http://twitter.com/apache_ofbiz
>>> Myself on twitter: http://twitter.com/hansbak
>>> Antwebsystems.com: Quality services for competitive rates.
>>> 
>> 
> 
> -- 
> Ofbiz on twitter: http://twitter.com/apache_ofbiz
> Myself on twitter: http://twitter.com/hansbak
> Antwebsystems.com: Quality services for competitive rates.
> 


Re: svn commit: r1071517 - in /ofbiz/trunk/applications: accounting/config/ accounting/servicedef/ accounting/src/org/ofbiz/accounting/payment/ accounting/src/org/ofbiz/accounting/thirdparty/cybersource/ order/src/org/ofbiz/order/shoppingcart/

Posted by Hans Bakker <ma...@antwebsystems.com>.
no sorry Scott, this option is only for this payment method, other
payment methods used: paypal, google.

One could sure have this setting at a higher level, however still it
needs an override at a lower level too.....

I am sorry, but this is all I can say and do not have more time to spend
on this.

Regards,
Hans



On Thu, 2011-02-17 at 22:52 +1300, Scott Gray wrote:
> But you're typically only using one payment processor per store right?  So the store settings should be sufficient, but even if not this should really be solved in a more generic way with some sort of setting at a higher level.
> 
> Also it looks like your using the deprecated payment.properties for configuration instead of the PaymentGatewayConfig entities.
> 
> Regards
> Scott
> 
> On 17/02/2011, at 10:28 PM, Hans Bakker wrote:
> 
> > This feature is not always for all paymentmethods for every order.
> > 
> > Certain payment processors can be easily checked and approved afterwards
> > with the payment processor while others do not have this feature.
> > 
> > Regards,
> > Hans
> > 
> > 
> > On Thu, 2011-02-17 at 22:11 +1300, Scott Gray wrote:
> >> Hi Hans,
> >> 
> >> Isn't that more of an order related setting rather than anything the payment gateway needs to worry about?  Surely we already have processes for this sort of thing?
> >> 
> >> Also, we're going to end up with a hell of a mess if we keep putting payment processor specific code in the order logic.
> >> 
> >> Regards
> >> Scott
> >> 
> >> On 17/02/2011, at 7:57 PM, hansbak@apache.org wrote:
> >> 
> >>> Author: hansbak
> >>> Date: Thu Feb 17 06:57:51 2011
> >>> New Revision: 1071517
> >>> 
> >>> URL: http://svn.apache.org/viewvc?rev=1071517&view=rev
> >>> Log:
> >>> update to cybersource payment gateway: added a properties setting that orders are still accepted but put into the created stage when a credit card fails authorisation. The default is the current setting: order is not created
> >>> 
> >>> Modified:
> >>>   ofbiz/trunk/applications/accounting/config/payment.properties
> >>>   ofbiz/trunk/applications/accounting/servicedef/services_paymentmethod.xml
> >>>   ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/payment/PaymentGatewayServices.java
> >>>   ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/thirdparty/cybersource/IcsPaymentServices.java
> >>>   ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/CheckOutHelper.java
> >>> 
> >>> Modified: ofbiz/trunk/applications/accounting/config/payment.properties
> >>> URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/config/payment.properties?rev=1071517&r1=1071516&r2=1071517&view=diff
> >>> ==============================================================================
> >>> --- ofbiz/trunk/applications/accounting/config/payment.properties (original)
> >>> +++ ofbiz/trunk/applications/accounting/config/payment.properties Thu Feb 17 06:57:51 2011
> >>> @@ -118,6 +118,12 @@ payment.cybersource.ignoreAvs=false
> >>> # AVS Decline Codes -- May not be supported any longer
> >>> #payment.cybersource.avsDeclineCodes=
> >>> 
> >>> +# Ignore status of cybersource transaction reply  (Y|N) (if cybersource response transaction status not equals "ACCEPT" then OFBiz will still create the order but in status 'created'.
> >>> +# default N = Don't create order if cybersource reported transaction status not equals "ACCEPT".
> >>> +payment.cybersource.ignoreStatus=N
> >>> +# It happens pretty often that a creditcard is rejected for not valid reasons, one can check to Cybersource fraud queue and after that the order can still be rejected or approved.
> >>> +
> >>> +
> >>> ############################################
> >>> # ClearCommerce Configuration
> >>> ############################################
> >>> 
> >>> Modified: ofbiz/trunk/applications/accounting/servicedef/services_paymentmethod.xml
> >>> URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/servicedef/services_paymentmethod.xml?rev=1071517&r1=1071516&r2=1071517&view=diff
> >>> ==============================================================================
> >>> --- ofbiz/trunk/applications/accounting/servicedef/services_paymentmethod.xml (original)
> >>> +++ ofbiz/trunk/applications/accounting/servicedef/services_paymentmethod.xml Thu Feb 17 06:57:51 2011
> >>> @@ -267,6 +267,7 @@ under the License.
> >>>        <attribute name="errors" type="Boolean" mode="OUT" optional="false"/>
> >>>        <attribute name="messages" type="List" mode="OUT" optional="true"/>
> >>>        <attribute name="processAmount" type="BigDecimal" mode="OUT" optional="true"/>
> >>> +        <attribute name="authCode" type="String" mode="OUT" optional="true"/>
> >>>    </service>
> >>> 
> >>>    <service name="authOrderPayments" engine="java"
> >>> @@ -276,6 +277,7 @@ under the License.
> >>>        <attribute name="processResult" type="String" mode="OUT" optional="false"/>
> >>>        <attribute name="authResultMsgs" type="List" mode="OUT" optional="true"/>
> >>>        <attribute name="reAuth" type="Boolean" mode="IN" optional="true"/>
> >>> +        <attribute name="authCode" type="String" mode="OUT" optional="true"/>
> >>>    </service>
> >>> 
> >>>    <service name="releaseOrderPayments" engine="java"
> >>> 
> >>> Modified: ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/payment/PaymentGatewayServices.java
> >>> URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/payment/PaymentGatewayServices.java?rev=1071517&r1=1071516&r2=1071517&view=diff
> >>> ==============================================================================
> >>> --- ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/payment/PaymentGatewayServices.java (original)
> >>> +++ ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/payment/PaymentGatewayServices.java Thu Feb 17 06:57:51 2011
> >>> @@ -201,6 +201,7 @@ public class PaymentGatewayServices {
> >>>                        results.put("processAmount", thisAmount);
> >>>                        results.put("finished", Boolean.TRUE);
> >>>                        results.put("errors", Boolean.FALSE);
> >>> +                        results.put("authCode", authPaymentResult.get("authCode"));
> >>>                        return results;
> >>>                    } else {
> >>>                        boolean needsNsfRetry = needsNsfRetry(orderPaymentPreference, authPaymentResult, delegator);
> >>> @@ -399,6 +400,9 @@ public class PaymentGatewayServices {
> >>>                continue;
> >>>            }
> >>> 
> >>> +            // add authorization code to the result
> >>> +            result.put("authCode", results.get("authCode"));
> >>> +
> >>>            if (ServiceUtil.isError(results)) {
> >>>                hadError += 1;
> >>>                messages.add("Could not authorize OrderPaymentPreference [" + paymentPref.getString("orderPaymentPreferenceId") + "] for order [" + orderId + "]: " + results.get(ModelService.ERROR_MESSAGE));
> >>> 
> >>> Modified: ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/thirdparty/cybersource/IcsPaymentServices.java
> >>> URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/thirdparty/cybersource/IcsPaymentServices.java?rev=1071517&r1=1071516&r2=1071517&view=diff
> >>> ==============================================================================
> >>> --- ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/thirdparty/cybersource/IcsPaymentServices.java (original)
> >>> +++ ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/thirdparty/cybersource/IcsPaymentServices.java Thu Feb 17 06:57:51 2011
> >>> @@ -536,12 +536,17 @@ public class IcsPaymentServices {
> >>> 
> >>>    private static void processAuthResult(Map<String, Object> reply, Map<String, Object> result) {
> >>>        String decision = getDecision(reply);
> >>> +        String checkModeStatus = UtilProperties.getPropertyValue("payment.properties", "payment.cybersource.ignoreStatus");
> >>>        if ("ACCEPT".equalsIgnoreCase(decision)) {
> >>>            result.put("authCode", reply.get("ccAuthReply_authorizationCode"));
> >>>            result.put("authResult", Boolean.TRUE);
> >>>        } else {
> >>>            result.put("authCode", decision);
> >>> -            result.put("authResult", Boolean.FALSE);
> >>> +            if ("N".equals(checkModeStatus)) {
> >>> +                result.put("authResult", Boolean.FALSE);
> >>> +            } else {
> >>> +                result.put("authResult", Boolean.TRUE);
> >>> +            }
> >>>            // TODO: based on reasonCode populate the following flags as applicable: resultDeclined, resultNsf, resultBadExpire, resultBadCardNumber
> >>>        }
> >>> 
> >>> 
> >>> Modified: ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/CheckOutHelper.java
> >>> URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/CheckOutHelper.java?rev=1071517&r1=1071516&r2=1071517&view=diff
> >>> ==============================================================================
> >>> --- ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/CheckOutHelper.java (original)
> >>> +++ ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/CheckOutHelper.java Thu Feb 17 06:57:51 2011
> >>> @@ -1067,9 +1067,27 @@ public class CheckOutHelper {
> >>> 
> >>>                    // set the order and item status to approved
> >>>                    if (autoApproveOrder) {
> >>> -                        boolean ok = OrderChangeHelper.approveOrder(dispatcher, userLogin, orderId, manualHold);
> >>> -                        if (!ok) {
> >>> -                            throw new GeneralException("Problem with order change; see above error");
> >>> +                        List<GenericValue> productStorePaymentSettingList = delegator.findByAnd("ProductStorePaymentSetting", UtilMisc.toMap("productStoreId", productStore.getString("productStoreId"), "paymentMethodTypeId", "CREDIT_CARD", "paymentService", "cyberSourceCCAuth"));
> >>> +                        if (productStorePaymentSettingList.size() > 0) {
> >>> +                            String decision = (String) paymentResult.get("authCode");
> >>> +                            if (UtilValidate.isNotEmpty(decision)) {
> >>> +                                if ("ACCEPT".equalsIgnoreCase(decision)) {
> >>> +                                    boolean ok = OrderChangeHelper.approveOrder(dispatcher, userLogin, orderId, manualHold);
> >>> +                                    if (!ok) {
> >>> +                                        throw new GeneralException("Problem with order change; see above error");
> >>> +                                    }
> >>> +                                }
> >>> +                            } else {
> >>> +                                boolean ok = OrderChangeHelper.approveOrder(dispatcher, userLogin, orderId, manualHold);
> >>> +                                if (!ok) {
> >>> +                                    throw new GeneralException("Problem with order change; see above error");
> >>> +                                }
> >>> +                            }
> >>> +                        } else {
> >>> +                            boolean ok = OrderChangeHelper.approveOrder(dispatcher, userLogin, orderId, manualHold);
> >>> +                            if (!ok) {
> >>> +                                throw new GeneralException("Problem with order change; see above error");
> >>> +                            }
> >>>                        }
> >>>                    }
> >>>                } else if (authResp.equals("ERROR")) {
> >>> 
> >>> 
> >> 
> > 
> > -- 
> > Ofbiz on twitter: http://twitter.com/apache_ofbiz
> > Myself on twitter: http://twitter.com/hansbak
> > Antwebsystems.com: Quality services for competitive rates.
> > 
> 

-- 
Ofbiz on twitter: http://twitter.com/apache_ofbiz
Myself on twitter: http://twitter.com/hansbak
Antwebsystems.com: Quality services for competitive rates.


Re: svn commit: r1071517 - in /ofbiz/trunk/applications: accounting/config/ accounting/servicedef/ accounting/src/org/ofbiz/accounting/payment/ accounting/src/org/ofbiz/accounting/thirdparty/cybersource/ order/src/org/ofbiz/order/shoppingcart/

Posted by BJ Freeman <bj...@free-man.net>.
Paypal will reject under the condition that the person does not have a 
paypal account, uses a CC and it is declined or they input the wrong CC 
info to much.
I also have client that have the google check as a third option.
and to add the complexity Paypal has a invalid address config, though 
that was removed or not accepted in ofbiz.


=========================

BJ Freeman
Strategic Power Office with Supplier Automation  <http://www.businessesnetwork.com/automation/viewforum.php?f=52>
Specialtymarket.com  <http://www.specialtymarket.com/>
Systems Integrator-- Glad to Assist

Chat  Y! messenger: bjfr33man


Scott Gray sent the following on 2/17/2011 2:23 PM:
> Yes but paypal (express checkout at least) doesn't really decline authorizations, when the user gets taken to paypal's site they can't proceed if they don't have sufficient funds, hence the checkout process itself would end up cancelled rather than the order being declined.  I was thinking more in terms of only usually having one cc processor per store.
>
> IMO we should consider altering the way processors are associated to product stores at some point.  I think we might be better off with a single payment processor to product store record rather than one for each of auth, capture, refund, etc. etc., at the moment there isn't really anywhere to put store specific configurations that should affect the processor as a whole.
>
> Regards
> Scott
>
> HotWax Media
> http://www.hotwaxmedia.com
>
> On 18/02/2011, at 5:55 AM, BJ Freeman wrote:
>
>> many stores use atleast two processors,
>> one for CC processor, like Authorize net to their bank, one for Paypal.
>>
>> =========================
>> BJ Freeman
>> Strategic Power Office with Supplier Automation<http://www.businessesnetwork.com/automation/viewforum.php?f=52>
>> Specialtymarket.com<http://www.specialtymarket.com/>
>> Systems Integrator-- Glad to Assist
>>
>> Chat  Y! messenger: bjfr33man
>>
>>
>> Scott Gray sent the following on 2/17/2011 1:52 AM:
>>> But you're typically only using one payment processor per store right?  So the store settings should be sufficient, but even if not this should really be solved in a more generic way with some sort of setting at a higher level.
>>>
>>> Also it looks like your using the deprecated payment.properties for configuration instead of the PaymentGatewayConfig entities.
>>>
>>> Regards
>>> Scott
>>>
>>> On 17/02/2011, at 10:28 PM, Hans Bakker wrote:
>>>
>>>> This feature is not always for all paymentmethods for every order.
>>>>
>>>> Certain payment processors can be easily checked and approved afterwards
>>>> with the payment processor while others do not have this feature.
>>>>
>>>> Regards,
>>>> Hans
>>>>
>>>>
>>>> On Thu, 2011-02-17 at 22:11 +1300, Scott Gray wrote:
>>>>> Hi Hans,
>>>>>
>>>>> Isn't that more of an order related setting rather than anything the payment gateway needs to worry about?  Surely we already have processes for this sort of thing?
>>>>>
>>>>> Also, we're going to end up with a hell of a mess if we keep putting payment processor specific code in the order logic.
>>>>>
>>>>> Regards
>>>>> Scott
>>>>>
>>>>> On 17/02/2011, at 7:57 PM, hansbak@apache.org wrote:
>>>>>
>>>>>> Author: hansbak
>>>>>> Date: Thu Feb 17 06:57:51 2011
>>>>>> New Revision: 1071517
>>>>>>
>>>>>> URL: http://svn.apache.org/viewvc?rev=1071517&view=rev
>>>>>> Log:
>>>>>> update to cybersource payment gateway: added a properties setting that orders are still accepted but put into the created stage when a credit card fails authorisation. The default is the current setting: order is not created
>>>>>>
>>>>>> Modified:
>>>>>>    ofbiz/trunk/applications/accounting/config/payment.properties
>>>>>>    ofbiz/trunk/applications/accounting/servicedef/services_paymentmethod.xml
>>>>>>    ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/payment/PaymentGatewayServices.java
>>>>>>    ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/thirdparty/cybersource/IcsPaymentServices.java
>>>>>>    ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/CheckOutHelper.java
>>>>>>
>>>>>> Modified: ofbiz/trunk/applications/accounting/config/payment.properties
>>>>>> URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/config/payment.properties?rev=1071517&r1=1071516&r2=1071517&view=diff
>>>>>> ==============================================================================
>>>>>> --- ofbiz/trunk/applications/accounting/config/payment.properties (original)
>>>>>> +++ ofbiz/trunk/applications/accounting/config/payment.properties Thu Feb 17 06:57:51 2011
>>>>>> @@ -118,6 +118,12 @@ payment.cybersource.ignoreAvs=false
>>>>>> # AVS Decline Codes -- May not be supported any longer
>>>>>> #payment.cybersource.avsDeclineCodes=
>>>>>>
>>>>>> +# Ignore status of cybersource transaction reply  (Y|N) (if cybersource response transaction status not equals "ACCEPT" then OFBiz will still create the order but in status 'created'.
>>>>>> +# default N = Don't create order if cybersource reported transaction status not equals "ACCEPT".
>>>>>> +payment.cybersource.ignoreStatus=N
>>>>>> +# It happens pretty often that a creditcard is rejected for not valid reasons, one can check to Cybersource fraud queue and after that the order can still be rejected or approved.
>>>>>> +
>>>>>> +
>>>>>> ############################################
>>>>>> # ClearCommerce Configuration
>>>>>> ############################################
>>>>>>
>>>>>> Modified: ofbiz/trunk/applications/accounting/servicedef/services_paymentmethod.xml
>>>>>> URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/servicedef/services_paymentmethod.xml?rev=1071517&r1=1071516&r2=1071517&view=diff
>>>>>> ==============================================================================
>>>>>> --- ofbiz/trunk/applications/accounting/servicedef/services_paymentmethod.xml (original)
>>>>>> +++ ofbiz/trunk/applications/accounting/servicedef/services_paymentmethod.xml Thu Feb 17 06:57:51 2011
>>>>>> @@ -267,6 +267,7 @@ under the License.
>>>>>>         <attribute name="errors" type="Boolean" mode="OUT" optional="false"/>
>>>>>>         <attribute name="messages" type="List" mode="OUT" optional="true"/>
>>>>>>         <attribute name="processAmount" type="BigDecimal" mode="OUT" optional="true"/>
>>>>>> +<attribute name="authCode" type="String" mode="OUT" optional="true"/>
>>>>>>     </service>
>>>>>>
>>>>>>     <service name="authOrderPayments" engine="java"
>>>>>> @@ -276,6 +277,7 @@ under the License.
>>>>>>         <attribute name="processResult" type="String" mode="OUT" optional="false"/>
>>>>>>         <attribute name="authResultMsgs" type="List" mode="OUT" optional="true"/>
>>>>>>         <attribute name="reAuth" type="Boolean" mode="IN" optional="true"/>
>>>>>> +<attribute name="authCode" type="String" mode="OUT" optional="true"/>
>>>>>>     </service>
>>>>>>
>>>>>>     <service name="releaseOrderPayments" engine="java"
>>>>>>
>>>>>> Modified: ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/payment/PaymentGatewayServices.java
>>>>>> URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/payment/PaymentGatewayServices.java?rev=1071517&r1=1071516&r2=1071517&view=diff
>>>>>> ==============================================================================
>>>>>> --- ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/payment/PaymentGatewayServices.java (original)
>>>>>> +++ ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/payment/PaymentGatewayServices.java Thu Feb 17 06:57:51 2011
>>>>>> @@ -201,6 +201,7 @@ public class PaymentGatewayServices {
>>>>>>                         results.put("processAmount", thisAmount);
>>>>>>                         results.put("finished", Boolean.TRUE);
>>>>>>                         results.put("errors", Boolean.FALSE);
>>>>>> +                        results.put("authCode", authPaymentResult.get("authCode"));
>>>>>>                         return results;
>>>>>>                     } else {
>>>>>>                         boolean needsNsfRetry = needsNsfRetry(orderPaymentPreference, authPaymentResult, delegator);
>>>>>> @@ -399,6 +400,9 @@ public class PaymentGatewayServices {
>>>>>>                 continue;
>>>>>>             }
>>>>>>
>>>>>> +            // add authorization code to the result
>>>>>> +            result.put("authCode", results.get("authCode"));
>>>>>> +
>>>>>>             if (ServiceUtil.isError(results)) {
>>>>>>                 hadError += 1;
>>>>>>                 messages.add("Could not authorize OrderPaymentPreference [" + paymentPref.getString("orderPaymentPreferenceId") + "] for order [" + orderId + "]: " + results.get(ModelService.ERROR_MESSAGE));
>>>>>>
>>>>>> Modified: ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/thirdparty/cybersource/IcsPaymentServices.java
>>>>>> URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/thirdparty/cybersource/IcsPaymentServices.java?rev=1071517&r1=1071516&r2=1071517&view=diff
>>>>>> ==============================================================================
>>>>>> --- ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/thirdparty/cybersource/IcsPaymentServices.java (original)
>>>>>> +++ ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/thirdparty/cybersource/IcsPaymentServices.java Thu Feb 17 06:57:51 2011
>>>>>> @@ -536,12 +536,17 @@ public class IcsPaymentServices {
>>>>>>
>>>>>>     private static void processAuthResult(Map<String, Object>   reply, Map<String, Object>   result) {
>>>>>>         String decision = getDecision(reply);
>>>>>> +        String checkModeStatus = UtilProperties.getPropertyValue("payment.properties", "payment.cybersource.ignoreStatus");
>>>>>>         if ("ACCEPT".equalsIgnoreCase(decision)) {
>>>>>>             result.put("authCode", reply.get("ccAuthReply_authorizationCode"));
>>>>>>             result.put("authResult", Boolean.TRUE);
>>>>>>         } else {
>>>>>>             result.put("authCode", decision);
>>>>>> -            result.put("authResult", Boolean.FALSE);
>>>>>> +            if ("N".equals(checkModeStatus)) {
>>>>>> +                result.put("authResult", Boolean.FALSE);
>>>>>> +            } else {
>>>>>> +                result.put("authResult", Boolean.TRUE);
>>>>>> +            }
>>>>>>             // TODO: based on reasonCode populate the following flags as applicable: resultDeclined, resultNsf, resultBadExpire, resultBadCardNumber
>>>>>>         }
>>>>>>
>>>>>>
>>>>>> Modified: ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/CheckOutHelper.java
>>>>>> URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/CheckOutHelper.java?rev=1071517&r1=1071516&r2=1071517&view=diff
>>>>>> ==============================================================================
>>>>>> --- ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/CheckOutHelper.java (original)
>>>>>> +++ ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/CheckOutHelper.java Thu Feb 17 06:57:51 2011
>>>>>> @@ -1067,9 +1067,27 @@ public class CheckOutHelper {
>>>>>>
>>>>>>                     // set the order and item status to approved
>>>>>>                     if (autoApproveOrder) {
>>>>>> -                        boolean ok = OrderChangeHelper.approveOrder(dispatcher, userLogin, orderId, manualHold);
>>>>>> -                        if (!ok) {
>>>>>> -                            throw new GeneralException("Problem with order change; see above error");
>>>>>> +                        List<GenericValue>   productStorePaymentSettingList = delegator.findByAnd("ProductStorePaymentSetting", UtilMisc.toMap("productStoreId", productStore.getString("productStoreId"), "paymentMethodTypeId", "CREDIT_CARD", "paymentService", "cyberSourceCCAuth"));
>>>>>> +                        if (productStorePaymentSettingList.size()>   0) {
>>>>>> +                            String decision = (String) paymentResult.get("authCode");
>>>>>> +                            if (UtilValidate.isNotEmpty(decision)) {
>>>>>> +                                if ("ACCEPT".equalsIgnoreCase(decision)) {
>>>>>> +                                    boolean ok = OrderChangeHelper.approveOrder(dispatcher, userLogin, orderId, manualHold);
>>>>>> +                                    if (!ok) {
>>>>>> +                                        throw new GeneralException("Problem with order change; see above error");
>>>>>> +                                    }
>>>>>> +                                }
>>>>>> +                            } else {
>>>>>> +                                boolean ok = OrderChangeHelper.approveOrder(dispatcher, userLogin, orderId, manualHold);
>>>>>> +                                if (!ok) {
>>>>>> +                                    throw new GeneralException("Problem with order change; see above error");
>>>>>> +                                }
>>>>>> +                            }
>>>>>> +                        } else {
>>>>>> +                            boolean ok = OrderChangeHelper.approveOrder(dispatcher, userLogin, orderId, manualHold);
>>>>>> +                            if (!ok) {
>>>>>> +                                throw new GeneralException("Problem with order change; see above error");
>>>>>> +                            }
>>>>>>                         }
>>>>>>                     }
>>>>>>                 } else if (authResp.equals("ERROR")) {
>>>>>>
>>>>>>
>>>>>
>>>>
>>>> --
>>>> Ofbiz on twitter: http://twitter.com/apache_ofbiz
>>>> Myself on twitter: http://twitter.com/hansbak
>>>> Antwebsystems.com: Quality services for competitive rates.
>>>>
>>>
>>
>


Re: svn commit: r1071517 - in /ofbiz/trunk/applications: accounting/config/ accounting/servicedef/ accounting/src/org/ofbiz/accounting/payment/ accounting/src/org/ofbiz/accounting/thirdparty/cybersource/ order/src/org/ofbiz/order/shoppingcart/

Posted by Scott Gray <sc...@hotwaxmedia.com>.
Yes but paypal (express checkout at least) doesn't really decline authorizations, when the user gets taken to paypal's site they can't proceed if they don't have sufficient funds, hence the checkout process itself would end up cancelled rather than the order being declined.  I was thinking more in terms of only usually having one cc processor per store.

IMO we should consider altering the way processors are associated to product stores at some point.  I think we might be better off with a single payment processor to product store record rather than one for each of auth, capture, refund, etc. etc., at the moment there isn't really anywhere to put store specific configurations that should affect the processor as a whole.

Regards
Scott

HotWax Media
http://www.hotwaxmedia.com

On 18/02/2011, at 5:55 AM, BJ Freeman wrote:

> many stores use atleast two processors,
> one for CC processor, like Authorize net to their bank, one for Paypal.
> 
> =========================
> BJ Freeman
> Strategic Power Office with Supplier Automation  <http://www.businessesnetwork.com/automation/viewforum.php?f=52>
> Specialtymarket.com  <http://www.specialtymarket.com/>
> Systems Integrator-- Glad to Assist
> 
> Chat  Y! messenger: bjfr33man
> 
> 
> Scott Gray sent the following on 2/17/2011 1:52 AM:
>> But you're typically only using one payment processor per store right?  So the store settings should be sufficient, but even if not this should really be solved in a more generic way with some sort of setting at a higher level.
>> 
>> Also it looks like your using the deprecated payment.properties for configuration instead of the PaymentGatewayConfig entities.
>> 
>> Regards
>> Scott
>> 
>> On 17/02/2011, at 10:28 PM, Hans Bakker wrote:
>> 
>>> This feature is not always for all paymentmethods for every order.
>>> 
>>> Certain payment processors can be easily checked and approved afterwards
>>> with the payment processor while others do not have this feature.
>>> 
>>> Regards,
>>> Hans
>>> 
>>> 
>>> On Thu, 2011-02-17 at 22:11 +1300, Scott Gray wrote:
>>>> Hi Hans,
>>>> 
>>>> Isn't that more of an order related setting rather than anything the payment gateway needs to worry about?  Surely we already have processes for this sort of thing?
>>>> 
>>>> Also, we're going to end up with a hell of a mess if we keep putting payment processor specific code in the order logic.
>>>> 
>>>> Regards
>>>> Scott
>>>> 
>>>> On 17/02/2011, at 7:57 PM, hansbak@apache.org wrote:
>>>> 
>>>>> Author: hansbak
>>>>> Date: Thu Feb 17 06:57:51 2011
>>>>> New Revision: 1071517
>>>>> 
>>>>> URL: http://svn.apache.org/viewvc?rev=1071517&view=rev
>>>>> Log:
>>>>> update to cybersource payment gateway: added a properties setting that orders are still accepted but put into the created stage when a credit card fails authorisation. The default is the current setting: order is not created
>>>>> 
>>>>> Modified:
>>>>>   ofbiz/trunk/applications/accounting/config/payment.properties
>>>>>   ofbiz/trunk/applications/accounting/servicedef/services_paymentmethod.xml
>>>>>   ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/payment/PaymentGatewayServices.java
>>>>>   ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/thirdparty/cybersource/IcsPaymentServices.java
>>>>>   ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/CheckOutHelper.java
>>>>> 
>>>>> Modified: ofbiz/trunk/applications/accounting/config/payment.properties
>>>>> URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/config/payment.properties?rev=1071517&r1=1071516&r2=1071517&view=diff
>>>>> ==============================================================================
>>>>> --- ofbiz/trunk/applications/accounting/config/payment.properties (original)
>>>>> +++ ofbiz/trunk/applications/accounting/config/payment.properties Thu Feb 17 06:57:51 2011
>>>>> @@ -118,6 +118,12 @@ payment.cybersource.ignoreAvs=false
>>>>> # AVS Decline Codes -- May not be supported any longer
>>>>> #payment.cybersource.avsDeclineCodes=
>>>>> 
>>>>> +# Ignore status of cybersource transaction reply  (Y|N) (if cybersource response transaction status not equals "ACCEPT" then OFBiz will still create the order but in status 'created'.
>>>>> +# default N = Don't create order if cybersource reported transaction status not equals "ACCEPT".
>>>>> +payment.cybersource.ignoreStatus=N
>>>>> +# It happens pretty often that a creditcard is rejected for not valid reasons, one can check to Cybersource fraud queue and after that the order can still be rejected or approved.
>>>>> +
>>>>> +
>>>>> ############################################
>>>>> # ClearCommerce Configuration
>>>>> ############################################
>>>>> 
>>>>> Modified: ofbiz/trunk/applications/accounting/servicedef/services_paymentmethod.xml
>>>>> URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/servicedef/services_paymentmethod.xml?rev=1071517&r1=1071516&r2=1071517&view=diff
>>>>> ==============================================================================
>>>>> --- ofbiz/trunk/applications/accounting/servicedef/services_paymentmethod.xml (original)
>>>>> +++ ofbiz/trunk/applications/accounting/servicedef/services_paymentmethod.xml Thu Feb 17 06:57:51 2011
>>>>> @@ -267,6 +267,7 @@ under the License.
>>>>>        <attribute name="errors" type="Boolean" mode="OUT" optional="false"/>
>>>>>        <attribute name="messages" type="List" mode="OUT" optional="true"/>
>>>>>        <attribute name="processAmount" type="BigDecimal" mode="OUT" optional="true"/>
>>>>> +<attribute name="authCode" type="String" mode="OUT" optional="true"/>
>>>>>    </service>
>>>>> 
>>>>>    <service name="authOrderPayments" engine="java"
>>>>> @@ -276,6 +277,7 @@ under the License.
>>>>>        <attribute name="processResult" type="String" mode="OUT" optional="false"/>
>>>>>        <attribute name="authResultMsgs" type="List" mode="OUT" optional="true"/>
>>>>>        <attribute name="reAuth" type="Boolean" mode="IN" optional="true"/>
>>>>> +<attribute name="authCode" type="String" mode="OUT" optional="true"/>
>>>>>    </service>
>>>>> 
>>>>>    <service name="releaseOrderPayments" engine="java"
>>>>> 
>>>>> Modified: ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/payment/PaymentGatewayServices.java
>>>>> URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/payment/PaymentGatewayServices.java?rev=1071517&r1=1071516&r2=1071517&view=diff
>>>>> ==============================================================================
>>>>> --- ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/payment/PaymentGatewayServices.java (original)
>>>>> +++ ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/payment/PaymentGatewayServices.java Thu Feb 17 06:57:51 2011
>>>>> @@ -201,6 +201,7 @@ public class PaymentGatewayServices {
>>>>>                        results.put("processAmount", thisAmount);
>>>>>                        results.put("finished", Boolean.TRUE);
>>>>>                        results.put("errors", Boolean.FALSE);
>>>>> +                        results.put("authCode", authPaymentResult.get("authCode"));
>>>>>                        return results;
>>>>>                    } else {
>>>>>                        boolean needsNsfRetry = needsNsfRetry(orderPaymentPreference, authPaymentResult, delegator);
>>>>> @@ -399,6 +400,9 @@ public class PaymentGatewayServices {
>>>>>                continue;
>>>>>            }
>>>>> 
>>>>> +            // add authorization code to the result
>>>>> +            result.put("authCode", results.get("authCode"));
>>>>> +
>>>>>            if (ServiceUtil.isError(results)) {
>>>>>                hadError += 1;
>>>>>                messages.add("Could not authorize OrderPaymentPreference [" + paymentPref.getString("orderPaymentPreferenceId") + "] for order [" + orderId + "]: " + results.get(ModelService.ERROR_MESSAGE));
>>>>> 
>>>>> Modified: ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/thirdparty/cybersource/IcsPaymentServices.java
>>>>> URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/thirdparty/cybersource/IcsPaymentServices.java?rev=1071517&r1=1071516&r2=1071517&view=diff
>>>>> ==============================================================================
>>>>> --- ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/thirdparty/cybersource/IcsPaymentServices.java (original)
>>>>> +++ ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/thirdparty/cybersource/IcsPaymentServices.java Thu Feb 17 06:57:51 2011
>>>>> @@ -536,12 +536,17 @@ public class IcsPaymentServices {
>>>>> 
>>>>>    private static void processAuthResult(Map<String, Object>  reply, Map<String, Object>  result) {
>>>>>        String decision = getDecision(reply);
>>>>> +        String checkModeStatus = UtilProperties.getPropertyValue("payment.properties", "payment.cybersource.ignoreStatus");
>>>>>        if ("ACCEPT".equalsIgnoreCase(decision)) {
>>>>>            result.put("authCode", reply.get("ccAuthReply_authorizationCode"));
>>>>>            result.put("authResult", Boolean.TRUE);
>>>>>        } else {
>>>>>            result.put("authCode", decision);
>>>>> -            result.put("authResult", Boolean.FALSE);
>>>>> +            if ("N".equals(checkModeStatus)) {
>>>>> +                result.put("authResult", Boolean.FALSE);
>>>>> +            } else {
>>>>> +                result.put("authResult", Boolean.TRUE);
>>>>> +            }
>>>>>            // TODO: based on reasonCode populate the following flags as applicable: resultDeclined, resultNsf, resultBadExpire, resultBadCardNumber
>>>>>        }
>>>>> 
>>>>> 
>>>>> Modified: ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/CheckOutHelper.java
>>>>> URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/CheckOutHelper.java?rev=1071517&r1=1071516&r2=1071517&view=diff
>>>>> ==============================================================================
>>>>> --- ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/CheckOutHelper.java (original)
>>>>> +++ ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/CheckOutHelper.java Thu Feb 17 06:57:51 2011
>>>>> @@ -1067,9 +1067,27 @@ public class CheckOutHelper {
>>>>> 
>>>>>                    // set the order and item status to approved
>>>>>                    if (autoApproveOrder) {
>>>>> -                        boolean ok = OrderChangeHelper.approveOrder(dispatcher, userLogin, orderId, manualHold);
>>>>> -                        if (!ok) {
>>>>> -                            throw new GeneralException("Problem with order change; see above error");
>>>>> +                        List<GenericValue>  productStorePaymentSettingList = delegator.findByAnd("ProductStorePaymentSetting", UtilMisc.toMap("productStoreId", productStore.getString("productStoreId"), "paymentMethodTypeId", "CREDIT_CARD", "paymentService", "cyberSourceCCAuth"));
>>>>> +                        if (productStorePaymentSettingList.size()>  0) {
>>>>> +                            String decision = (String) paymentResult.get("authCode");
>>>>> +                            if (UtilValidate.isNotEmpty(decision)) {
>>>>> +                                if ("ACCEPT".equalsIgnoreCase(decision)) {
>>>>> +                                    boolean ok = OrderChangeHelper.approveOrder(dispatcher, userLogin, orderId, manualHold);
>>>>> +                                    if (!ok) {
>>>>> +                                        throw new GeneralException("Problem with order change; see above error");
>>>>> +                                    }
>>>>> +                                }
>>>>> +                            } else {
>>>>> +                                boolean ok = OrderChangeHelper.approveOrder(dispatcher, userLogin, orderId, manualHold);
>>>>> +                                if (!ok) {
>>>>> +                                    throw new GeneralException("Problem with order change; see above error");
>>>>> +                                }
>>>>> +                            }
>>>>> +                        } else {
>>>>> +                            boolean ok = OrderChangeHelper.approveOrder(dispatcher, userLogin, orderId, manualHold);
>>>>> +                            if (!ok) {
>>>>> +                                throw new GeneralException("Problem with order change; see above error");
>>>>> +                            }
>>>>>                        }
>>>>>                    }
>>>>>                } else if (authResp.equals("ERROR")) {
>>>>> 
>>>>> 
>>>> 
>>> 
>>> --
>>> Ofbiz on twitter: http://twitter.com/apache_ofbiz
>>> Myself on twitter: http://twitter.com/hansbak
>>> Antwebsystems.com: Quality services for competitive rates.
>>> 
>> 
> 


Re: svn commit: r1071517 - in /ofbiz/trunk/applications: accounting/config/ accounting/servicedef/ accounting/src/org/ofbiz/accounting/payment/ accounting/src/org/ofbiz/accounting/thirdparty/cybersource/ order/src/org/ofbiz/order/shoppingcart/

Posted by BJ Freeman <bj...@free-man.net>.
many stores use atleast two processors,
one for CC processor, like Authorize net to their bank, one for Paypal.

=========================
BJ Freeman
Strategic Power Office with Supplier Automation  <http://www.businessesnetwork.com/automation/viewforum.php?f=52>
Specialtymarket.com  <http://www.specialtymarket.com/>
Systems Integrator-- Glad to Assist

Chat  Y! messenger: bjfr33man


Scott Gray sent the following on 2/17/2011 1:52 AM:
> But you're typically only using one payment processor per store right?  So the store settings should be sufficient, but even if not this should really be solved in a more generic way with some sort of setting at a higher level.
>
> Also it looks like your using the deprecated payment.properties for configuration instead of the PaymentGatewayConfig entities.
>
> Regards
> Scott
>
> On 17/02/2011, at 10:28 PM, Hans Bakker wrote:
>
>> This feature is not always for all paymentmethods for every order.
>>
>> Certain payment processors can be easily checked and approved afterwards
>> with the payment processor while others do not have this feature.
>>
>> Regards,
>> Hans
>>
>>
>> On Thu, 2011-02-17 at 22:11 +1300, Scott Gray wrote:
>>> Hi Hans,
>>>
>>> Isn't that more of an order related setting rather than anything the payment gateway needs to worry about?  Surely we already have processes for this sort of thing?
>>>
>>> Also, we're going to end up with a hell of a mess if we keep putting payment processor specific code in the order logic.
>>>
>>> Regards
>>> Scott
>>>
>>> On 17/02/2011, at 7:57 PM, hansbak@apache.org wrote:
>>>
>>>> Author: hansbak
>>>> Date: Thu Feb 17 06:57:51 2011
>>>> New Revision: 1071517
>>>>
>>>> URL: http://svn.apache.org/viewvc?rev=1071517&view=rev
>>>> Log:
>>>> update to cybersource payment gateway: added a properties setting that orders are still accepted but put into the created stage when a credit card fails authorisation. The default is the current setting: order is not created
>>>>
>>>> Modified:
>>>>    ofbiz/trunk/applications/accounting/config/payment.properties
>>>>    ofbiz/trunk/applications/accounting/servicedef/services_paymentmethod.xml
>>>>    ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/payment/PaymentGatewayServices.java
>>>>    ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/thirdparty/cybersource/IcsPaymentServices.java
>>>>    ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/CheckOutHelper.java
>>>>
>>>> Modified: ofbiz/trunk/applications/accounting/config/payment.properties
>>>> URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/config/payment.properties?rev=1071517&r1=1071516&r2=1071517&view=diff
>>>> ==============================================================================
>>>> --- ofbiz/trunk/applications/accounting/config/payment.properties (original)
>>>> +++ ofbiz/trunk/applications/accounting/config/payment.properties Thu Feb 17 06:57:51 2011
>>>> @@ -118,6 +118,12 @@ payment.cybersource.ignoreAvs=false
>>>> # AVS Decline Codes -- May not be supported any longer
>>>> #payment.cybersource.avsDeclineCodes=
>>>>
>>>> +# Ignore status of cybersource transaction reply  (Y|N) (if cybersource response transaction status not equals "ACCEPT" then OFBiz will still create the order but in status 'created'.
>>>> +# default N = Don't create order if cybersource reported transaction status not equals "ACCEPT".
>>>> +payment.cybersource.ignoreStatus=N
>>>> +# It happens pretty often that a creditcard is rejected for not valid reasons, one can check to Cybersource fraud queue and after that the order can still be rejected or approved.
>>>> +
>>>> +
>>>> ############################################
>>>> # ClearCommerce Configuration
>>>> ############################################
>>>>
>>>> Modified: ofbiz/trunk/applications/accounting/servicedef/services_paymentmethod.xml
>>>> URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/servicedef/services_paymentmethod.xml?rev=1071517&r1=1071516&r2=1071517&view=diff
>>>> ==============================================================================
>>>> --- ofbiz/trunk/applications/accounting/servicedef/services_paymentmethod.xml (original)
>>>> +++ ofbiz/trunk/applications/accounting/servicedef/services_paymentmethod.xml Thu Feb 17 06:57:51 2011
>>>> @@ -267,6 +267,7 @@ under the License.
>>>>         <attribute name="errors" type="Boolean" mode="OUT" optional="false"/>
>>>>         <attribute name="messages" type="List" mode="OUT" optional="true"/>
>>>>         <attribute name="processAmount" type="BigDecimal" mode="OUT" optional="true"/>
>>>> +<attribute name="authCode" type="String" mode="OUT" optional="true"/>
>>>>     </service>
>>>>
>>>>     <service name="authOrderPayments" engine="java"
>>>> @@ -276,6 +277,7 @@ under the License.
>>>>         <attribute name="processResult" type="String" mode="OUT" optional="false"/>
>>>>         <attribute name="authResultMsgs" type="List" mode="OUT" optional="true"/>
>>>>         <attribute name="reAuth" type="Boolean" mode="IN" optional="true"/>
>>>> +<attribute name="authCode" type="String" mode="OUT" optional="true"/>
>>>>     </service>
>>>>
>>>>     <service name="releaseOrderPayments" engine="java"
>>>>
>>>> Modified: ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/payment/PaymentGatewayServices.java
>>>> URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/payment/PaymentGatewayServices.java?rev=1071517&r1=1071516&r2=1071517&view=diff
>>>> ==============================================================================
>>>> --- ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/payment/PaymentGatewayServices.java (original)
>>>> +++ ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/payment/PaymentGatewayServices.java Thu Feb 17 06:57:51 2011
>>>> @@ -201,6 +201,7 @@ public class PaymentGatewayServices {
>>>>                         results.put("processAmount", thisAmount);
>>>>                         results.put("finished", Boolean.TRUE);
>>>>                         results.put("errors", Boolean.FALSE);
>>>> +                        results.put("authCode", authPaymentResult.get("authCode"));
>>>>                         return results;
>>>>                     } else {
>>>>                         boolean needsNsfRetry = needsNsfRetry(orderPaymentPreference, authPaymentResult, delegator);
>>>> @@ -399,6 +400,9 @@ public class PaymentGatewayServices {
>>>>                 continue;
>>>>             }
>>>>
>>>> +            // add authorization code to the result
>>>> +            result.put("authCode", results.get("authCode"));
>>>> +
>>>>             if (ServiceUtil.isError(results)) {
>>>>                 hadError += 1;
>>>>                 messages.add("Could not authorize OrderPaymentPreference [" + paymentPref.getString("orderPaymentPreferenceId") + "] for order [" + orderId + "]: " + results.get(ModelService.ERROR_MESSAGE));
>>>>
>>>> Modified: ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/thirdparty/cybersource/IcsPaymentServices.java
>>>> URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/thirdparty/cybersource/IcsPaymentServices.java?rev=1071517&r1=1071516&r2=1071517&view=diff
>>>> ==============================================================================
>>>> --- ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/thirdparty/cybersource/IcsPaymentServices.java (original)
>>>> +++ ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/thirdparty/cybersource/IcsPaymentServices.java Thu Feb 17 06:57:51 2011
>>>> @@ -536,12 +536,17 @@ public class IcsPaymentServices {
>>>>
>>>>     private static void processAuthResult(Map<String, Object>  reply, Map<String, Object>  result) {
>>>>         String decision = getDecision(reply);
>>>> +        String checkModeStatus = UtilProperties.getPropertyValue("payment.properties", "payment.cybersource.ignoreStatus");
>>>>         if ("ACCEPT".equalsIgnoreCase(decision)) {
>>>>             result.put("authCode", reply.get("ccAuthReply_authorizationCode"));
>>>>             result.put("authResult", Boolean.TRUE);
>>>>         } else {
>>>>             result.put("authCode", decision);
>>>> -            result.put("authResult", Boolean.FALSE);
>>>> +            if ("N".equals(checkModeStatus)) {
>>>> +                result.put("authResult", Boolean.FALSE);
>>>> +            } else {
>>>> +                result.put("authResult", Boolean.TRUE);
>>>> +            }
>>>>             // TODO: based on reasonCode populate the following flags as applicable: resultDeclined, resultNsf, resultBadExpire, resultBadCardNumber
>>>>         }
>>>>
>>>>
>>>> Modified: ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/CheckOutHelper.java
>>>> URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/CheckOutHelper.java?rev=1071517&r1=1071516&r2=1071517&view=diff
>>>> ==============================================================================
>>>> --- ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/CheckOutHelper.java (original)
>>>> +++ ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/CheckOutHelper.java Thu Feb 17 06:57:51 2011
>>>> @@ -1067,9 +1067,27 @@ public class CheckOutHelper {
>>>>
>>>>                     // set the order and item status to approved
>>>>                     if (autoApproveOrder) {
>>>> -                        boolean ok = OrderChangeHelper.approveOrder(dispatcher, userLogin, orderId, manualHold);
>>>> -                        if (!ok) {
>>>> -                            throw new GeneralException("Problem with order change; see above error");
>>>> +                        List<GenericValue>  productStorePaymentSettingList = delegator.findByAnd("ProductStorePaymentSetting", UtilMisc.toMap("productStoreId", productStore.getString("productStoreId"), "paymentMethodTypeId", "CREDIT_CARD", "paymentService", "cyberSourceCCAuth"));
>>>> +                        if (productStorePaymentSettingList.size()>  0) {
>>>> +                            String decision = (String) paymentResult.get("authCode");
>>>> +                            if (UtilValidate.isNotEmpty(decision)) {
>>>> +                                if ("ACCEPT".equalsIgnoreCase(decision)) {
>>>> +                                    boolean ok = OrderChangeHelper.approveOrder(dispatcher, userLogin, orderId, manualHold);
>>>> +                                    if (!ok) {
>>>> +                                        throw new GeneralException("Problem with order change; see above error");
>>>> +                                    }
>>>> +                                }
>>>> +                            } else {
>>>> +                                boolean ok = OrderChangeHelper.approveOrder(dispatcher, userLogin, orderId, manualHold);
>>>> +                                if (!ok) {
>>>> +                                    throw new GeneralException("Problem with order change; see above error");
>>>> +                                }
>>>> +                            }
>>>> +                        } else {
>>>> +                            boolean ok = OrderChangeHelper.approveOrder(dispatcher, userLogin, orderId, manualHold);
>>>> +                            if (!ok) {
>>>> +                                throw new GeneralException("Problem with order change; see above error");
>>>> +                            }
>>>>                         }
>>>>                     }
>>>>                 } else if (authResp.equals("ERROR")) {
>>>>
>>>>
>>>
>>
>> --
>> Ofbiz on twitter: http://twitter.com/apache_ofbiz
>> Myself on twitter: http://twitter.com/hansbak
>> Antwebsystems.com: Quality services for competitive rates.
>>
>


Re: svn commit: r1071517 - in /ofbiz/trunk/applications: accounting/config/ accounting/servicedef/ accounting/src/org/ofbiz/accounting/payment/ accounting/src/org/ofbiz/accounting/thirdparty/cybersource/ order/src/org/ofbiz/order/shoppingcart/

Posted by Scott Gray <sc...@hotwaxmedia.com>.
But you're typically only using one payment processor per store right?  So the store settings should be sufficient, but even if not this should really be solved in a more generic way with some sort of setting at a higher level.

Also it looks like your using the deprecated payment.properties for configuration instead of the PaymentGatewayConfig entities.

Regards
Scott

On 17/02/2011, at 10:28 PM, Hans Bakker wrote:

> This feature is not always for all paymentmethods for every order.
> 
> Certain payment processors can be easily checked and approved afterwards
> with the payment processor while others do not have this feature.
> 
> Regards,
> Hans
> 
> 
> On Thu, 2011-02-17 at 22:11 +1300, Scott Gray wrote:
>> Hi Hans,
>> 
>> Isn't that more of an order related setting rather than anything the payment gateway needs to worry about?  Surely we already have processes for this sort of thing?
>> 
>> Also, we're going to end up with a hell of a mess if we keep putting payment processor specific code in the order logic.
>> 
>> Regards
>> Scott
>> 
>> On 17/02/2011, at 7:57 PM, hansbak@apache.org wrote:
>> 
>>> Author: hansbak
>>> Date: Thu Feb 17 06:57:51 2011
>>> New Revision: 1071517
>>> 
>>> URL: http://svn.apache.org/viewvc?rev=1071517&view=rev
>>> Log:
>>> update to cybersource payment gateway: added a properties setting that orders are still accepted but put into the created stage when a credit card fails authorisation. The default is the current setting: order is not created
>>> 
>>> Modified:
>>>   ofbiz/trunk/applications/accounting/config/payment.properties
>>>   ofbiz/trunk/applications/accounting/servicedef/services_paymentmethod.xml
>>>   ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/payment/PaymentGatewayServices.java
>>>   ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/thirdparty/cybersource/IcsPaymentServices.java
>>>   ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/CheckOutHelper.java
>>> 
>>> Modified: ofbiz/trunk/applications/accounting/config/payment.properties
>>> URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/config/payment.properties?rev=1071517&r1=1071516&r2=1071517&view=diff
>>> ==============================================================================
>>> --- ofbiz/trunk/applications/accounting/config/payment.properties (original)
>>> +++ ofbiz/trunk/applications/accounting/config/payment.properties Thu Feb 17 06:57:51 2011
>>> @@ -118,6 +118,12 @@ payment.cybersource.ignoreAvs=false
>>> # AVS Decline Codes -- May not be supported any longer
>>> #payment.cybersource.avsDeclineCodes=
>>> 
>>> +# Ignore status of cybersource transaction reply  (Y|N) (if cybersource response transaction status not equals "ACCEPT" then OFBiz will still create the order but in status 'created'.
>>> +# default N = Don't create order if cybersource reported transaction status not equals "ACCEPT".
>>> +payment.cybersource.ignoreStatus=N
>>> +# It happens pretty often that a creditcard is rejected for not valid reasons, one can check to Cybersource fraud queue and after that the order can still be rejected or approved.
>>> +
>>> +
>>> ############################################
>>> # ClearCommerce Configuration
>>> ############################################
>>> 
>>> Modified: ofbiz/trunk/applications/accounting/servicedef/services_paymentmethod.xml
>>> URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/servicedef/services_paymentmethod.xml?rev=1071517&r1=1071516&r2=1071517&view=diff
>>> ==============================================================================
>>> --- ofbiz/trunk/applications/accounting/servicedef/services_paymentmethod.xml (original)
>>> +++ ofbiz/trunk/applications/accounting/servicedef/services_paymentmethod.xml Thu Feb 17 06:57:51 2011
>>> @@ -267,6 +267,7 @@ under the License.
>>>        <attribute name="errors" type="Boolean" mode="OUT" optional="false"/>
>>>        <attribute name="messages" type="List" mode="OUT" optional="true"/>
>>>        <attribute name="processAmount" type="BigDecimal" mode="OUT" optional="true"/>
>>> +        <attribute name="authCode" type="String" mode="OUT" optional="true"/>
>>>    </service>
>>> 
>>>    <service name="authOrderPayments" engine="java"
>>> @@ -276,6 +277,7 @@ under the License.
>>>        <attribute name="processResult" type="String" mode="OUT" optional="false"/>
>>>        <attribute name="authResultMsgs" type="List" mode="OUT" optional="true"/>
>>>        <attribute name="reAuth" type="Boolean" mode="IN" optional="true"/>
>>> +        <attribute name="authCode" type="String" mode="OUT" optional="true"/>
>>>    </service>
>>> 
>>>    <service name="releaseOrderPayments" engine="java"
>>> 
>>> Modified: ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/payment/PaymentGatewayServices.java
>>> URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/payment/PaymentGatewayServices.java?rev=1071517&r1=1071516&r2=1071517&view=diff
>>> ==============================================================================
>>> --- ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/payment/PaymentGatewayServices.java (original)
>>> +++ ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/payment/PaymentGatewayServices.java Thu Feb 17 06:57:51 2011
>>> @@ -201,6 +201,7 @@ public class PaymentGatewayServices {
>>>                        results.put("processAmount", thisAmount);
>>>                        results.put("finished", Boolean.TRUE);
>>>                        results.put("errors", Boolean.FALSE);
>>> +                        results.put("authCode", authPaymentResult.get("authCode"));
>>>                        return results;
>>>                    } else {
>>>                        boolean needsNsfRetry = needsNsfRetry(orderPaymentPreference, authPaymentResult, delegator);
>>> @@ -399,6 +400,9 @@ public class PaymentGatewayServices {
>>>                continue;
>>>            }
>>> 
>>> +            // add authorization code to the result
>>> +            result.put("authCode", results.get("authCode"));
>>> +
>>>            if (ServiceUtil.isError(results)) {
>>>                hadError += 1;
>>>                messages.add("Could not authorize OrderPaymentPreference [" + paymentPref.getString("orderPaymentPreferenceId") + "] for order [" + orderId + "]: " + results.get(ModelService.ERROR_MESSAGE));
>>> 
>>> Modified: ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/thirdparty/cybersource/IcsPaymentServices.java
>>> URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/thirdparty/cybersource/IcsPaymentServices.java?rev=1071517&r1=1071516&r2=1071517&view=diff
>>> ==============================================================================
>>> --- ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/thirdparty/cybersource/IcsPaymentServices.java (original)
>>> +++ ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/thirdparty/cybersource/IcsPaymentServices.java Thu Feb 17 06:57:51 2011
>>> @@ -536,12 +536,17 @@ public class IcsPaymentServices {
>>> 
>>>    private static void processAuthResult(Map<String, Object> reply, Map<String, Object> result) {
>>>        String decision = getDecision(reply);
>>> +        String checkModeStatus = UtilProperties.getPropertyValue("payment.properties", "payment.cybersource.ignoreStatus");
>>>        if ("ACCEPT".equalsIgnoreCase(decision)) {
>>>            result.put("authCode", reply.get("ccAuthReply_authorizationCode"));
>>>            result.put("authResult", Boolean.TRUE);
>>>        } else {
>>>            result.put("authCode", decision);
>>> -            result.put("authResult", Boolean.FALSE);
>>> +            if ("N".equals(checkModeStatus)) {
>>> +                result.put("authResult", Boolean.FALSE);
>>> +            } else {
>>> +                result.put("authResult", Boolean.TRUE);
>>> +            }
>>>            // TODO: based on reasonCode populate the following flags as applicable: resultDeclined, resultNsf, resultBadExpire, resultBadCardNumber
>>>        }
>>> 
>>> 
>>> Modified: ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/CheckOutHelper.java
>>> URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/CheckOutHelper.java?rev=1071517&r1=1071516&r2=1071517&view=diff
>>> ==============================================================================
>>> --- ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/CheckOutHelper.java (original)
>>> +++ ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/CheckOutHelper.java Thu Feb 17 06:57:51 2011
>>> @@ -1067,9 +1067,27 @@ public class CheckOutHelper {
>>> 
>>>                    // set the order and item status to approved
>>>                    if (autoApproveOrder) {
>>> -                        boolean ok = OrderChangeHelper.approveOrder(dispatcher, userLogin, orderId, manualHold);
>>> -                        if (!ok) {
>>> -                            throw new GeneralException("Problem with order change; see above error");
>>> +                        List<GenericValue> productStorePaymentSettingList = delegator.findByAnd("ProductStorePaymentSetting", UtilMisc.toMap("productStoreId", productStore.getString("productStoreId"), "paymentMethodTypeId", "CREDIT_CARD", "paymentService", "cyberSourceCCAuth"));
>>> +                        if (productStorePaymentSettingList.size() > 0) {
>>> +                            String decision = (String) paymentResult.get("authCode");
>>> +                            if (UtilValidate.isNotEmpty(decision)) {
>>> +                                if ("ACCEPT".equalsIgnoreCase(decision)) {
>>> +                                    boolean ok = OrderChangeHelper.approveOrder(dispatcher, userLogin, orderId, manualHold);
>>> +                                    if (!ok) {
>>> +                                        throw new GeneralException("Problem with order change; see above error");
>>> +                                    }
>>> +                                }
>>> +                            } else {
>>> +                                boolean ok = OrderChangeHelper.approveOrder(dispatcher, userLogin, orderId, manualHold);
>>> +                                if (!ok) {
>>> +                                    throw new GeneralException("Problem with order change; see above error");
>>> +                                }
>>> +                            }
>>> +                        } else {
>>> +                            boolean ok = OrderChangeHelper.approveOrder(dispatcher, userLogin, orderId, manualHold);
>>> +                            if (!ok) {
>>> +                                throw new GeneralException("Problem with order change; see above error");
>>> +                            }
>>>                        }
>>>                    }
>>>                } else if (authResp.equals("ERROR")) {
>>> 
>>> 
>> 
> 
> -- 
> Ofbiz on twitter: http://twitter.com/apache_ofbiz
> Myself on twitter: http://twitter.com/hansbak
> Antwebsystems.com: Quality services for competitive rates.
> 


Re: svn commit: r1071517 - in /ofbiz/trunk/applications: accounting/config/ accounting/servicedef/ accounting/src/org/ofbiz/accounting/payment/ accounting/src/org/ofbiz/accounting/thirdparty/cybersource/ order/src/org/ofbiz/order/shoppingcart/

Posted by Hans Bakker <ma...@antwebsystems.com>.
This feature is not always for all paymentmethods for every order.

Certain payment processors can be easily checked and approved afterwards
with the payment processor while others do not have this feature.

Regards,
Hans


On Thu, 2011-02-17 at 22:11 +1300, Scott Gray wrote:
> Hi Hans,
> 
> Isn't that more of an order related setting rather than anything the payment gateway needs to worry about?  Surely we already have processes for this sort of thing?
> 
> Also, we're going to end up with a hell of a mess if we keep putting payment processor specific code in the order logic.
> 
> Regards
> Scott
> 
> On 17/02/2011, at 7:57 PM, hansbak@apache.org wrote:
> 
> > Author: hansbak
> > Date: Thu Feb 17 06:57:51 2011
> > New Revision: 1071517
> > 
> > URL: http://svn.apache.org/viewvc?rev=1071517&view=rev
> > Log:
> > update to cybersource payment gateway: added a properties setting that orders are still accepted but put into the created stage when a credit card fails authorisation. The default is the current setting: order is not created
> > 
> > Modified:
> >    ofbiz/trunk/applications/accounting/config/payment.properties
> >    ofbiz/trunk/applications/accounting/servicedef/services_paymentmethod.xml
> >    ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/payment/PaymentGatewayServices.java
> >    ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/thirdparty/cybersource/IcsPaymentServices.java
> >    ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/CheckOutHelper.java
> > 
> > Modified: ofbiz/trunk/applications/accounting/config/payment.properties
> > URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/config/payment.properties?rev=1071517&r1=1071516&r2=1071517&view=diff
> > ==============================================================================
> > --- ofbiz/trunk/applications/accounting/config/payment.properties (original)
> > +++ ofbiz/trunk/applications/accounting/config/payment.properties Thu Feb 17 06:57:51 2011
> > @@ -118,6 +118,12 @@ payment.cybersource.ignoreAvs=false
> > # AVS Decline Codes -- May not be supported any longer
> > #payment.cybersource.avsDeclineCodes=
> > 
> > +# Ignore status of cybersource transaction reply  (Y|N) (if cybersource response transaction status not equals "ACCEPT" then OFBiz will still create the order but in status 'created'.
> > +# default N = Don't create order if cybersource reported transaction status not equals "ACCEPT".
> > +payment.cybersource.ignoreStatus=N
> > +# It happens pretty often that a creditcard is rejected for not valid reasons, one can check to Cybersource fraud queue and after that the order can still be rejected or approved.
> > +
> > +
> > ############################################
> > # ClearCommerce Configuration
> > ############################################
> > 
> > Modified: ofbiz/trunk/applications/accounting/servicedef/services_paymentmethod.xml
> > URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/servicedef/services_paymentmethod.xml?rev=1071517&r1=1071516&r2=1071517&view=diff
> > ==============================================================================
> > --- ofbiz/trunk/applications/accounting/servicedef/services_paymentmethod.xml (original)
> > +++ ofbiz/trunk/applications/accounting/servicedef/services_paymentmethod.xml Thu Feb 17 06:57:51 2011
> > @@ -267,6 +267,7 @@ under the License.
> >         <attribute name="errors" type="Boolean" mode="OUT" optional="false"/>
> >         <attribute name="messages" type="List" mode="OUT" optional="true"/>
> >         <attribute name="processAmount" type="BigDecimal" mode="OUT" optional="true"/>
> > +        <attribute name="authCode" type="String" mode="OUT" optional="true"/>
> >     </service>
> > 
> >     <service name="authOrderPayments" engine="java"
> > @@ -276,6 +277,7 @@ under the License.
> >         <attribute name="processResult" type="String" mode="OUT" optional="false"/>
> >         <attribute name="authResultMsgs" type="List" mode="OUT" optional="true"/>
> >         <attribute name="reAuth" type="Boolean" mode="IN" optional="true"/>
> > +        <attribute name="authCode" type="String" mode="OUT" optional="true"/>
> >     </service>
> > 
> >     <service name="releaseOrderPayments" engine="java"
> > 
> > Modified: ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/payment/PaymentGatewayServices.java
> > URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/payment/PaymentGatewayServices.java?rev=1071517&r1=1071516&r2=1071517&view=diff
> > ==============================================================================
> > --- ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/payment/PaymentGatewayServices.java (original)
> > +++ ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/payment/PaymentGatewayServices.java Thu Feb 17 06:57:51 2011
> > @@ -201,6 +201,7 @@ public class PaymentGatewayServices {
> >                         results.put("processAmount", thisAmount);
> >                         results.put("finished", Boolean.TRUE);
> >                         results.put("errors", Boolean.FALSE);
> > +                        results.put("authCode", authPaymentResult.get("authCode"));
> >                         return results;
> >                     } else {
> >                         boolean needsNsfRetry = needsNsfRetry(orderPaymentPreference, authPaymentResult, delegator);
> > @@ -399,6 +400,9 @@ public class PaymentGatewayServices {
> >                 continue;
> >             }
> > 
> > +            // add authorization code to the result
> > +            result.put("authCode", results.get("authCode"));
> > +
> >             if (ServiceUtil.isError(results)) {
> >                 hadError += 1;
> >                 messages.add("Could not authorize OrderPaymentPreference [" + paymentPref.getString("orderPaymentPreferenceId") + "] for order [" + orderId + "]: " + results.get(ModelService.ERROR_MESSAGE));
> > 
> > Modified: ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/thirdparty/cybersource/IcsPaymentServices.java
> > URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/thirdparty/cybersource/IcsPaymentServices.java?rev=1071517&r1=1071516&r2=1071517&view=diff
> > ==============================================================================
> > --- ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/thirdparty/cybersource/IcsPaymentServices.java (original)
> > +++ ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/thirdparty/cybersource/IcsPaymentServices.java Thu Feb 17 06:57:51 2011
> > @@ -536,12 +536,17 @@ public class IcsPaymentServices {
> > 
> >     private static void processAuthResult(Map<String, Object> reply, Map<String, Object> result) {
> >         String decision = getDecision(reply);
> > +        String checkModeStatus = UtilProperties.getPropertyValue("payment.properties", "payment.cybersource.ignoreStatus");
> >         if ("ACCEPT".equalsIgnoreCase(decision)) {
> >             result.put("authCode", reply.get("ccAuthReply_authorizationCode"));
> >             result.put("authResult", Boolean.TRUE);
> >         } else {
> >             result.put("authCode", decision);
> > -            result.put("authResult", Boolean.FALSE);
> > +            if ("N".equals(checkModeStatus)) {
> > +                result.put("authResult", Boolean.FALSE);
> > +            } else {
> > +                result.put("authResult", Boolean.TRUE);
> > +            }
> >             // TODO: based on reasonCode populate the following flags as applicable: resultDeclined, resultNsf, resultBadExpire, resultBadCardNumber
> >         }
> > 
> > 
> > Modified: ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/CheckOutHelper.java
> > URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/CheckOutHelper.java?rev=1071517&r1=1071516&r2=1071517&view=diff
> > ==============================================================================
> > --- ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/CheckOutHelper.java (original)
> > +++ ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/CheckOutHelper.java Thu Feb 17 06:57:51 2011
> > @@ -1067,9 +1067,27 @@ public class CheckOutHelper {
> > 
> >                     // set the order and item status to approved
> >                     if (autoApproveOrder) {
> > -                        boolean ok = OrderChangeHelper.approveOrder(dispatcher, userLogin, orderId, manualHold);
> > -                        if (!ok) {
> > -                            throw new GeneralException("Problem with order change; see above error");
> > +                        List<GenericValue> productStorePaymentSettingList = delegator.findByAnd("ProductStorePaymentSetting", UtilMisc.toMap("productStoreId", productStore.getString("productStoreId"), "paymentMethodTypeId", "CREDIT_CARD", "paymentService", "cyberSourceCCAuth"));
> > +                        if (productStorePaymentSettingList.size() > 0) {
> > +                            String decision = (String) paymentResult.get("authCode");
> > +                            if (UtilValidate.isNotEmpty(decision)) {
> > +                                if ("ACCEPT".equalsIgnoreCase(decision)) {
> > +                                    boolean ok = OrderChangeHelper.approveOrder(dispatcher, userLogin, orderId, manualHold);
> > +                                    if (!ok) {
> > +                                        throw new GeneralException("Problem with order change; see above error");
> > +                                    }
> > +                                }
> > +                            } else {
> > +                                boolean ok = OrderChangeHelper.approveOrder(dispatcher, userLogin, orderId, manualHold);
> > +                                if (!ok) {
> > +                                    throw new GeneralException("Problem with order change; see above error");
> > +                                }
> > +                            }
> > +                        } else {
> > +                            boolean ok = OrderChangeHelper.approveOrder(dispatcher, userLogin, orderId, manualHold);
> > +                            if (!ok) {
> > +                                throw new GeneralException("Problem with order change; see above error");
> > +                            }
> >                         }
> >                     }
> >                 } else if (authResp.equals("ERROR")) {
> > 
> > 
> 

-- 
Ofbiz on twitter: http://twitter.com/apache_ofbiz
Myself on twitter: http://twitter.com/hansbak
Antwebsystems.com: Quality services for competitive rates.


Re: svn commit: r1071517 - in /ofbiz/trunk/applications: accounting/config/ accounting/servicedef/ accounting/src/org/ofbiz/accounting/payment/ accounting/src/org/ofbiz/accounting/thirdparty/cybersource/ order/src/org/ofbiz/order/shoppingcart/

Posted by Scott Gray <sc...@hotwaxmedia.com>.
Hi Hans,

Isn't that more of an order related setting rather than anything the payment gateway needs to worry about?  Surely we already have processes for this sort of thing?

Also, we're going to end up with a hell of a mess if we keep putting payment processor specific code in the order logic.

Regards
Scott

On 17/02/2011, at 7:57 PM, hansbak@apache.org wrote:

> Author: hansbak
> Date: Thu Feb 17 06:57:51 2011
> New Revision: 1071517
> 
> URL: http://svn.apache.org/viewvc?rev=1071517&view=rev
> Log:
> update to cybersource payment gateway: added a properties setting that orders are still accepted but put into the created stage when a credit card fails authorisation. The default is the current setting: order is not created
> 
> Modified:
>    ofbiz/trunk/applications/accounting/config/payment.properties
>    ofbiz/trunk/applications/accounting/servicedef/services_paymentmethod.xml
>    ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/payment/PaymentGatewayServices.java
>    ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/thirdparty/cybersource/IcsPaymentServices.java
>    ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/CheckOutHelper.java
> 
> Modified: ofbiz/trunk/applications/accounting/config/payment.properties
> URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/config/payment.properties?rev=1071517&r1=1071516&r2=1071517&view=diff
> ==============================================================================
> --- ofbiz/trunk/applications/accounting/config/payment.properties (original)
> +++ ofbiz/trunk/applications/accounting/config/payment.properties Thu Feb 17 06:57:51 2011
> @@ -118,6 +118,12 @@ payment.cybersource.ignoreAvs=false
> # AVS Decline Codes -- May not be supported any longer
> #payment.cybersource.avsDeclineCodes=
> 
> +# Ignore status of cybersource transaction reply  (Y|N) (if cybersource response transaction status not equals "ACCEPT" then OFBiz will still create the order but in status 'created'.
> +# default N = Don't create order if cybersource reported transaction status not equals "ACCEPT".
> +payment.cybersource.ignoreStatus=N
> +# It happens pretty often that a creditcard is rejected for not valid reasons, one can check to Cybersource fraud queue and after that the order can still be rejected or approved.
> +
> +
> ############################################
> # ClearCommerce Configuration
> ############################################
> 
> Modified: ofbiz/trunk/applications/accounting/servicedef/services_paymentmethod.xml
> URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/servicedef/services_paymentmethod.xml?rev=1071517&r1=1071516&r2=1071517&view=diff
> ==============================================================================
> --- ofbiz/trunk/applications/accounting/servicedef/services_paymentmethod.xml (original)
> +++ ofbiz/trunk/applications/accounting/servicedef/services_paymentmethod.xml Thu Feb 17 06:57:51 2011
> @@ -267,6 +267,7 @@ under the License.
>         <attribute name="errors" type="Boolean" mode="OUT" optional="false"/>
>         <attribute name="messages" type="List" mode="OUT" optional="true"/>
>         <attribute name="processAmount" type="BigDecimal" mode="OUT" optional="true"/>
> +        <attribute name="authCode" type="String" mode="OUT" optional="true"/>
>     </service>
> 
>     <service name="authOrderPayments" engine="java"
> @@ -276,6 +277,7 @@ under the License.
>         <attribute name="processResult" type="String" mode="OUT" optional="false"/>
>         <attribute name="authResultMsgs" type="List" mode="OUT" optional="true"/>
>         <attribute name="reAuth" type="Boolean" mode="IN" optional="true"/>
> +        <attribute name="authCode" type="String" mode="OUT" optional="true"/>
>     </service>
> 
>     <service name="releaseOrderPayments" engine="java"
> 
> Modified: ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/payment/PaymentGatewayServices.java
> URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/payment/PaymentGatewayServices.java?rev=1071517&r1=1071516&r2=1071517&view=diff
> ==============================================================================
> --- ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/payment/PaymentGatewayServices.java (original)
> +++ ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/payment/PaymentGatewayServices.java Thu Feb 17 06:57:51 2011
> @@ -201,6 +201,7 @@ public class PaymentGatewayServices {
>                         results.put("processAmount", thisAmount);
>                         results.put("finished", Boolean.TRUE);
>                         results.put("errors", Boolean.FALSE);
> +                        results.put("authCode", authPaymentResult.get("authCode"));
>                         return results;
>                     } else {
>                         boolean needsNsfRetry = needsNsfRetry(orderPaymentPreference, authPaymentResult, delegator);
> @@ -399,6 +400,9 @@ public class PaymentGatewayServices {
>                 continue;
>             }
> 
> +            // add authorization code to the result
> +            result.put("authCode", results.get("authCode"));
> +
>             if (ServiceUtil.isError(results)) {
>                 hadError += 1;
>                 messages.add("Could not authorize OrderPaymentPreference [" + paymentPref.getString("orderPaymentPreferenceId") + "] for order [" + orderId + "]: " + results.get(ModelService.ERROR_MESSAGE));
> 
> Modified: ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/thirdparty/cybersource/IcsPaymentServices.java
> URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/thirdparty/cybersource/IcsPaymentServices.java?rev=1071517&r1=1071516&r2=1071517&view=diff
> ==============================================================================
> --- ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/thirdparty/cybersource/IcsPaymentServices.java (original)
> +++ ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/thirdparty/cybersource/IcsPaymentServices.java Thu Feb 17 06:57:51 2011
> @@ -536,12 +536,17 @@ public class IcsPaymentServices {
> 
>     private static void processAuthResult(Map<String, Object> reply, Map<String, Object> result) {
>         String decision = getDecision(reply);
> +        String checkModeStatus = UtilProperties.getPropertyValue("payment.properties", "payment.cybersource.ignoreStatus");
>         if ("ACCEPT".equalsIgnoreCase(decision)) {
>             result.put("authCode", reply.get("ccAuthReply_authorizationCode"));
>             result.put("authResult", Boolean.TRUE);
>         } else {
>             result.put("authCode", decision);
> -            result.put("authResult", Boolean.FALSE);
> +            if ("N".equals(checkModeStatus)) {
> +                result.put("authResult", Boolean.FALSE);
> +            } else {
> +                result.put("authResult", Boolean.TRUE);
> +            }
>             // TODO: based on reasonCode populate the following flags as applicable: resultDeclined, resultNsf, resultBadExpire, resultBadCardNumber
>         }
> 
> 
> Modified: ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/CheckOutHelper.java
> URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/CheckOutHelper.java?rev=1071517&r1=1071516&r2=1071517&view=diff
> ==============================================================================
> --- ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/CheckOutHelper.java (original)
> +++ ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/CheckOutHelper.java Thu Feb 17 06:57:51 2011
> @@ -1067,9 +1067,27 @@ public class CheckOutHelper {
> 
>                     // set the order and item status to approved
>                     if (autoApproveOrder) {
> -                        boolean ok = OrderChangeHelper.approveOrder(dispatcher, userLogin, orderId, manualHold);
> -                        if (!ok) {
> -                            throw new GeneralException("Problem with order change; see above error");
> +                        List<GenericValue> productStorePaymentSettingList = delegator.findByAnd("ProductStorePaymentSetting", UtilMisc.toMap("productStoreId", productStore.getString("productStoreId"), "paymentMethodTypeId", "CREDIT_CARD", "paymentService", "cyberSourceCCAuth"));
> +                        if (productStorePaymentSettingList.size() > 0) {
> +                            String decision = (String) paymentResult.get("authCode");
> +                            if (UtilValidate.isNotEmpty(decision)) {
> +                                if ("ACCEPT".equalsIgnoreCase(decision)) {
> +                                    boolean ok = OrderChangeHelper.approveOrder(dispatcher, userLogin, orderId, manualHold);
> +                                    if (!ok) {
> +                                        throw new GeneralException("Problem with order change; see above error");
> +                                    }
> +                                }
> +                            } else {
> +                                boolean ok = OrderChangeHelper.approveOrder(dispatcher, userLogin, orderId, manualHold);
> +                                if (!ok) {
> +                                    throw new GeneralException("Problem with order change; see above error");
> +                                }
> +                            }
> +                        } else {
> +                            boolean ok = OrderChangeHelper.approveOrder(dispatcher, userLogin, orderId, manualHold);
> +                            if (!ok) {
> +                                throw new GeneralException("Problem with order change; see above error");
> +                            }
>                         }
>                     }
>                 } else if (authResp.equals("ERROR")) {
> 
>