Adyen / adyen-web

Adyen Web Drop-in and Components
https://docs.adyen.com/online-payments
MIT License
181 stars 129 forks source link

BrowserInfo.TimezoneOffset type #2719

Closed mderasse closed 1 month ago

mderasse commented 3 months ago

Describe the bug Hello,

The adyen documentation is not really clear on the browserInfo.timeZoneOffset type on /payments API. API explorer show that it should be an integer https://docs.adyen.com/api-explorer/Checkout/71/post/payments and https://docs.adyen.com/online-payments/3d-secure/api-reference/ is showing it as a string.

On the other end the golang SDK (https://github.com/Adyen/adyen-go-api-library) is expecting a Integer but from time to time the Adyen Component is returning that information as a string creating complexity and inaccurate information.

Expected behavior Adyen component should probably always return that information as an integer

BrowserInfo

    "browserInfo": {
        "acceptHeader": "*/*",
        "colorDepth": 24,
        "language": "en-US",
        "javaEnabled": false,
        "screenHeight": 1080,
        "screenWidth": 1920,
        "userAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36 Edg/126.0.0.0",
        "timeZoneOffset": "-60"
    },
ribeiroguilherme commented 2 months ago

Hey @mderasse ,

Sorry for the delay getting back to you here.

It is weird that you are getting different types for the browserInfo.timeZoneOffset property. We just call the built-in browser defined method of the Date object, getTimezoneOffset. This returns a number. We don't do any further manipulation of that field.

I tested through BrowserStack different Edge versions (122, 124, 125, 126) and they are all returning as Integer. I am not sure what can be causing this function to return a string type in your case. Do you have more information about which browsers/versions are returning this as 'string', besides the Edge ones that I mentioned?

mderasse commented 2 months ago

Hi @ribeiroguilherme

I was able to list a few user agent based on the payload the adyen component return.

"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/123.0.0.0 Safari/537.36"
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36"
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36 Edg/122.0.0.0"
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0.0 Safari/537.36 Edg/124.0.0.0"
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/125.0.0.0 Safari/537.36 Edg/125.0.0.0"
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36 Edg/126.0.0.0"
"Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.149 Safari/537.36"
ribeiroguilherme commented 1 month ago

Hi @mderasse ,

Thanks for sharing the browser list. We tested in different browsers as I mentioned above, and we always get the Integer value. As pointed out above, we do not manipulate/cast the returned value at any moment. I suggest in this case that you add your own casting to Integer if you are facing this problem.

If you are able to reproduce in any browser and you can show us that the value is not being returned as Integer, we can re-evaluate this and perhaps add a strict cast on our side.

Cheers