Skip to content

Conversation

Robert-SD
Copy link
Collaborator

No description provided.

@@ -0,0 +1,7 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="main_netlify.dart" type="FlutterRunConfigurationType" factoryName="Flutter" nameIsGenerated="true">
<option name="additionalArgs" value="--dart-define=&quot;CLIENT_KEY=test_O3LEH54C3JDPREE3QOEPOCRG4QGEICBQ&quot; --dart-define=&quot;APPLE_PAY_MERCHANT_ID_KEY=demo&quot;" />
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The client key is already public on the MyStoreDemo.

Copy link
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.

Summary of Changes

Hello @Robert-SD, 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 a new Netlify environment setup alongside the existing example setup. It involves refactoring the main entry point to allow for different service implementations, creating separate entry points for each environment, and implementing a new service for Netlify. The changes also include updating project configurations and removing unnecessary fields from the session request body.

Highlights

  • Project Configuration: Added a new run configuration for main_netlify.dart and updated the existing main_example.dart configuration to reflect the file rename.
  • Entry Point Refactor: Refactored the main function in main_common.dart to mainCommon to allow different entry points for different environments (example and netlify).
  • New Entry Points: Created new entry point files main_example.dart and main_netlify.dart to use different service implementations.
  • Service Implementations: Introduced CheckoutService and NetlifyService to handle API calls for different environments.
  • Service Interface: Refactored Service from a class to an abstract interface to allow for different implementations.
  • Session Request Body: Removed unnecessary fields from the session request body in AdyenDropInRepository.
  • Widget Test: Updated widget test to import main_common.dart instead of main.dart.
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 in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.

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 issue 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 is currently in preview and 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 to provide feedback.

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.

Copy link

LCOV of commit 84080ec during Check PR #1259

Summary coverage rate:
  lines......: 8.5% (136 of 1602 lines)
  functions..: no data found
  branches...: no data found

Files changed coverage rate: n/a

Copy link
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 introduces support for a Netlify-based backend by refactoring the Service layer into an interface and providing two implementations (CheckoutService for the existing logic and NetlifyService for the new backend). It also updates main entry points and run configurations accordingly.

Key feedback points include a critical security issue with hardcoded API keys in a new run configuration, the need to implement several core methods in NetlifyService, considerations for a hardcoded base URL in NetlifyService, and a request for clarification on significant changes to the session request body. A minor point involves suggesting the use of a proper logger instead of print statements for better practice, even in an example application.

Comment on lines 23 to 24
// TODO: implement deleteStoredPaymentMethod
throw UnimplementedError();
Copy link
Contributor

Choose a reason for hiding this comment

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

high

The method deleteStoredPaymentMethod (and several other methods in this NetlifyService class such as fetchPaymentMethods, postPayments, etc.) are currently stubbed out with // TODO: implement ... and throw an UnimplementedError.

While this is acceptable for work-in-progress, these methods represent core functionalities of the Service interface. For the NetlifyService to be fully functional and usable as an alternative backend, these methods will need to be implemented. Please ensure there's a plan or tracking issues to address these unimplemented parts.

Comment on lines 7 to 13
final baseUrl = "https://www.mystoredemo.io";

