Skip to content

[ECP-9904] Stop setting cc_type in payment additional_information#3264

Merged
candemiralp merged 8 commits into
develop-11from
ECP-9904
Mar 9, 2026
Merged

[ECP-9904] Stop setting cc_type in payment additional_information#3264
candemiralp merged 8 commits into
develop-11from
ECP-9904

Conversation

@candemiralp

@candemiralp candemiralp commented Mar 4, 2026

Copy link
Copy Markdown
Contributor

Description

With this refactoring, the plugin now sets card type only on cc_type field of sales_order_payment table but not on the additional_information.

@candemiralp candemiralp requested a review from a team as a code owner March 4, 2026 13:41
@candemiralp candemiralp changed the base branch from main to develop-11 March 4, 2026 13:41
@gemini-code-assist

Copy link
Copy Markdown
Contributor

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request refactors how credit card type (cc_type) information is handled within the payment processing module. The primary goal is to centralize the storage and retrieval of cc_type to its dedicated field on the payment object, moving away from storing it redundantly in the additional_information array. This change improves data integrity, simplifies the codebase, and ensures that cc_type is consistently managed across various payment flows.

Highlights

  • Data Storage Refinement: The cc_type information is no longer stored within the generic additional_information array of payment objects. Instead, it is now exclusively managed through the dedicated setCcType() and getCcType() methods, ensuring data consistency and preventing redundancy.
  • Cleanup Process Update: The FIELD_CC_TYPE constant has been removed from the CleanupAdditionalInformationInterface, indicating that cc_type will no longer be targeted for cleanup from the additional_information array, aligning with its new dedicated storage.
  • Payment Response Handling Streamlined: Logic in payment response handlers and data assignment observers has been updated to directly set the cc_type using setCcType(), removing previous checks and assignments to the additional_information array for this specific field.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Changelog
  • Api/CleanupAdditionalInformationInterface.php
    • Removed FIELD_CC_TYPE constant.
    • Removed FIELD_CC_TYPE from the FIELDS_TO_BE_CLEANED_UP array.
  • Gateway/Response/CheckoutPaymentsResponseHandler.php
    • Removed logic to retrieve cc_type from additional_information.
    • Removed logic to set cc_type into additional_information.
    • Updated to directly set cc_type using setCcType() from the response's additionalData.
  • Gateway/Validator/InstallmentRequestValidator.php
    • Changed getAdditionalInformation('cc_type') to getCcType() for retrieving the credit card type.
  • Helper/PaymentResponseHandler.php
    • Removed logic to retrieve cc_type from additional_information.
    • Removed logic to set cc_type into additional_information.
    • Updated to directly set cc_type using setCcType() from the response's additionalData.
  • Observer/AdyenCcDataAssignObserver.php
    • Removed unsAdditionalInformation(self::CC_TYPE).
    • Added logic to set cc_type via setCcType() and then unset it from additionalData.
    • Removed redundant cc_type setting block.
  • Observer/AdyenMotoDataAssignObserver.php
    • Added logic to set cc_type via setCcType() and then unset it from additionalData.
    • Removed redundant cc_type setting block.
  • Observer/AdyenPaymentMethodDataAssignObserver.php
    • Changed unsAdditionalInformation(AdyenCcDataAssignObserver::CC_TYPE) to setCcType(null) for clearing the credit card type.
  • Observer/AdyenPosCloudDataAssignObserver.php
    • Changed unsAdditionalInformation('cc_type') to setCcType(null) for clearing the credit card type.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request refactors how cc_type is handled by no longer storing it in the payment's additional_information and instead using the dedicated cc_type property on the payment object. This is a good improvement for code clarity and correctness. The changes are consistently applied across various observers and response handlers.

Additionally, the Magento edition is now included in the platform information sent to Adyen, which is a helpful enhancement.

I've suggested a minor improvement in two files to make the string concatenation for the platform name more robust, preventing potential trailing spaces if the edition is empty.

I am having trouble creating individual review comments. Click here to see my feedback.

Helper/Data.php (464-465)

medium

While concatenating the platform name and edition is a good improvement, this implementation could result in a trailing space if edition is empty or null. A more robust way to handle this would be to filter out empty parts before joining them.

        $platformName = implode(' ', array_filter([$platformData['name'], $platformData['edition'] ?? null]));
        $client->setExternalPlatform($platformName, $platformData['version'], $platformIntegrator);

Helper/PointOfSale.php (73)

medium

Similar to the change in Helper/Data.php, this concatenation could result in a trailing space if getEdition() returns an empty string. It's better to filter out empty parts before joining.

        [ApplicationInfo::NAME] = implode(' ', array_filter([$this->productMetadata->getName(), $this->productMetadata->getEdition()]));

@sonarqubecloud

sonarqubecloud Bot commented Mar 5, 2026

Copy link
Copy Markdown

@candemiralp candemiralp merged commit c19c15e into develop-11 Mar 9, 2026
9 of 10 checks passed
@candemiralp candemiralp deleted the ECP-9904 branch March 9, 2026 12:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants