PayPal Smart Payments: No checkout possible, wrong XML due to wrong conversion of decimal numbers

7 months ago
Hello,

I use nop 4.20 and the PayPal Smart Payments Plugin. In the plugin configuration I use credentials for sandbox-mode. Payment type is 'capture' - no widgets.

Scenario 1: Selected user language is en-US
I cannot check out with the PayPal Smart Payments option. When I am on step 4 "Payment method" I select PayPal Smart Payment and continue. Then it shows me an order summary and at the end a "back"-link. That's all. Unfortunately there is no entry in the system log.

Please let me know, how I can contribute to debug this error further, as I said, there is no entry in the system log. Just nothing happens...

Scenario 2: Selected user language is de-DE
Same result as described above, but there is an entry in the system log. It indicates that values are not formatted correctly in the xml (See error details below). This is because decimal numbers are rendered in german formatting, that means with a , as decimal point. But here formatting must not be applied with the local formatting options, but always with the one required by the xml (which is english).

By the way: the problem with the wrong rendering of decimal numbers in context of german language is also a problem in the UPS plugin.

Kind regards,
Stephan

Here is the error of the system log:

Payments.PayPalSmartPaymentButtons error:
One or more errors occurred. ({"name":"INVALID_REQUEST","message":"Request is not well-formed, syntactically incorrect, or violates schema.","debug_id":"6674657c0b980","details":[{"field":"/purchase_units/@reference_id=='610bacc6-4a88-4f39-8212-79aef76629b9'/amount/breakdown/tax_total/value","value":"597,94","location":"body","issue":"INVALID_PARAMETER_SYNTAX","description":"The value of a field does not conform to the expected format."},{"field":"/purchase_units/@reference_id=='610bacc6-4a88-4f39-8212-79aef76629b9'/items/2/unit_amount/value","value":"100,00","location":"body","issue":"INVALID_PARAMETER_SYNTAX","description":"The value of a field does not conform to the expected format."},{"field":"/purchase_units/@reference_id=='610bacc6-4a88-4f39-8212-79aef76629b9'/items/3/unit_amount/value","value":"116,81","location":"body","issue":"INVALID_PARAMETER_SYNTAX","description":"The value of a field does not conform to the expected format."},{"field":"/purchase_units/@reference_id=='610bacc6-4a88-4f39-8212-79aef76629b9'/amount/value","value":"5094,01","location":"body","issue":"INVALID_PARAMETER_SYNTAX","description":"The value of a field does not conform to the expected format."},{"field":"/purchase_units/@reference_id=='610bacc6-4a88-4f39-8212-79aef76629b9'/items/0/unit_amount/value","value":"150,42","location":"body","issue":"INVALID_PARAMETER_SYNTAX","description":"The value of a field does not conform to the expected format."},{"field":"/purchase_units/@reference_id=='610bacc6-4a88-4f39-8212-79aef76629b9'/items/4/unit_amount/value","value":"1349,00","location":"body","issue":"INVALID_PARAMETER_SYNTAX","description":"The value of a field does not conform to the expected format."},{"field":"/purchase_units/@reference_id=='610bacc6-4a88-4f39-8212-79aef76629b9'/amount/breakdown/item_total/value","value":"4496,07","location":"body","issue":"INVALID_PARAMETER_SYNTAX","description":"The value of a field does not conform to the expected format."},{"field":"/purchase_units/@reference_id=='610bacc6-4a88-4f39-8212-79aef76629b9'/amount/breakdown/shipping/value","value":"0,00","location":"body","issue":"INVALID_PARAMETER_SYNTAX","description":"The value of a field does not conform to the expected format."},{"field":"/purchase_units/@reference_id=='610bacc6-4a88-4f39-8212-79aef76629b9'/amount/breakdown/discount/value","value":"0,00","location":"body","issue":"INVALID_PARAMETER_SYNTAX","description":"The value of a field does not conform to the expected format."},{"field":"/purchase_units/@reference_id=='610bacc6-4a88-4f39-8212-79aef76629b9'/items/1/unit_amount/value","value":"2663,03","location":"body","issue":"INVALID_PARAMETER_SYNTAX","description":"The value of a field does not conform to the expected format."}],"links":[{"href":"https://developer.paypal.com/docs/api/orders/v2/#error-INVALID_PARAMETER_SYNTAX","rel":"information_link","encType":"application/json"}]})
7 months ago
Ok, here is an important update.

We must split this into two issues:

1) The PayPal Buttons do not show up

I noticed that this might be a browser problem. See the different screenshots. The buttons simply do not show up in Firefox:



But they are visible in Edge:



2) Wrong formatting of decimal number
The problem still is there, it leads to wrong XML-Code  which cannot be processed, thus an error message like "Error: Expected an order id to be passed" is displayed.




Stephan
7 months ago
And here is what the Firefox web developer console says when the buttons do not show up:

Error: zoid destroyed all components
7 months ago
Thanks

1. Could you please confirm that it doesn't work in Firefox only?

2. The decimal issue is already fixed (details)
7 months ago
Here are the results with different browsers (on a windows 10 machine)

FF 75.0: does not work (tested on two different machines)
Opera 68.0.3618.52: does work
Chrome 81.0.4044.129: does work
Edge (newest Version): does work
IE 11: does work

I also checked, if some of my FF settings or the use of a virus protection programm could cause the problem, but it still doesn't work. I think somebody else should  test it with FF to be sure.

My current version of the PayPalSmartPaymentButtons Plugin is 1.06

You said, that the decimal issue is fixed. I took a look at https://github.com/nopSolutions/nopCommerce/tree/develop/src/Plugins/Nop.Plugin.Payments.PayPalSmartPaymentButtons - the plugin.json says, that supported version is only 4.30. What could be the best way for me, to use and fixed version of the plugin in my 4.20 installation?

Thank, Stephan
7 months ago
schurig wrote:
What could be the best way for me, to use and fixed version of the plugin in my 4.20 installation?

Just apply the same changes to your version 4.20