[ 
https://issues.apache.org/jira/browse/OFBIZ-583?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12462214
 ] 

Iain Fogg commented on OFBIZ-583:
---------------------------------

Following Anil's lead, I made the following patches to CheckOutEvents.java:

Around line 715 (with Anil's patch) replace:

       // check for offline payment type
        // payment option; if offline we skip the payment screen
        methodType = request.getParameter("paymentMethodType");
        if ("offline".equals(methodType)) {
            Debug.log("Changing mode from->to: " + mode + "->payment", module);
            mode = "payment";
         }

with:

        // check for offline payment type
        // payment option; if offline we skip the payment screen
        HttpServletRequestWrapper wrapper = null;
        methodType = request.getParameter("paymentMethodType");
        if ("offline".equals(methodType)) {
            Debug.log("Changing mode from->to: " + mode + "->payment", module);
            mode = "payment";
            wrapper = new 
HttpServletRequestWrapper((HttpServletRequest)request) {
                public java.lang.String[] getParameterValues(java.lang.String 
name) {
                    if ("checkOutPaymentId".equals(name)) {
                        String[] ids = super.getParameterValues(name);
                        int len = ids != null ? ids.length + 1 : 1;

                        String[] ret = new String[len];

                        for (int i = 0; i < len - 1; i++) {
                            ret[i] = ids[i];
                        }
                        ret[len - 1] = "EXT_OFFLINE";
                        return ret;
                    }
                    else {
                        return super.getParameterValues(name);
                    }
                }
            };
        }

and a little later (about line 747 or so), replace

         Map selectedPaymentMethods = getSelectedPaymentMethods(request);

with

         Map selectedPaymentMethods = getSelectedPaymentMethods(wrapper != null 
? wrapper : request);

Since getSelectedPaymentMethods needs a HttpServletRequest param, we need to 
modify the request params on the way through. Apologies if there is a utility 
class available to add EXT_OFFLINE to other (possibly) existing 
checkOutPaymentId values, but I don't know if such exists.

I can test the patch for OFFLINE as well as BILLING_ACCOUNT payments, but I'm 
not configured to do online stuff like CC and EFT. I hope this gets us a little 
closer to a working solution.


> Offline payment selection now prevents completion of sales order
> ----------------------------------------------------------------
>
>                 Key: OFBIZ-583
>                 URL: https://issues.apache.org/jira/browse/OFBIZ-583
>             Project: Apache OFBiz (The Open for Business Project)
>          Issue Type: Bug
>          Components: order
>            Reporter: Iain Fogg
>            Priority: Critical
>
> I upgraded to the latest SVN on the weekend and now I find that when I raise 
> a Sales Order in the Order Manager, and select OFFLINE as the payment option, 
> the sale cannot proceed because it complains about no payment method being 
> selected.
> CheckOutEvent.java has undergone some significant changes regarding checkout 
> processing, and I suspect the following snippet:
>         methodType = request.getParameter("paymentMethodType");
>         if ("offline".equals(methodType)) {
>             Debug.log("Changing mode from->to: " + mode + "->payment", 
> module);
>             mode = "payment";
>         }
> If I've selected offline payment, shouldn't the mode be set to "addparty", 
> not "payment"?
> Not sure who contributed the most recent changes, but would appreciate a 
> speedy resolution to this one as I can't do sales orders without it!!!
> Cheers, Iain

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
https://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to