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

customMethods[store.selectedMethod]() can never be invoked due to empty customMethods object #1191

Open
s4ty opened this issue Oct 16, 2024 · 1 comment

Comments

@s4ty
Copy link

s4ty commented Oct 16, 2024

Describe the bug
In the src/cartridges/app_adyen_SFRA/cartridge/client/default/js/adyen_checkout/validateComponents.js -> validateComponents function, there is a check to see if store.selectedMethod exists in the customMethods object:

if (store.selectedMethod in customMethods) {
  customMethods[store.selectedMethod]();
}

However, the customMethods object is always initialized as an empty object:
const customMethods = {};
Since no methods are added to the customMethods object before this check, the condition store.selectedMethod in customMethods will always evaluate to false. This means that customMethods[store.selectedMethod]() can never be invoked under the current implementation.

Steps to Reproduce

  1. Inspect the code within the validateComponents function.
  2. Notice that the customMethods object is initialized as an empty object.
  3. See that there is no code that adds methods to customMethods before the conditional check.

Expected Behavior
If store.selectedMethod is expected to invoke a method, relevant functions should be added to the customMethods object, or the code should be modified to handle the case where customMethods is empty.

@zenit2001
Copy link
Contributor

Hi @s4ty ,

Thank you for raising this issue. I have created an investigation ticket about this issue and the other one you raised for displayValidationErrors().
Once we've completed the investigation, you will be informed.

Kind regards,
Zenit
Adyen

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

No branches or pull requests

2 participants