@override
Future<Map<String, dynamic>> createSession(Map<String, dynamic> body) async {
final http.Response response = await http.post(
Uri.parse('$baseUrl/.netlify/functions/sessions'),
body: jsonEncode(body),
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

The baseUrl is currently hardcoded. If this URL might change (e.g., for different deployment environments like development, staging, or production, or if the service endpoint itself changes), it would be more maintainable and flexible to make this configurable.

Consider moving it to a central configuration file (like config.dart, similar to Config.baseUrl) or sourcing it from environment variables. The suggestion below makes it a static const for now, which is slightly better if it's truly fixed for this service, but external configuration is generally preferred for URLs.

  // Consider moving this to a central configuration if it can vary by environment.
  // For now, making it a private static const if it's fixed for this service.
  static const String _baseUrl = "https://www.mystoredemo.io";

  @override
  Future<Map<String, dynamic>> createSession(Map<String, dynamic> body) async {
    final http.Response response = await http.post(
      Uri.parse('$_baseUrl/.netlify/functions/sessions'), // Use the static const
      body: jsonEncode(body),
    );

Copy link

LCOV of commit 4c568c4 during Check PR #1260

Summary coverage rate:
  lines......: 8.5% (136 of 1602 lines)
  functions..: no data found
  branches...: no data found

Files changed coverage rate: n/a

Copy link

github-actions bot commented Jul 2, 2025

LCOV of commit 2dd02c3 during Check PR #1268

Summary coverage rate:
  lines......: 8.5% (136 of 1602 lines)
  functions..: no data found
  branches...: no data found

Files changed coverage rate: n/a

@Robert-SD Robert-SD changed the title Feature/add netlify [WIP] Feature/add netlify Jul 23, 2025
Copy link

github-actions bot commented Sep 5, 2025

LCOV of commit 06600b1 during Check PR #1388

Summary coverage rate:
  lines......: 8.5% (136 of 1607 lines)
  functions..: no data found
  branches...: no data found

Files changed coverage rate: n/a

Copy link

LCOV of commit c11e2bb during Check PR #1396

Summary coverage rate:
  lines......: 8.5% (136 of 1603 lines)
  functions..: no data found
  branches...: no data found

Files changed coverage rate: n/a

Copy link

sonarqubecloud bot commented Oct 7, 2025

@Robert-SD
Copy link
Collaborator Author

/gemini review

Copy link
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 refactors the example app to support multiple backend services by introducing a Service interface, with implementations for the existing backend and a new Netlify-based one. It also adds the ability to configure the app via launch arguments, which is a great improvement for testing and flexibility. The changes are well-structured, but I've identified a few issues that need attention. A test API key is hardcoded in a run configuration, which is a security concern. There are also some leftover debug print statements that should be removed. Finally, as this is a work-in-progress, several methods in the new NetlifyService are unimplemented and will need to be completed.

@@ -0,0 +1,7 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="main_netlify.dart" type="FlutterRunConfigurationType" factoryName="Flutter" nameIsGenerated="true">
<option name="additionalArgs" value="--dart-define=&quot;CLIENT_KEY=test_O3LEH54C3JDPREE3QOEPOCRG4QGEICBQ&quot; --dart-define=&quot;APPLE_PAY_MERCHANT_ID_KEY=demo&quot;" />
Copy link
Contributor

Choose a reason for hiding this comment

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

high

Committing secrets to the repository, even if they are test keys, is a security risk. The hardcoded CLIENT_KEY should be removed from this run configuration. Please consider using a method that doesn't involve checking keys into version control, such as environment variables or a local configuration file that is ignored by git.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This is intended. It is our public client key from mystoredemo.io.

Comment on lines +141 to +147
Future.microtask(() async {
final String config =
await FlutterLaunchArguments().getString("config") ??
"FAILED TO FETCH CONFIG";
print("**** CONFIG FETCHED ****");
print(config);
});
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

This block appears to be for debugging purposes. It should be removed before merging the pull request. For logging during development, it's better to use debugPrint() instead of print() as it helps prevent log truncation on Android.

headers: _createHeaders(),
body: jsonEncode(body),
);
print("PspReference: ${response.headers["pspreference"]}");
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

This print statement seems to be for debugging. It should be removed before this pull request is merged. For development logging, consider using debugPrint().

Comment on lines +56 to +60
Future<bool> deleteStoredPaymentMethod(
String storedPaymentMethodId, Map<String, dynamic> queryParameters) {
// TODO: implement deleteStoredPaymentMethod
throw UnimplementedError();
}
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

This method is currently unimplemented. While this is expected for a work-in-progress pull request, please ensure this and other methods throwing UnimplementedError in this file are fully implemented before the final merge.

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.

1 participant