let me clarify that I use the IPN version of paypal before the express
code was introduced. So I will leave that to Scott.
as Scott mentioned please open a Jira and put comment there
https://cwiki.apache.org/confluence/display/OFBADMIN/OFBiz+Contributors+Best+Practices
an link you may find helpful
https://cwiki.apache.org/confluence/display/OFBIZ/Third+Party+Payment+and+Shipment+Configuration
What I do want to address is there are many options to passing and
receiving parameters to and from paypal.
to make Paypal interface in ofbiz flexible I added properties, like
GetShippingFromPaypal and UsePayPalAddressVerification and the code to
support them.
张良 sent the following on 8/18/2010 12:50 AM:
> Hi all,
>
> Many thanks for all your replies. I'm sorry for my lateness.
>
> I'm working on the PayPal stuff these days. I encountered another
> problem with the function which accepts callback from Paypal then
> sents response of shipping methods and shipping prices to Paypal. The
> callback URL '/control/payPalCheckoutUpdate' was invoked by Paypal but
> the shipping prices displayed on Paypal were not updated.
>
> This issue was caused by the value of the parameter named "MAXAMT"
> sent to Paypal.
> In the funtion addCartDetails in PaypalServices.java, it sums up all
> sub totals and other adjustments, but it may not sums up a shipping
> price because there may be not a shiping price set in the cart.
> encoder.add("MAXAMT",
> cart.getSubTotal().add(otherAdjustments).setScale(2).toPlainString());
>
> For example, i bought a product values $100. The value of "MAXAMT"
> would be "100". Then I was redirected to Paypal and Paypal tried to
> sending address information to the website and get a shipping method
> called 'EXPRESS' which costs $20. Paypal would not update the shipping
> price, because 100 (sub total) + 20 (postage)> 100 (MAXAMT).
>
> I fixed the issue in a rough way which just add 1000 more to the MAXAMT:
> encoder.add("MAXAMT",
> cart.getSubTotal().add(otherAdjustments).add(BigDecimal.valueOf(1000l)).setScale(2).toPlainString());
>
> And there's another problem with calculating shipping price in
> funciton 'getExpressCheckout' at line 615:
> Map<String, Object> result =
> ShippingEvents.getShipGroupEstimate(dispatcher, delegator, cart, 0);
> I wrote a shipment service for one shipping method which calculates
> the shipping price from the country geo id. That service can get the
> contactMechId from the service context but it gets a null value from
> the database:
> shippingAddress = delegator.findByPrimaryKey("PostalAddress",
> UtilMisc.toMap("contactMechId", shippingContactMechId));
>
> I modified the code about shipping price getExpressCheckout in
> PayPalServices.java and get the shipping price directly from PayPal :
> BigDecimal shippingTotal = new BigDecimal(decoder.get("SHIPPINGAMT"));
>
> Cheers
>
> Liang
>
> 2010/8/17, BJ Freeman<[email protected]>:
>> since the code you removed checks to see if
>> cart.getAttribute("payPalCheckoutToken");
>> is empty then adds it, I would say the problem is farther up the line.
>>
>>
>> Pranay Pandey sent the following on 8/16/2010 3:40 AM:
>>> Hi Liang and Scott,
>>>
>>> This is the solution to the problem that I also found when I
>>> communicated the issue with PayPal developers network. It seems correct.
>>>
>>> Thanks& Regards
>>> --
>>> Pranay Pandey
>>>
>>> On Aug 13, 2010, at 3:17 PM, 张良 wrote:
>>>
>>>> Hi there,
>>>>
>>>> I was redirected to Paypal when the first time i click the link
>>>> /control/setPayPalCheckout after I added some items into the cart, and I
>>>> returned back to the website without finished the payment on Paypal.
>>>> Then i
>>>> failed to be redirected to Paypal again after I clicked the link
>>>> /control/setPayPalCheckout again.
>>>>
>>>> I don't know much about the Paypal express checkout, but I found a way to
>>>> resovle this problem. I'm not sure if it's the correct way. Does
>>>> anyone have
>>>> ideas about this?
>>>>
>>>> There are 3 lines in PayPalServices.java from 111 to 113:
>>>> if (UtilValidate.isNotEmpty(token)) {
>>>> encoder.add("TOKEN", token);
>>>> }
>>>>
>>>> The problem went away after I commented out those 3 lines. Any helps on
>>>> this will be appreciated.
>>>>
>>>> Regards,
>>>>
>>>> Liang Zhang
>>>
>>>
>>
>