magento / magento2

Prior to making any Submission(s), you must sign an Adobe Contributor License Agreement, available here at: https://opensource.adobe.com/cla.html. All Submissions you make to Adobe Inc. and its affiliates, assigns and subsidiaries (collectively “Adobe”) are subject to the terms of the Adobe Contributor License Agreement.
http://www.magento.com
Open Software License 3.0
11.48k stars 9.29k forks source link

[Issue] Added the possibility of using the Contact module's functionality in headless applications #36830

Open m2-assistant[bot] opened 1 year ago

m2-assistant[bot] commented 1 year ago

This issue is automatically created based on existing pull request: magento/magento2#33801: Added the possibility of using the Contact module's functionality in headless applications


Description (*)

As a developer working on backends meant to be used in headless apps like PWA storefronts I would like to be able to utilize the Magento_Contact (the contact form) functionality using GraphQL. Currently it's not possible because there's no Magento_ContactGraphQl module that would allow that.

Related Pull Requests

Fixed Issues (if relevant)

Manual testing scenarios (*)

  1. As a precondition, configure the Contact feature, go to /contact/index/ on the regular magento storefront and send the form - you should receive an email. This is not part of this PR, but we'll be doing the same thing via a GraphQL mutation
  2. Run the following mutation:
    mutation {
    submitContactForm(
        input: {
            name: "John Doe",
            email: "johndoe@example.com",
            telephone: "123123123",
            comment: "I like donuts."
        }
    ) {
        success
    }
    }
  3. Test if you received an email and that the response returns true for the success.

Questions or comments

As side effects of adding this GraphQL functionality, I did the following things:

  1. Improved the re-usability of the email sending feature by moving the validation from the action class to a separate class and the quality of the Post action mostly by adding some return hints and removing the check if it's a POST request, which is obsolete now that the class implements the HttpPostActionInterface
  2. The dev/tests/integration/testsuite/Magento/Contact/Controller/IndexTest.php test covers all my refactoring in the Magento_Contact module, so I believe that no additional Integration tests are necessary. So I added only API Functional tests to cover the GraphQL part.

Contribution checklist (*)

github-jira-sync-bot commented 1 year ago

:white_check_mark: Jira issue https://jira.corp.adobe.com/browse/AC-7916 is successfully created for this GitHub issue.

m2-assistant[bot] commented 1 year ago

:white_check_mark: Confirmed by @engcom-Alfa. Thank you for verifying the issue.
Issue Available: @engcom-Alfa, You will be automatically unassigned. Contributors/Maintainers can claim this issue to continue. To reclaim and continue work, reassign the ticket to yourself.