You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by as...@apache.org on 2010/05/30 05:25:35 UTC

svn commit: r949465 - /ofbiz/trunk/applications/order/src/org/ofbiz/order/thirdparty/paypal/ExpressCheckoutEvents.java

Author: ashish
Date: Sun May 30 03:25:35 2010
New Revision: 949465

URL: http://svn.apache.org/viewvc?rev=949465&view=rev
Log:
The paypal checkout should always redirect to sandbox while you are in production environment. Contribution from Divesh & Pranay - Thanks Guys.

Modified:
    ofbiz/trunk/applications/order/src/org/ofbiz/order/thirdparty/paypal/ExpressCheckoutEvents.java

Modified: ofbiz/trunk/applications/order/src/org/ofbiz/order/thirdparty/paypal/ExpressCheckoutEvents.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/thirdparty/paypal/ExpressCheckoutEvents.java?rev=949465&r1=949464&r2=949465&view=diff
==============================================================================
--- ofbiz/trunk/applications/order/src/org/ofbiz/order/thirdparty/paypal/ExpressCheckoutEvents.java (original)
+++ ofbiz/trunk/applications/order/src/org/ofbiz/order/thirdparty/paypal/ExpressCheckoutEvents.java Sun May 30 03:25:35 2010
@@ -81,13 +81,37 @@ public class ExpressCheckoutEvents {
     }
 
     public static String expressCheckoutRedirect(HttpServletRequest request, HttpServletResponse response) {
+        Delegator delegator = (Delegator) request.getAttribute("delegator");
         ShoppingCart cart = ShoppingCartEvents.getCartObject(request);
         String token = (String) cart.getAttribute("payPalCheckoutToken");
+        String paymentGatewayConfigId = null;
+        GenericValue payPalGatewayConfig = null;
+        String productStoreId = null;
         if (UtilValidate.isEmpty(token)) {
             Debug.logError("No ExpressCheckout token found in cart, you must do a successful setExpressCheckout before redirecting.", module);
             return "error";
         }
-        StringBuilder redirectUrl = new StringBuilder("https://www.sandbox.paypal.com/cgi-bin/webscr");
+        if (cart != null) {
+            productStoreId = cart.getProductStoreId();
+        }
+        if (productStoreId != null) {
+            GenericValue payPalPaymentSetting = ProductStoreWorker.getProductStorePaymentSetting(delegator, productStoreId, "EXT_PAYPAL", null, true);
+            if (payPalPaymentSetting != null) {
+                paymentGatewayConfigId = payPalPaymentSetting.getString("paymentGatewayConfigId");
+            }
+        }
+        if (paymentGatewayConfigId != null) {
+            try {
+                payPalGatewayConfig = delegator.findOne("PaymentGatewayPayPal", true, "paymentGatewayConfigId", paymentGatewayConfigId);
+            } catch (GenericEntityException e) {
+                Debug.logError(e, module);
+            }
+        }
+        if (payPalGatewayConfig == null) {
+            request.setAttribute("_EVENT_MESSAGE_", "Couldn't retrieve a PaymentGatewayConfigPayPal record for Express Checkout, cannot continue.");
+            return "error";
+        }
+        StringBuilder redirectUrl = new StringBuilder(payPalGatewayConfig.getString("redirectUrl"));
         redirectUrl.append("?cmd=_express-checkout&token=");
         redirectUrl.append(token);
         try {



Re: svn commit: r949465 - /ofbiz/trunk/applications/order/src/org/ofbiz/order/thirdparty/paypal/ExpressCheckoutEvents.java

Posted by BJ Freeman <bj...@free-man.net>.
thanks for rationale behind the placement.

Scott Gray sent the following on 8/24/2010 6:07 PM:
> All gateway code is in accounting, but keep in mind that Express Checkout involves more than just interacting with a gateway.  It also modifies the checkout process in a fairly major way and it makes no sense to include all of that in accounting, hence the events being in the order component.
>
> Regards
> Scott
>
> On 25/08/2010, at 12:41 PM, BJ Freeman wrote:
>
>> Up until I found the file. om orders, I thought all gateway code was in accounting.
>> it is more if someone is looking for which gateway to use or to troubleshoot, without walking through the code.
>> it has more to-do with placing like code in the same place
>> from a functional point of view there is not difference.
>>
>>
>> =========================
>> BJ Freeman<http://bjfreeman.elance.com>
>> 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 8/24/2010 5:32 PM:
>>> I don't really know what you mean.
>>> - The Payflow Pro Express Checkout payment processing stuff is in the original Payflow Processor, I don't see any reason to change that
>>> - Everything else is in PayPalServices (if it is a service) or in ExpressCheckoutEvents (if it is an event method)
>>>
>>> What is the issue exactly?
>>>
>>> Regards
>>> Scott
>>>
>>> On 25/08/2010, at 12:03 PM, BJ Freeman wrote:
>>>
>>>> since they are named different would not seem consistent to have all of them in one place?
>>>>
>>>> Scott Gray sent the following on 8/24/2010 3:27 PM:
>>>>> There are two Express Checkout integrations, one for PayFlow Pro and another for the standard PayPal API.  However, both of them use ExpressCheckoutEvents so there is really nothing to be merged.
>>>>>
>>>>> Regards
>>>>> Scott
>>>>>
>>>>> HotWax Media
>>>>> http://www.hotwaxmedia.com
>>>>>
>>>>> On 24/08/2010, at 8:13 PM, BJ Freeman wrote:
>>>>>
>>>>>> I was checking out the jira OFBIZ-3895
>>>>>> and ran across this in orders.
>>>>>> there is also one done by Scott in accounting.
>>>>>> should these be merged and put in one place.
>>>>>>
>>>>>> =========================
>>>>>> BJ Freeman<http://bjfreeman.elance.com>
>>>>>> 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
>>>>>>
>>>>>>
>>>>>> ashish@apache.org sent the following on 5/29/2010 8:25 PM:
>>>>>>> Author: ashish
>>>>>>> Date: Sun May 30 03:25:35 2010
>>>>>>> New Revision: 949465
>>>>>>>
>>>>>>> URL: http://svn.apache.org/viewvc?rev=949465&view=rev
>>>>>>> Log:
>>>>>>> The paypal checkout should always redirect to sandbox while you are in production environment. Contribution from Divesh&     Pranay - Thanks Guys.
>>>>>>>
>>>>>>> Modified:
>>>>>>>      ofbiz/trunk/applications/order/src/org/ofbiz/order/thirdparty/paypal/ExpressCheckoutEvents.java
>>>>>>>
>>>>>>> Modified: ofbiz/trunk/applications/order/src/org/ofbiz/order/thirdparty/paypal/ExpressCheckoutEvents.java
>>>>>>> URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/thirdparty/paypal/ExpressCheckoutEvents.java?rev=949465&r1=949464&r2=949465&view=diff
>>>>>>> ==============================================================================
>>>>>>> --- ofbiz/trunk/applications/order/src/org/ofbiz/order/thirdparty/paypal/ExpressCheckoutEvents.java (original)
>>>>>>> +++ ofbiz/trunk/applications/order/src/org/ofbiz/order/thirdparty/paypal/ExpressCheckoutEvents.java Sun May 30 03:25:35 2010
>>>>>>> @@ -81,13 +81,37 @@ public class ExpressCheckoutEvents {
>>>>>>>       }
>>>>>>>
>>>>>>>       public static String expressCheckoutRedirect(HttpServletRequest request, HttpServletResponse response) {
>>>>>>> +        Delegator delegator = (Delegator) request.getAttribute("delegator");
>>>>>>>           ShoppingCart cart = ShoppingCartEvents.getCartObject(request);
>>>>>>>           String token = (String) cart.getAttribute("payPalCheckoutToken");
>>>>>>> +        String paymentGatewayConfigId = null;
>>>>>>> +        GenericValue payPalGatewayConfig = null;
>>>>>>> +        String productStoreId = null;
>>>>>>>           if (UtilValidate.isEmpty(token)) {
>>>>>>>               Debug.logError("No ExpressCheckout token found in cart, you must do a successful setExpressCheckout before redirecting.", module);
>>>>>>>               return "error";
>>>>>>>           }
>>>>>>> -        StringBuilder redirectUrl = new StringBuilder("https://www.sandbox.paypal.com/cgi-bin/webscr");
>>>>>>> +        if (cart != null) {
>>>>>>> +            productStoreId = cart.getProductStoreId();
>>>>>>> +        }
>>>>>>> +        if (productStoreId != null) {
>>>>>>> +            GenericValue payPalPaymentSetting = ProductStoreWorker.getProductStorePaymentSetting(delegator, productStoreId, "EXT_PAYPAL", null, true);
>>>>>>> +            if (payPalPaymentSetting != null) {
>>>>>>> +                paymentGatewayConfigId = payPalPaymentSetting.getString("paymentGatewayConfigId");
>>>>>>> +            }
>>>>>>> +        }
>>>>>>> +        if (paymentGatewayConfigId != null) {
>>>>>>> +            try {
>>>>>>> +                payPalGatewayConfig = delegator.findOne("PaymentGatewayPayPal", true, "paymentGatewayConfigId", paymentGatewayConfigId);
>>>>>>> +            } catch (GenericEntityException e) {
>>>>>>> +                Debug.logError(e, module);
>>>>>>> +            }
>>>>>>> +        }
>>>>>>> +        if (payPalGatewayConfig == null) {
>>>>>>> +            request.setAttribute("_EVENT_MESSAGE_", "Couldn't retrieve a PaymentGatewayConfigPayPal record for Express Checkout, cannot continue.");
>>>>>>> +            return "error";
>>>>>>> +        }
>>>>>>> +        StringBuilder redirectUrl = new StringBuilder(payPalGatewayConfig.getString("redirectUrl"));
>>>>>>>           redirectUrl.append("?cmd=_express-checkout&token=");
>>>>>>>           redirectUrl.append(token);
>>>>>>>           try {
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>
>>>>>
>>>
>>
>

Re: svn commit: r949465 - /ofbiz/trunk/applications/order/src/org/ofbiz/order/thirdparty/paypal/ExpressCheckoutEvents.java

Posted by Scott Gray <sc...@hotwaxmedia.com>.
All gateway code is in accounting, but keep in mind that Express Checkout involves more than just interacting with a gateway.  It also modifies the checkout process in a fairly major way and it makes no sense to include all of that in accounting, hence the events being in the order component.

Regards
Scott

On 25/08/2010, at 12:41 PM, BJ Freeman wrote:

> Up until I found the file. om orders, I thought all gateway code was in accounting.
> it is more if someone is looking for which gateway to use or to troubleshoot, without walking through the code.
> it has more to-do with placing like code in the same place
> from a functional point of view there is not difference.
> 
> 
> =========================
> BJ Freeman  <http://bjfreeman.elance.com>
> 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 8/24/2010 5:32 PM:
>> I don't really know what you mean.
>> - The Payflow Pro Express Checkout payment processing stuff is in the original Payflow Processor, I don't see any reason to change that
>> - Everything else is in PayPalServices (if it is a service) or in ExpressCheckoutEvents (if it is an event method)
>> 
>> What is the issue exactly?
>> 
>> Regards
>> Scott
>> 
>> On 25/08/2010, at 12:03 PM, BJ Freeman wrote:
>> 
>>> since they are named different would not seem consistent to have all of them in one place?
>>> 
>>> Scott Gray sent the following on 8/24/2010 3:27 PM:
>>>> There are two Express Checkout integrations, one for PayFlow Pro and another for the standard PayPal API.  However, both of them use ExpressCheckoutEvents so there is really nothing to be merged.
>>>> 
>>>> Regards
>>>> Scott
>>>> 
>>>> HotWax Media
>>>> http://www.hotwaxmedia.com
>>>> 
>>>> On 24/08/2010, at 8:13 PM, BJ Freeman wrote:
>>>> 
>>>>> I was checking out the jira OFBIZ-3895
>>>>> and ran across this in orders.
>>>>> there is also one done by Scott in accounting.
>>>>> should these be merged and put in one place.
>>>>> 
>>>>> =========================
>>>>> BJ Freeman<http://bjfreeman.elance.com>
>>>>> 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
>>>>> 
>>>>> 
>>>>> ashish@apache.org sent the following on 5/29/2010 8:25 PM:
>>>>>> Author: ashish
>>>>>> Date: Sun May 30 03:25:35 2010
>>>>>> New Revision: 949465
>>>>>> 
>>>>>> URL: http://svn.apache.org/viewvc?rev=949465&view=rev
>>>>>> Log:
>>>>>> The paypal checkout should always redirect to sandbox while you are in production environment. Contribution from Divesh&    Pranay - Thanks Guys.
>>>>>> 
>>>>>> Modified:
>>>>>>     ofbiz/trunk/applications/order/src/org/ofbiz/order/thirdparty/paypal/ExpressCheckoutEvents.java
>>>>>> 
>>>>>> Modified: ofbiz/trunk/applications/order/src/org/ofbiz/order/thirdparty/paypal/ExpressCheckoutEvents.java
>>>>>> URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/thirdparty/paypal/ExpressCheckoutEvents.java?rev=949465&r1=949464&r2=949465&view=diff
>>>>>> ==============================================================================
>>>>>> --- ofbiz/trunk/applications/order/src/org/ofbiz/order/thirdparty/paypal/ExpressCheckoutEvents.java (original)
>>>>>> +++ ofbiz/trunk/applications/order/src/org/ofbiz/order/thirdparty/paypal/ExpressCheckoutEvents.java Sun May 30 03:25:35 2010
>>>>>> @@ -81,13 +81,37 @@ public class ExpressCheckoutEvents {
>>>>>>      }
>>>>>> 
>>>>>>      public static String expressCheckoutRedirect(HttpServletRequest request, HttpServletResponse response) {
>>>>>> +        Delegator delegator = (Delegator) request.getAttribute("delegator");
>>>>>>          ShoppingCart cart = ShoppingCartEvents.getCartObject(request);
>>>>>>          String token = (String) cart.getAttribute("payPalCheckoutToken");
>>>>>> +        String paymentGatewayConfigId = null;
>>>>>> +        GenericValue payPalGatewayConfig = null;
>>>>>> +        String productStoreId = null;
>>>>>>          if (UtilValidate.isEmpty(token)) {
>>>>>>              Debug.logError("No ExpressCheckout token found in cart, you must do a successful setExpressCheckout before redirecting.", module);
>>>>>>              return "error";
>>>>>>          }
>>>>>> -        StringBuilder redirectUrl = new StringBuilder("https://www.sandbox.paypal.com/cgi-bin/webscr");
>>>>>> +        if (cart != null) {
>>>>>> +            productStoreId = cart.getProductStoreId();
>>>>>> +        }
>>>>>> +        if (productStoreId != null) {
>>>>>> +            GenericValue payPalPaymentSetting = ProductStoreWorker.getProductStorePaymentSetting(delegator, productStoreId, "EXT_PAYPAL", null, true);
>>>>>> +            if (payPalPaymentSetting != null) {
>>>>>> +                paymentGatewayConfigId = payPalPaymentSetting.getString("paymentGatewayConfigId");
>>>>>> +            }
>>>>>> +        }
>>>>>> +        if (paymentGatewayConfigId != null) {
>>>>>> +            try {
>>>>>> +                payPalGatewayConfig = delegator.findOne("PaymentGatewayPayPal", true, "paymentGatewayConfigId", paymentGatewayConfigId);
>>>>>> +            } catch (GenericEntityException e) {
>>>>>> +                Debug.logError(e, module);
>>>>>> +            }
>>>>>> +        }
>>>>>> +        if (payPalGatewayConfig == null) {
>>>>>> +            request.setAttribute("_EVENT_MESSAGE_", "Couldn't retrieve a PaymentGatewayConfigPayPal record for Express Checkout, cannot continue.");
>>>>>> +            return "error";
>>>>>> +        }
>>>>>> +        StringBuilder redirectUrl = new StringBuilder(payPalGatewayConfig.getString("redirectUrl"));
>>>>>>          redirectUrl.append("?cmd=_express-checkout&token=");
>>>>>>          redirectUrl.append(token);
>>>>>>          try {
>>>>>> 
>>>>>> 
>>>>>> 
>>>>> 
>>>> 
>> 
> 


Re: svn commit: r949465 - /ofbiz/trunk/applications/order/src/org/ofbiz/order/thirdparty/paypal/ExpressCheckoutEvents.java

Posted by BJ Freeman <bj...@free-man.net>.
Up until I found the file. om orders, I thought all gateway code was in 
accounting.
it is more if someone is looking for which gateway to use or to 
troubleshoot, without walking through the code.
it has more to-do with placing like code in the same place
from a functional point of view there is not difference.


=========================
BJ Freeman  <http://bjfreeman.elance.com>
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 8/24/2010 5:32 PM:
> I don't really know what you mean.
> - The Payflow Pro Express Checkout payment processing stuff is in the original Payflow Processor, I don't see any reason to change that
> - Everything else is in PayPalServices (if it is a service) or in ExpressCheckoutEvents (if it is an event method)
>
> What is the issue exactly?
>
> Regards
> Scott
>
> On 25/08/2010, at 12:03 PM, BJ Freeman wrote:
>
>> since they are named different would not seem consistent to have all of them in one place?
>>
>> Scott Gray sent the following on 8/24/2010 3:27 PM:
>>> There are two Express Checkout integrations, one for PayFlow Pro and another for the standard PayPal API.  However, both of them use ExpressCheckoutEvents so there is really nothing to be merged.
>>>
>>> Regards
>>> Scott
>>>
>>> HotWax Media
>>> http://www.hotwaxmedia.com
>>>
>>> On 24/08/2010, at 8:13 PM, BJ Freeman wrote:
>>>
>>>> I was checking out the jira OFBIZ-3895
>>>> and ran across this in orders.
>>>> there is also one done by Scott in accounting.
>>>> should these be merged and put in one place.
>>>>
>>>> =========================
>>>> BJ Freeman<http://bjfreeman.elance.com>
>>>> 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
>>>>
>>>>
>>>> ashish@apache.org sent the following on 5/29/2010 8:25 PM:
>>>>> Author: ashish
>>>>> Date: Sun May 30 03:25:35 2010
>>>>> New Revision: 949465
>>>>>
>>>>> URL: http://svn.apache.org/viewvc?rev=949465&view=rev
>>>>> Log:
>>>>> The paypal checkout should always redirect to sandbox while you are in production environment. Contribution from Divesh&    Pranay - Thanks Guys.
>>>>>
>>>>> Modified:
>>>>>      ofbiz/trunk/applications/order/src/org/ofbiz/order/thirdparty/paypal/ExpressCheckoutEvents.java
>>>>>
>>>>> Modified: ofbiz/trunk/applications/order/src/org/ofbiz/order/thirdparty/paypal/ExpressCheckoutEvents.java
>>>>> URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/thirdparty/paypal/ExpressCheckoutEvents.java?rev=949465&r1=949464&r2=949465&view=diff
>>>>> ==============================================================================
>>>>> --- ofbiz/trunk/applications/order/src/org/ofbiz/order/thirdparty/paypal/ExpressCheckoutEvents.java (original)
>>>>> +++ ofbiz/trunk/applications/order/src/org/ofbiz/order/thirdparty/paypal/ExpressCheckoutEvents.java Sun May 30 03:25:35 2010
>>>>> @@ -81,13 +81,37 @@ public class ExpressCheckoutEvents {
>>>>>       }
>>>>>
>>>>>       public static String expressCheckoutRedirect(HttpServletRequest request, HttpServletResponse response) {
>>>>> +        Delegator delegator = (Delegator) request.getAttribute("delegator");
>>>>>           ShoppingCart cart = ShoppingCartEvents.getCartObject(request);
>>>>>           String token = (String) cart.getAttribute("payPalCheckoutToken");
>>>>> +        String paymentGatewayConfigId = null;
>>>>> +        GenericValue payPalGatewayConfig = null;
>>>>> +        String productStoreId = null;
>>>>>           if (UtilValidate.isEmpty(token)) {
>>>>>               Debug.logError("No ExpressCheckout token found in cart, you must do a successful setExpressCheckout before redirecting.", module);
>>>>>               return "error";
>>>>>           }
>>>>> -        StringBuilder redirectUrl = new StringBuilder("https://www.sandbox.paypal.com/cgi-bin/webscr");
>>>>> +        if (cart != null) {
>>>>> +            productStoreId = cart.getProductStoreId();
>>>>> +        }
>>>>> +        if (productStoreId != null) {
>>>>> +            GenericValue payPalPaymentSetting = ProductStoreWorker.getProductStorePaymentSetting(delegator, productStoreId, "EXT_PAYPAL", null, true);
>>>>> +            if (payPalPaymentSetting != null) {
>>>>> +                paymentGatewayConfigId = payPalPaymentSetting.getString("paymentGatewayConfigId");
>>>>> +            }
>>>>> +        }
>>>>> +        if (paymentGatewayConfigId != null) {
>>>>> +            try {
>>>>> +                payPalGatewayConfig = delegator.findOne("PaymentGatewayPayPal", true, "paymentGatewayConfigId", paymentGatewayConfigId);
>>>>> +            } catch (GenericEntityException e) {
>>>>> +                Debug.logError(e, module);
>>>>> +            }
>>>>> +        }
>>>>> +        if (payPalGatewayConfig == null) {
>>>>> +            request.setAttribute("_EVENT_MESSAGE_", "Couldn't retrieve a PaymentGatewayConfigPayPal record for Express Checkout, cannot continue.");
>>>>> +            return "error";
>>>>> +        }
>>>>> +        StringBuilder redirectUrl = new StringBuilder(payPalGatewayConfig.getString("redirectUrl"));
>>>>>           redirectUrl.append("?cmd=_express-checkout&token=");
>>>>>           redirectUrl.append(token);
>>>>>           try {
>>>>>
>>>>>
>>>>>
>>>>
>>>
>


Re: svn commit: r949465 - /ofbiz/trunk/applications/order/src/org/ofbiz/order/thirdparty/paypal/ExpressCheckoutEvents.java

Posted by Scott Gray <sc...@hotwaxmedia.com>.
I don't really know what you mean.
- The Payflow Pro Express Checkout payment processing stuff is in the original Payflow Processor, I don't see any reason to change that
- Everything else is in PayPalServices (if it is a service) or in ExpressCheckoutEvents (if it is an event method)

What is the issue exactly?

Regards
Scott

On 25/08/2010, at 12:03 PM, BJ Freeman wrote:

> since they are named different would not seem consistent to have all of them in one place?
> 
> Scott Gray sent the following on 8/24/2010 3:27 PM:
>> There are two Express Checkout integrations, one for PayFlow Pro and another for the standard PayPal API.  However, both of them use ExpressCheckoutEvents so there is really nothing to be merged.
>> 
>> Regards
>> Scott
>> 
>> HotWax Media
>> http://www.hotwaxmedia.com
>> 
>> On 24/08/2010, at 8:13 PM, BJ Freeman wrote:
>> 
>>> I was checking out the jira OFBIZ-3895
>>> and ran across this in orders.
>>> there is also one done by Scott in accounting.
>>> should these be merged and put in one place.
>>> 
>>> =========================
>>> BJ Freeman<http://bjfreeman.elance.com>
>>> 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
>>> 
>>> 
>>> ashish@apache.org sent the following on 5/29/2010 8:25 PM:
>>>> Author: ashish
>>>> Date: Sun May 30 03:25:35 2010
>>>> New Revision: 949465
>>>> 
>>>> URL: http://svn.apache.org/viewvc?rev=949465&view=rev
>>>> Log:
>>>> The paypal checkout should always redirect to sandbox while you are in production environment. Contribution from Divesh&   Pranay - Thanks Guys.
>>>> 
>>>> Modified:
>>>>     ofbiz/trunk/applications/order/src/org/ofbiz/order/thirdparty/paypal/ExpressCheckoutEvents.java
>>>> 
>>>> Modified: ofbiz/trunk/applications/order/src/org/ofbiz/order/thirdparty/paypal/ExpressCheckoutEvents.java
>>>> URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/thirdparty/paypal/ExpressCheckoutEvents.java?rev=949465&r1=949464&r2=949465&view=diff
>>>> ==============================================================================
>>>> --- ofbiz/trunk/applications/order/src/org/ofbiz/order/thirdparty/paypal/ExpressCheckoutEvents.java (original)
>>>> +++ ofbiz/trunk/applications/order/src/org/ofbiz/order/thirdparty/paypal/ExpressCheckoutEvents.java Sun May 30 03:25:35 2010
>>>> @@ -81,13 +81,37 @@ public class ExpressCheckoutEvents {
>>>>      }
>>>> 
>>>>      public static String expressCheckoutRedirect(HttpServletRequest request, HttpServletResponse response) {
>>>> +        Delegator delegator = (Delegator) request.getAttribute("delegator");
>>>>          ShoppingCart cart = ShoppingCartEvents.getCartObject(request);
>>>>          String token = (String) cart.getAttribute("payPalCheckoutToken");
>>>> +        String paymentGatewayConfigId = null;
>>>> +        GenericValue payPalGatewayConfig = null;
>>>> +        String productStoreId = null;
>>>>          if (UtilValidate.isEmpty(token)) {
>>>>              Debug.logError("No ExpressCheckout token found in cart, you must do a successful setExpressCheckout before redirecting.", module);
>>>>              return "error";
>>>>          }
>>>> -        StringBuilder redirectUrl = new StringBuilder("https://www.sandbox.paypal.com/cgi-bin/webscr");
>>>> +        if (cart != null) {
>>>> +            productStoreId = cart.getProductStoreId();
>>>> +        }
>>>> +        if (productStoreId != null) {
>>>> +            GenericValue payPalPaymentSetting = ProductStoreWorker.getProductStorePaymentSetting(delegator, productStoreId, "EXT_PAYPAL", null, true);
>>>> +            if (payPalPaymentSetting != null) {
>>>> +                paymentGatewayConfigId = payPalPaymentSetting.getString("paymentGatewayConfigId");
>>>> +            }
>>>> +        }
>>>> +        if (paymentGatewayConfigId != null) {
>>>> +            try {
>>>> +                payPalGatewayConfig = delegator.findOne("PaymentGatewayPayPal", true, "paymentGatewayConfigId", paymentGatewayConfigId);
>>>> +            } catch (GenericEntityException e) {
>>>> +                Debug.logError(e, module);
>>>> +            }
>>>> +        }
>>>> +        if (payPalGatewayConfig == null) {
>>>> +            request.setAttribute("_EVENT_MESSAGE_", "Couldn't retrieve a PaymentGatewayConfigPayPal record for Express Checkout, cannot continue.");
>>>> +            return "error";
>>>> +        }
>>>> +        StringBuilder redirectUrl = new StringBuilder(payPalGatewayConfig.getString("redirectUrl"));
>>>>          redirectUrl.append("?cmd=_express-checkout&token=");
>>>>          redirectUrl.append(token);
>>>>          try {
>>>> 
>>>> 
>>>> 
>>> 
>> 


Re: svn commit: r949465 - /ofbiz/trunk/applications/order/src/org/ofbiz/order/thirdparty/paypal/ExpressCheckoutEvents.java

Posted by BJ Freeman <bj...@free-man.net>.
since they are named different would not seem consistent to have all of 
them in one place?

Scott Gray sent the following on 8/24/2010 3:27 PM:
> There are two Express Checkout integrations, one for PayFlow Pro and another for the standard PayPal API.  However, both of them use ExpressCheckoutEvents so there is really nothing to be merged.
>
> Regards
> Scott
>
> HotWax Media
> http://www.hotwaxmedia.com
>
> On 24/08/2010, at 8:13 PM, BJ Freeman wrote:
>
>> I was checking out the jira OFBIZ-3895
>> and ran across this in orders.
>> there is also one done by Scott in accounting.
>> should these be merged and put in one place.
>>
>> =========================
>> BJ Freeman<http://bjfreeman.elance.com>
>> 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
>>
>>
>> ashish@apache.org sent the following on 5/29/2010 8:25 PM:
>>> Author: ashish
>>> Date: Sun May 30 03:25:35 2010
>>> New Revision: 949465
>>>
>>> URL: http://svn.apache.org/viewvc?rev=949465&view=rev
>>> Log:
>>> The paypal checkout should always redirect to sandbox while you are in production environment. Contribution from Divesh&   Pranay - Thanks Guys.
>>>
>>> Modified:
>>>      ofbiz/trunk/applications/order/src/org/ofbiz/order/thirdparty/paypal/ExpressCheckoutEvents.java
>>>
>>> Modified: ofbiz/trunk/applications/order/src/org/ofbiz/order/thirdparty/paypal/ExpressCheckoutEvents.java
>>> URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/thirdparty/paypal/ExpressCheckoutEvents.java?rev=949465&r1=949464&r2=949465&view=diff
>>> ==============================================================================
>>> --- ofbiz/trunk/applications/order/src/org/ofbiz/order/thirdparty/paypal/ExpressCheckoutEvents.java (original)
>>> +++ ofbiz/trunk/applications/order/src/org/ofbiz/order/thirdparty/paypal/ExpressCheckoutEvents.java Sun May 30 03:25:35 2010
>>> @@ -81,13 +81,37 @@ public class ExpressCheckoutEvents {
>>>       }
>>>
>>>       public static String expressCheckoutRedirect(HttpServletRequest request, HttpServletResponse response) {
>>> +        Delegator delegator = (Delegator) request.getAttribute("delegator");
>>>           ShoppingCart cart = ShoppingCartEvents.getCartObject(request);
>>>           String token = (String) cart.getAttribute("payPalCheckoutToken");
>>> +        String paymentGatewayConfigId = null;
>>> +        GenericValue payPalGatewayConfig = null;
>>> +        String productStoreId = null;
>>>           if (UtilValidate.isEmpty(token)) {
>>>               Debug.logError("No ExpressCheckout token found in cart, you must do a successful setExpressCheckout before redirecting.", module);
>>>               return "error";
>>>           }
>>> -        StringBuilder redirectUrl = new StringBuilder("https://www.sandbox.paypal.com/cgi-bin/webscr");
>>> +        if (cart != null) {
>>> +            productStoreId = cart.getProductStoreId();
>>> +        }
>>> +        if (productStoreId != null) {
>>> +            GenericValue payPalPaymentSetting = ProductStoreWorker.getProductStorePaymentSetting(delegator, productStoreId, "EXT_PAYPAL", null, true);
>>> +            if (payPalPaymentSetting != null) {
>>> +                paymentGatewayConfigId = payPalPaymentSetting.getString("paymentGatewayConfigId");
>>> +            }
>>> +        }
>>> +        if (paymentGatewayConfigId != null) {
>>> +            try {
>>> +                payPalGatewayConfig = delegator.findOne("PaymentGatewayPayPal", true, "paymentGatewayConfigId", paymentGatewayConfigId);
>>> +            } catch (GenericEntityException e) {
>>> +                Debug.logError(e, module);
>>> +            }
>>> +        }
>>> +        if (payPalGatewayConfig == null) {
>>> +            request.setAttribute("_EVENT_MESSAGE_", "Couldn't retrieve a PaymentGatewayConfigPayPal record for Express Checkout, cannot continue.");
>>> +            return "error";
>>> +        }
>>> +        StringBuilder redirectUrl = new StringBuilder(payPalGatewayConfig.getString("redirectUrl"));
>>>           redirectUrl.append("?cmd=_express-checkout&token=");
>>>           redirectUrl.append(token);
>>>           try {
>>>
>>>
>>>
>>
>

Re: svn commit: r949465 - /ofbiz/trunk/applications/order/src/org/ofbiz/order/thirdparty/paypal/ExpressCheckoutEvents.java

Posted by Scott Gray <sc...@hotwaxmedia.com>.
There are two Express Checkout integrations, one for PayFlow Pro and another for the standard PayPal API.  However, both of them use ExpressCheckoutEvents so there is really nothing to be merged.

Regards
Scott

HotWax Media
http://www.hotwaxmedia.com

On 24/08/2010, at 8:13 PM, BJ Freeman wrote:

> I was checking out the jira OFBIZ-3895
> and ran across this in orders.
> there is also one done by Scott in accounting.
> should these be merged and put in one place.
> 
> =========================
> BJ Freeman  <http://bjfreeman.elance.com>
> 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
> 
> 
> ashish@apache.org sent the following on 5/29/2010 8:25 PM:
>> Author: ashish
>> Date: Sun May 30 03:25:35 2010
>> New Revision: 949465
>> 
>> URL: http://svn.apache.org/viewvc?rev=949465&view=rev
>> Log:
>> The paypal checkout should always redirect to sandbox while you are in production environment. Contribution from Divesh&  Pranay - Thanks Guys.
>> 
>> Modified:
>>     ofbiz/trunk/applications/order/src/org/ofbiz/order/thirdparty/paypal/ExpressCheckoutEvents.java
>> 
>> Modified: ofbiz/trunk/applications/order/src/org/ofbiz/order/thirdparty/paypal/ExpressCheckoutEvents.java
>> URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/thirdparty/paypal/ExpressCheckoutEvents.java?rev=949465&r1=949464&r2=949465&view=diff
>> ==============================================================================
>> --- ofbiz/trunk/applications/order/src/org/ofbiz/order/thirdparty/paypal/ExpressCheckoutEvents.java (original)
>> +++ ofbiz/trunk/applications/order/src/org/ofbiz/order/thirdparty/paypal/ExpressCheckoutEvents.java Sun May 30 03:25:35 2010
>> @@ -81,13 +81,37 @@ public class ExpressCheckoutEvents {
>>      }
>> 
>>      public static String expressCheckoutRedirect(HttpServletRequest request, HttpServletResponse response) {
>> +        Delegator delegator = (Delegator) request.getAttribute("delegator");
>>          ShoppingCart cart = ShoppingCartEvents.getCartObject(request);
>>          String token = (String) cart.getAttribute("payPalCheckoutToken");
>> +        String paymentGatewayConfigId = null;
>> +        GenericValue payPalGatewayConfig = null;
>> +        String productStoreId = null;
>>          if (UtilValidate.isEmpty(token)) {
>>              Debug.logError("No ExpressCheckout token found in cart, you must do a successful setExpressCheckout before redirecting.", module);
>>              return "error";
>>          }
>> -        StringBuilder redirectUrl = new StringBuilder("https://www.sandbox.paypal.com/cgi-bin/webscr");
>> +        if (cart != null) {
>> +            productStoreId = cart.getProductStoreId();
>> +        }
>> +        if (productStoreId != null) {
>> +            GenericValue payPalPaymentSetting = ProductStoreWorker.getProductStorePaymentSetting(delegator, productStoreId, "EXT_PAYPAL", null, true);
>> +            if (payPalPaymentSetting != null) {
>> +                paymentGatewayConfigId = payPalPaymentSetting.getString("paymentGatewayConfigId");
>> +            }
>> +        }
>> +        if (paymentGatewayConfigId != null) {
>> +            try {
>> +                payPalGatewayConfig = delegator.findOne("PaymentGatewayPayPal", true, "paymentGatewayConfigId", paymentGatewayConfigId);
>> +            } catch (GenericEntityException e) {
>> +                Debug.logError(e, module);
>> +            }
>> +        }
>> +        if (payPalGatewayConfig == null) {
>> +            request.setAttribute("_EVENT_MESSAGE_", "Couldn't retrieve a PaymentGatewayConfigPayPal record for Express Checkout, cannot continue.");
>> +            return "error";
>> +        }
>> +        StringBuilder redirectUrl = new StringBuilder(payPalGatewayConfig.getString("redirectUrl"));
>>          redirectUrl.append("?cmd=_express-checkout&token=");
>>          redirectUrl.append(token);
>>          try {
>> 
>> 
>> 
> 


Re: svn commit: r949465 - /ofbiz/trunk/applications/order/src/org/ofbiz/order/thirdparty/paypal/ExpressCheckoutEvents.java

Posted by BJ Freeman <bj...@free-man.net>.
I was checking out the jira OFBIZ-3895
and ran across this in orders.
there is also one done by Scott in accounting.
should these be merged and put in one place.

=========================
BJ Freeman  <http://bjfreeman.elance.com>
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


ashish@apache.org sent the following on 5/29/2010 8:25 PM:
> Author: ashish
> Date: Sun May 30 03:25:35 2010
> New Revision: 949465
>
> URL: http://svn.apache.org/viewvc?rev=949465&view=rev
> Log:
> The paypal checkout should always redirect to sandbox while you are in production environment. Contribution from Divesh&  Pranay - Thanks Guys.
>
> Modified:
>      ofbiz/trunk/applications/order/src/org/ofbiz/order/thirdparty/paypal/ExpressCheckoutEvents.java
>
> Modified: ofbiz/trunk/applications/order/src/org/ofbiz/order/thirdparty/paypal/ExpressCheckoutEvents.java
> URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/thirdparty/paypal/ExpressCheckoutEvents.java?rev=949465&r1=949464&r2=949465&view=diff
> ==============================================================================
> --- ofbiz/trunk/applications/order/src/org/ofbiz/order/thirdparty/paypal/ExpressCheckoutEvents.java (original)
> +++ ofbiz/trunk/applications/order/src/org/ofbiz/order/thirdparty/paypal/ExpressCheckoutEvents.java Sun May 30 03:25:35 2010
> @@ -81,13 +81,37 @@ public class ExpressCheckoutEvents {
>       }
>
>       public static String expressCheckoutRedirect(HttpServletRequest request, HttpServletResponse response) {
> +        Delegator delegator = (Delegator) request.getAttribute("delegator");
>           ShoppingCart cart = ShoppingCartEvents.getCartObject(request);
>           String token = (String) cart.getAttribute("payPalCheckoutToken");
> +        String paymentGatewayConfigId = null;
> +        GenericValue payPalGatewayConfig = null;
> +        String productStoreId = null;
>           if (UtilValidate.isEmpty(token)) {
>               Debug.logError("No ExpressCheckout token found in cart, you must do a successful setExpressCheckout before redirecting.", module);
>               return "error";
>           }
> -        StringBuilder redirectUrl = new StringBuilder("https://www.sandbox.paypal.com/cgi-bin/webscr");
> +        if (cart != null) {
> +            productStoreId = cart.getProductStoreId();
> +        }
> +        if (productStoreId != null) {
> +            GenericValue payPalPaymentSetting = ProductStoreWorker.getProductStorePaymentSetting(delegator, productStoreId, "EXT_PAYPAL", null, true);
> +            if (payPalPaymentSetting != null) {
> +                paymentGatewayConfigId = payPalPaymentSetting.getString("paymentGatewayConfigId");
> +            }
> +        }
> +        if (paymentGatewayConfigId != null) {
> +            try {
> +                payPalGatewayConfig = delegator.findOne("PaymentGatewayPayPal", true, "paymentGatewayConfigId", paymentGatewayConfigId);
> +            } catch (GenericEntityException e) {
> +                Debug.logError(e, module);
> +            }
> +        }
> +        if (payPalGatewayConfig == null) {
> +            request.setAttribute("_EVENT_MESSAGE_", "Couldn't retrieve a PaymentGatewayConfigPayPal record for Express Checkout, cannot continue.");
> +            return "error";
> +        }
> +        StringBuilder redirectUrl = new StringBuilder(payPalGatewayConfig.getString("redirectUrl"));
>           redirectUrl.append("?cmd=_express-checkout&token=");
>           redirectUrl.append(token);
>           try {
>
>
>


Re: svn commit: r949465 - /ofbiz/trunk/applications/order/src/org/ofbiz/order/thirdparty/paypal/ExpressCheckoutEvents.java

Posted by Ashish Vijaywargiya <vi...@gmail.com>.
Log message updated. Thanks Adam!

--
Ashish

On Sun, May 30, 2010 at 9:24 AM, Adam Heath <do...@brainfood.com> wrote:
> Ashish Vijaywargiya wrote:
>> ???
>>
>> Oh... yes it was always redirecting to sandbox but after this fix it
>> will handle the request properly for sandbox as well as for
>> production.
>
> Yeah, the commit message was backwords.  It'd be nice if it was fixed.
>
>>
>> --
>> Ashish
>>
>> On Sun, May 30, 2010 at 8:57 AM, Adam Heath <do...@brainfood.com> wrote:
>>> ashish@apache.org wrote:
>>>> Author: ashish
>>>> Date: Sun May 30 03:25:35 2010
>>>> New Revision: 949465
>>>>
>>>> URL: http://svn.apache.org/viewvc?rev=949465&view=rev
>>>> Log:
>>>> The paypal checkout should always redirect to sandbox while you are in production environment. Contribution from Divesh & Pranay - Thanks Guys.
>>> not?
>>>
>
>

Re: svn commit: r949465 - /ofbiz/trunk/applications/order/src/org/ofbiz/order/thirdparty/paypal/ExpressCheckoutEvents.java

Posted by Adam Heath <do...@brainfood.com>.
Ashish Vijaywargiya wrote:
> ???
> 
> Oh... yes it was always redirecting to sandbox but after this fix it
> will handle the request properly for sandbox as well as for
> production.

Yeah, the commit message was backwords.  It'd be nice if it was fixed.

> 
> --
> Ashish
> 
> On Sun, May 30, 2010 at 8:57 AM, Adam Heath <do...@brainfood.com> wrote:
>> ashish@apache.org wrote:
>>> Author: ashish
>>> Date: Sun May 30 03:25:35 2010
>>> New Revision: 949465
>>>
>>> URL: http://svn.apache.org/viewvc?rev=949465&view=rev
>>> Log:
>>> The paypal checkout should always redirect to sandbox while you are in production environment. Contribution from Divesh & Pranay - Thanks Guys.
>> not?
>>


Re: svn commit: r949465 - /ofbiz/trunk/applications/order/src/org/ofbiz/order/thirdparty/paypal/ExpressCheckoutEvents.java

Posted by Ashish Vijaywargiya <vi...@gmail.com>.
???

Oh... yes it was always redirecting to sandbox but after this fix it
will handle the request properly for sandbox as well as for
production.

--
Ashish

On Sun, May 30, 2010 at 8:57 AM, Adam Heath <do...@brainfood.com> wrote:
> ashish@apache.org wrote:
>> Author: ashish
>> Date: Sun May 30 03:25:35 2010
>> New Revision: 949465
>>
>> URL: http://svn.apache.org/viewvc?rev=949465&view=rev
>> Log:
>> The paypal checkout should always redirect to sandbox while you are in production environment. Contribution from Divesh & Pranay - Thanks Guys.
>
> not?
>

Re: svn commit: r949465 - /ofbiz/trunk/applications/order/src/org/ofbiz/order/thirdparty/paypal/ExpressCheckoutEvents.java

Posted by Adam Heath <do...@brainfood.com>.
ashish@apache.org wrote:
> Author: ashish
> Date: Sun May 30 03:25:35 2010
> New Revision: 949465
> 
> URL: http://svn.apache.org/viewvc?rev=949465&view=rev
> Log:
> The paypal checkout should always redirect to sandbox while you are in production environment. Contribution from Divesh & Pranay - Thanks Guys.

not?