PayPal Commerce code

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
1 year ago
Hi there.
I am testing the new PayPal Commerce plugin on a 4.40.4 store and the way it calculates the Tax is not correct.

It is adding a "discount" to all orders which is essentially the tax (VAT in the UK) on the shipping.

It is showing the correct tax amount ( it pulls this from both product and shipping value), alongside the EXCLUDING-TAX amount for products, but then using the INCLUDING-TAX value for the Shipping, which is obviously wreaking havoc with the calculations. I can see the code:

ServiceManager.cs
//set totals
                itemTotal = Math.Round(itemTotal, 2);
                var discountTotal = Math.Round(itemTotal + taxTotal + shippingTotal - orderTotal, 2);
                purchaseUnit.AmountWithBreakdown = new AmountWithBreakdown

These line items are being shows to the customer in the PayPal summary.

This is simply not correct as the shipping amount needs to be excluding VAT as well.
If a discount is added to an order it does get added to the "discount line item", but because of the way the shipping is calculated it is incorrect.

Surely i cant be the only retailer to notice this?

Let me know your thoughts... I can send screenshots of the weird values.
1 year ago
The reasons for calculation problems and the entry of strange discountTotal are not only in shipping count, it's also affected by differences in the results rounding on our side and on PayPal's side. We've already added some workarounds to fix this issue, see details here.

But you are certainly right about the calculation of the shipping total including tax, we'll add the needed changes to the plugin. Thanks for pointing out this bug.
1 year ago
We are having many issues with this plugin. It is not returning the user back to nopCommerce from PayPal. Our lead developer is trying to track the order GUID as the return error log seems to not be able to find the GUID of the order.

The error message in the nop logs is as follows:

Error
Short message  
Payments.PayPalCommerce error:
Could not find an order 5aa2833f-9aaf-4519-bb63-239d869db9ff

Is anyone using this plugin without errors?
1 year ago
In the earlier versions of the plugin it does not automatically create an order after payment so if the customer does not follow the workflow there will not be any order for the Guid so you will not be able to find an order.
I think I saw some modifications which may have fixed this - there was also some other code changes in in the v4.5 and later versions

Yes people are using the plugin I have an Order Autocomplete version which also allows additional fees to be added and the default currency to be selected
See https://selectsystems.com.au/paypal-commerce-auto-complete-version
1 year ago
What do you mean by "if the customer does not follow the workflow"? Something nopCommerce should be doing as standard? In this case there's a custom one page checkout in play, so it's possible there's an issue that we haven't run into with any other payment plugins.

I've checked the updates in both 4.4 and 4.5 - doesn't look like there's anything relevant to this.

(I'm Graham's senior developer, by the way).
1 year ago
For the sake of completion, the problem turned out to be very simple - following payment, the PayPal Commerce plugin doesn't call the PaymentInfo JavaScript object directly, it triggers a click event on the the continue button for the stage. The selector it uses for this (but not for showing and hiding the button, which just uses class) specifies a button tag - but the one in our one page checkout was an input of type button, so never received the click event.

All that was required was changing to a button tag.
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.