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

selectedMethod in displayValidationErrors() references a non-existent node attribute #1185

Open
s4ty opened this issue Oct 11, 2024 · 0 comments

Comments

@s4ty
Copy link

s4ty commented Oct 11, 2024

In the file adyen-salesforce-commerce-cloud/src/cartridges/app_adyen_SFRA/cartridge/client/default/js/adyen_checkout/helpers.js, the function displayValidationErrors() uses the following logic:

function displayValidationErrors() {
  if (store.selectedMethod?.node) {
    store.selectedPayment.node.showValidation();
  }
  return false;
}

However, according to the store's implementation in adyen-salesforce-commerce-cloud/src/cartridges/app_adyen_SFRA/cartridge/store/index.js, the selectedMethod object does not contain a node attribute. The relevant part of the store's definition is:

class Store {
  @observable selectedMethod;

  @computed get selectedPayment() {
    return this.componentsObj[this.selectedMethod];
  }
}

Expected Behavior
The function displayValidationErrors() should correctly reference the appropriate attribute for the validation process. It seems that there is a misunderstanding of how selectedMethod and selectedPayment are structured, and it needs to be corrected to avoid referencing a non-existent node.

Additional Information
The issue is present in:
adyen-salesforce-commerce-cloud/src/cartridges/app_adyen_SFRA/cartridge/client/default/js/adyen_checkout/helpers.js
adyen-salesforce-commerce-cloud/src/cartridges/app_adyen_SFRA/cartridge/store/index.js

maybe other files are also affected

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

1 participant