Skip to content

[Bug]: BCMC payment method deserialization fails with "2 classes match result" error in v39.x #1531

@lderks

Description

@lderks

Description

We've identified a bug in the Adyen Java API Library where BCMC payment method deserialization fails when upgrading from version 38.3.0 to any version 39.x (39.0.0, 39.1.0, 39.2.0).

Steps to reproduce

Use Adyen Java API Library version 39.0.0 or higher
adyen.CheckoutPaymentMethod.fromJson(json.noSpaces)
Attempt to deserialize a BCMC payment method with the following JSON structure:

{
  "paymentMethod": {
    "type": "bcmc",
    "holderName": "",
    "encryptedCardNumber": "...",
    "encryptedExpiryMonth": "...",
    "encryptedExpiryYear": "...",
    "brand": "bcmc",
    "checkoutAttemptId": "..."
  },
  "browserInfo": {
    "acceptHeader": "*/*",
    "colorDepth": 24,
    "language": "nl-NL",
    "javaEnabled": false,
    "screenHeight": 1440,
    "screenWidth": 3440,
    "userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/138.0.0.0 Safari/537.36",
    "timeZoneOffset": -120
  },
  "origin": "https://accept.mydomain.be",
  "clientStateDataIndicator": true
}

Actual behavior

Deserialization fails with the error:

Failed deserialization for CheckoutPaymentMethod: 2 classes match result, expected 1 at 'paymentMethod'

When the error occurs, there's also a warning in the logs:

WARNING: TypeEnum: unexpected enum value 'bcmc' - Supported values are [bcmc_mobile, bcmc_mobile_QR, bcmc_mobile_app, momo_wallet, momo_wallet_app, paymaya_wallet, grabpay_SG, grabpay_MY, grabpay_TH, grabpay_ID, grabpay_VN, grabpay_PH, oxxo, gcash, dana, kakaopay, truemoney, paysafecard]

Expected behavior

The BCMC payment method should deserialize successfully, as it does in version 38.3.0.

Code snippet or screenshots (if applicable)

No response

Adyen Java API Library version

39.0.0, 39.1.0, 39.2.0

Java version

21.0.2

Operating System

Other

Additional context

Currently, we're forced to stay on version 38.3.0 to maintain BCMC payment functionality.

The Adyen /paymentMethods endpoint returns BCMC as a valid payment method:

{
  "paymentMethods": [
    {
      "brands": ["bcmc"],
      "name": "Bancontact card", 
      "type": "bcmc"
    }
  ]
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions