Skip to content

v6: GooglePay - Add application parameter to factories#2609

Draft
ozgur00 wants to merge 1 commit intomainfrom
chore/factory-application
Draft

v6: GooglePay - Add application parameter to factories#2609
ozgur00 wants to merge 1 commit intomainfrom
chore/factory-application

Conversation

@ozgur00
Copy link
Copy Markdown
Contributor

@ozgur00 ozgur00 commented Feb 25, 2026

Description

We need to include application parameter in factory functions to be able to pass it into GooglePayAvailabilityCheck.

Checklist

  • Changes are tested manually

Ticket Number

COSDK-936

@ozgur00 ozgur00 requested a review from a team as a code owner February 25, 2026 12:29
@gemini-code-assist
Copy link
Copy Markdown
Contributor

Summary of Changes

Hello @ozgur00, 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 introduces the Application context as a new parameter to the core payment component factory interfaces and their implementations. This modification is essential for enabling the GooglePayAvailabilityCheck functionality by providing the necessary application context to payment component creation processes. The changes ensure that the application context is correctly passed down the component hierarchy, affecting various payment methods and internal facilitators.

Highlights

  • Application Parameter Addition: The Application parameter has been added to the create methods of PaymentComponentFactory and StoredPaymentComponentFactory interfaces, as well as their implementations across various payment methods like BLIK, Card, Google Pay, and MB Way.
  • Context Propagation: The Application context is now propagated through PaymentMethodProvider and AdvancedPaymentFacilitatorFactory to ensure it's available when creating payment components.
  • Google Pay Availability Check: This change facilitates the ability to pass the Application parameter into GooglePayAvailabilityCheck, which is crucial for its functionality.
  • Test Updates: Unit tests for PaymentMethodProvider have been updated to include the new Application parameter in factory create calls and to mock an Application instance.

🧠 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
  • blik/src/main/java/com/adyen/checkout/blik/internal/ui/BlikFactory.kt
    • Added android.app.Application import.
    • Included application: Application parameter in both create methods for PaymentComponentFactory and StoredPaymentComponentFactory.
  • card/src/main/java/com/adyen/checkout/card/internal/ui/CardFactory.kt
    • Added android.app.Application import.
    • Included application: Application parameter in both create methods for PaymentComponentFactory and StoredPaymentComponentFactory.
  • core/src/main/java/com/adyen/checkout/core/components/internal/AdvancedPaymentFacilitatorFactory.kt
    • Passed applicationContext.applicationContext as android.app.Application to PaymentMethodProvider.get.
  • core/src/main/java/com/adyen/checkout/core/components/internal/PaymentComponentFactory.kt
    • Added android.app.Application import.
    • Included application: Application parameter in the create method.
  • core/src/main/java/com/adyen/checkout/core/components/internal/PaymentMethodProvider.kt
    • Added android.app.Application import.
    • Included application: Application parameter in the public get method.
    • Passed the application parameter to internal getPaymentComponent and getStoredPaymentComponent methods.
    • Included application: Application parameter in the private getPaymentComponent and getStoredPaymentComponent methods.
    • Passed the application parameter to the create method of registered factories.
  • core/src/main/java/com/adyen/checkout/core/components/internal/StoredPaymentComponentFactory.kt
    • Added android.app.Application import.
    • Included application: Application parameter in the create method.
  • core/src/main/java/com/adyen/checkout/core/sessions/internal/SessionsPaymentFacilitatorFactory.kt
    • Passed applicationContext.applicationContext as android.app.Application to PaymentMethodProvider.get.
    • Refactored the creation of componentEventHandler into a new private method createComponentEventHandler.
  • core/src/test/java/com/adyen/checkout/core/components/internal/PaymentMethodProviderTest.kt
    • Added android.app.Application import.
    • Included application = generateApplication() in all PaymentMethodProvider.get calls within tests.
    • Added application: Application parameter to the create methods of the anonymous PaymentComponentFactory and StoredPaymentComponentFactory test implementations.
    • Introduced a private helper function generateApplication() to mock an Application instance.
  • googlepay/src/main/java/com/adyen/checkout/googlepay/internal/ui/GooglePayFactory.kt
    • Added android.app.Application import.
    • Included application: Application parameter in the create method.
  • mbway/src/main/java/com/adyen/checkout/mbway/internal/ui/MBWayFactory.kt
    • Added android.app.Application import.
    • Included application: Application parameter in the create method.
Activity
  • The author has manually tested the changes to ensure functionality.
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.

@AdyenAutomationBot AdyenAutomationBot added the Chore [PRs only] Indicates any task that does not need to be mentioned in the public release notes label Feb 25, 2026
@ozgur00 ozgur00 changed the title v6 - Add application parameter to factories v6: GooglePay - Add application parameter to factories Feb 25, 2026
Copy link
Copy Markdown
Contributor

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

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 adds an application parameter to the PaymentComponentFactory and StoredPaymentComponentFactory interfaces, and updates all implementations and call sites accordingly. This is a good structural change that will allow passing the application context where needed. The code changes are logical and well-implemented. I've included a few minor suggestions to improve code style and maintainability.


private fun createComponentEventHandler(
sessionSavedStateHandleContainer: SessionSavedStateHandleContainer,
analyticsManager: com.adyen.checkout.core.analytics.internal.AnalyticsManager,
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.

medium

For better readability, you could import com.adyen.checkout.core.analytics.internal.AnalyticsManager at the top of the file and use the simple name AnalyticsManager here.

Suggested change
analyticsManager: com.adyen.checkout.core.analytics.internal.AnalyticsManager,
analyticsManager: AnalyticsManager,

isFlowTakenOver = sessionSavedStateHandleContainer.isFlowTakenOver ?: false,
)

return SessionsComponentEventHandler(
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.

medium

The // TODO - Based on txVariant, needs to be abstracted away comment was removed during this refactoring. Since this logic is still generic, consider re-adding the TODO here to ensure this future work is not forgotten.

}

private fun generateApplication(): Application {
return org.mockito.Mockito.mock(Application::class.java)
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.

medium

To improve code style, you can add import org.mockito.Mockito at the top of the file and use Mockito.mock(Application::class.java) here. With a static import like import org.mockito.Mockito.mock, you could simplify this to just mock(Application::class.java).

Suggested change
return org.mockito.Mockito.mock(Application::class.java)
return Mockito.mock(Application::class.java)

@github-actions
Copy link
Copy Markdown
Contributor

✅ No public API changes

@sonarqubecloud
Copy link
Copy Markdown

Base automatically changed from chore/google-pay-component-state-ext to main February 25, 2026 13:56
@OscarSpruit OscarSpruit self-assigned this Mar 2, 2026
@araratthehero araratthehero marked this pull request as draft March 20, 2026 10:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Chore [PRs only] Indicates any task that does not need to be mentioned in the public release notes size:tiny

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants