openstore-ecommerce / OS_PayPal

OS PayPal provider
HomePage
0 stars 1 forks source link

OS_PayPal ERROR: System.FormatException #3

Open inu-web opened 3 years ago

inu-web commented 3 years ago

Hi please can somebody give me a hint what the following error may be caused by?

I am using Openstore version 4.1.5 on DNN 9.3.2 and followed the instructions in the integrator manual and various hints I found via google-search.

I configured anything as I remembered how to do it but the "old" documentation from nb-Store seems no more available - The paypal integration was described in more detail there than in the current documentation - as far as I remember.

I am seeing this Error in the BackOffice/Admin/OS_Paypal Payment Plugin Settings on the very bottom of the page... OS_PayPal ERROR: System.FormatException: Input string was not in a correct format. at System.Number.StringToNumber(String str, NumberStyles options, NumberBuffer& number, NumberFormatInfo info, Boolean parseDecimal) at System.Number.ParseInt32(String s, NumberStyles style, NumberFormatInfo info) at System.Convert.ToInt32(String value) at OS_PayPal.PayPalIpnParameters..ctor(HttpRequest ipnRequest) at OS_PayPal.DNN.NBrightStore.OSPayPalNotify.ProcessRequest(HttpContext context)

The transactions payd with paypal work and I am returned to the payment_Ok template/page But the Orders-Area in BackOffice always shows "Payment not verified" instead of "payment OK"

Thanks in advance and kind regards Gerald

image

DNNMonster commented 3 years ago

I have not seen this error so I'm guessing with minimal info.

It sounds like there could be a problem with the item number in the NameValue collection created from the IPN request params getting processing by the web handler.

Hopefully you've got you're dev environment up and you're debugging. The best way to figure it out would be to put a couple of breakpoints near the failure and step through the function to see what is going wrong.

I would start in the web handler.

https://github.com/openstore-ecommerce/OS_PayPal/blob/8a08ee8515ee198d2f7fec1b8ade1ae7086d8634/notify.ashx.cs#L32

I would also put a break point at this line as well. Is the item number really a number? :

https://github.com/openstore-ecommerce/OS_PayPal/blob/8a08ee8515ee198d2f7fec1b8ade1ae7086d8634/PayData.cs#L103

That would be a good starting point.

inu-web commented 3 years ago

Thank you very much for your response. I see this in production environment - I have no dev environment on the production server. So I have no chance to step through the code. Can you tell me what this Item_number is? Is this the Product Code or which parameter in Product admin is this? Paypal only shows me the order-number - no separate items when I am directed to paypal payment page ... I managed to get IPN working now but if someone cancels payment on the paypal page, the order is "copied" - one with "payment not verified" status and one with "payment failed" status Any idea what this may be caused by? thanks a lot for your assistance Gerald

DNNMonster commented 3 years ago

OS sql uses upserts. It will either generate a new record type or update a record if an id is provided.

This looks like it may be happening with your order record. I think the web handler is losing it's id at some point in the code flow.

I am not sure why though.

Is is possible for you to duplicate your production environment to a dev environment so that you can better test?

leedavi commented 3 years ago

Try checking the IPN url... if the paypal provider is in debug mode, there is a debug file in the portal folder of data sent to the bank, that may help understand.

inu-web commented 3 years ago

Thank you all for taking the time to reply. I will try your suggestions as soon as possible and will give feedback here afterwards best regards Gerald