Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cc_type is not set for adyen_cc payments #2872

Open
DanieliMi opened this issue Jan 29, 2025 · 2 comments
Open

cc_type is not set for adyen_cc payments #2872

DanieliMi opened this issue Jan 29, 2025 · 2 comments
Labels
Bug report Indicates that issue has been marked as a possible bug

Comments

@DanieliMi
Copy link

Describe the bug
When paying with a credit card the used card type is not saved in sales_order_payment.cc_type. This used to work in v8.

To Reproduce
Steps to reproduce the behavior:

  1. Put a product into your cart
  2. Go to checkout
  3. Pay with a credit card such as VISA
  4. Credit card type is not stored

Expected behavior
The card type is saved (VI for VISA).

Magento version
2.4.6-p8

Plugin version
9.12.2

Additional context
It seems the API endpoint might have changed.

if (!empty($response['additionalData']['paymentMethod'])) {
is looking for $response['additionalData']['paymentMethod'] but when I debug the response from the test instance is:

array (
  'amount' => 
  array (
    'currency' => 'EUR',
    'value' => 2685,
  ),
  'merchantReference' => '123456',
  'paymentMethod' => 
  array (
    'brand' => 'visa',
    'type' => 'scheme',
  ),
  'pspReference' => 'ABC123',
  'resultCode' => 'Authorised',
)
@DanieliMi DanieliMi added the Bug report Indicates that issue has been marked as a possible bug label Jan 29, 2025
@DanieliMi
Copy link
Author

Changing the code to

                if (!empty($response['paymentMethod']['brand'])) {
                    $ccType = $this->adyenHelper->getMagentoCreditCartType(
                        $response['paymentMethod']['brand']
                    );
                    $payment->setAdditionalInformation('cc_type', $ccType);
                    $payment->setCcType($ccType);
                }

did in fact set the cc_type again as it used to.

@DanieliMi
Copy link
Author

Interestingly I just compared with v8 and the code is the same. I also verified with the API explorer... it should work. So why do we get a different response?
In case it helps, those are the logs:

AdyenLoggerTest.INFO: Request to Adyen API /payments

{
    "apiVersion": "v71",
    "body": {
        "merchantAccount": "someAccount",
        "shopperReference": "XXXX-XXXX-XXXX-XXXX-XXXX",
        "shopperEmail": "[email protected]",
        "telephoneNumber": "+49123456789",
        "shopperName": {
            "firstName": "Dev",
            "lastName": "Test"
        },
        "countryCode": "DE",
        "shopperLocale": "de_DE",
        "shopperIP": "127.0.0.1",
        "billingAddress": {
            "street": "Some Street",
            "postalCode": "12345",
            "city": "Some City",
            "houseNumberOrName": "1",
            "country": "DE",
            "stateOrProvince": "HES"
        },
        "deliveryAddress": {
            "street": "Some Street",
            "postalCode": "12345",
            "city": "Some City",
            "houseNumberOrName": "1",
            "country": "DE",
            "stateOrProvince": "HES"
        },
        "amount": {
            "currency": "EUR",
            "value": 9685
        },
        "reference": "123456789",
        "fraudOffset": "0",
        "browserInfo": {
            "userAgent": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/132.0.0.0 Safari/537.36",
            "acceptHeader": "*/*",
            "colorDepth": 24,
            "language": "en-US",
            "javaEnabled": false,
            "screenHeight": 1080,
            "screenWidth": 1920,
            "timeZoneOffset": -60
        },
        "shopperInteraction": "Ecommerce",
        "paymentMethod": {
            "type": "scheme",
            "holderName": "Someone",
            "encryptedCardNumber": "XXXY",
            "encryptedExpiryMonth": "XXX",
            "encryptedExpiryYear": "XXX",
            "encryptedSecurityCode": "XXX",
            "brand": "visa",
            "checkoutAttemptId": "XXX"
        },
        "riskData": {
            "clientData": "XXX"
        },
        "additionalData": {
            "allow3DS2": true
        },
        "returnUrl": "https://example.com/adyen/return?merchantReference=123456789",
        "channel": "web",
        "origin": "https://example.com/",
        "applicationInfo": {
            "Adyen\\Model\\Checkout\\ApplicationInfo": {
                "adyenLibrary": {
                    "name": "adyen-php-api-library",
                    "version": "20.4.0"
                },
                "externalPlatform": {
                    "name": "Magento",
                    "version": "2.4.6-p8",
                    "integrator": "Adyen"
                },
                "merchantApplication": {
                    "name": "adyen-magento2",
                    "version": "9.12.2"
                }
            }
        }
    }
}

AdyenLoggerTest.INFO: Response from Adyen API

{
    "body": {
        "amount": {
            "currency": "EUR",
            "value": 9685
        },
        "merchantReference": "123456789",
        "paymentMethod": {
            "brand": "visa",
            "type": "scheme"
        },
        "pspReference": "V2XXX",
        "resultCode": "Authorised"
    }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug report Indicates that issue has been marked as a possible bug
Projects
None yet
Development

No branches or pull requests

1 participant