Adyen/adyen-dotnet-api-library

Required field javaEnabled missing for device channel browser in v10.1.0

power-reko opened this issue · 2 comments

Describe the bug

  • Trying to upgrade the library from v9.2.0 to v10.1.0.
  • Found out that if JavaEnabled field on BrowserInfo inside PaymentRequest is set to false payment is not succesfully initialized due to this error coming from your API.
{
    "status": 422,
    "errorCode": "15_002",
    "message": "Required field javaEnabled missing for device channel browser",
    "errorType": "validation",
    "pspReference": "ZLWMH5PCDJHKGK82"
}
  • Seems like the serializer in v10.1.0. ignores the default value as setting JavaEnabled to true works and payment is succesfully initialized.

To Reproduce
Steps to reproduce the behavior:

var checkout = new PaymentsService(new Client(apiKey, adyenEnv, liveEndpointUrlPrefix));
var paymentRequest = new PaymentRequest
{
    ...
    BrowserInfo = new BrowserInfo(
        acceptHeader: browserInfo.AcceptHeader,
        colorDepth: browserInfo.ColorDepth,
        javaEnabled: false,
        javaScriptEnabled: browserInfo.JavaScriptEnabled,
        language: browserInfo.Language,
        screenHeight: browserInfo.ScreenHeight,
        screenWidth: browserInfo.ScreenWidth,
        timeZoneOffset: browserInfo.TimeZoneOffset,
        userAgent: browserInfo.UserAgent),
};

return await checkout.PaymentsAsync(paymentRequest, new Adyen.Model.RequestOptions { IdempotencyKey = Guid.NewGuid().ToString() });

Expected behavior

  • javaEnabled fields false value works correctly

Hi @power-reko,

Thanks for reaching out to us! I pinpointed the issue, it's the way we serialize booleans unfortunately. The default value is false and will be discarded, however that's not always a desirable functionality. I've created a fix to overcome this (basically making booleans nullable), and we will try to release this very soon!

Best, Jilling
Adyen

We're also blocked by this issue - looking forward to a quick fix! 😄 ❤️