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

Fixed customerOrders GraphQL queries containing sub-resolvers requiring 'model' #33805

Open
wants to merge 3 commits into
base: 2.4-develop
Choose a base branch
from

Conversation

bgorski
Copy link
Contributor

@bgorski bgorski commented Aug 16, 2021

Description (*)

This PR fixes the customerOrders GraphQL query containing arguments that require $value['model'] to be filled with the order object. Although the query itself is deprecated already and the data can be retrieved by a customer query (which works well) with appropriate arguments, I think that we should support customerOrders for as long as it's not removed from the codebase.

Related Pull Requests

Fixed Issues (if relevant)

Manual testing scenarios (*)

  1. Register a customer and place an order in the admin panel for that customer
  2. Generate an invoice for that order
  3. Use the following GraphQL mutation to generate the customer token:
mutation {
  generateCustomerToken(
    email: "your.customer@email.here"
    password: "your-password"
  ) {
    token
  }
}
  1. Use the token from from the previous mutation to authorize the following query:
query {
  customerOrders {
    items {
      order_number
      grand_total
      status
      invoices {
          id
          items {
              id
              discounts {
                  amount {
                    value
                  }
              }
          }
      }
    }
  }
}

This will trigger the faulty behavior.

Questions or comments

Contribution checklist (*)

  • Pull request has a meaningful description of its purpose
  • All commits are accompanied by meaningful commit messages
  • All new or changed code is covered with unit/integration tests (if applicable)
  • README.md files for modified modules are updated and included in the pull request if any README.md predefined sections require an update
  • All automated tests passed successfully (all builds are green)

Resolved issues:

  1. resolves [Issue] Fixed customerOrders GraphQL queries containing sub-resolvers requiring 'model' #36829: Fixed customerOrders GraphQL queries containing sub-resolvers requiring 'model'

@m2-assistant
Copy link

m2-assistant bot commented Aug 16, 2021

Hi @bgorski. Thank you for your contribution
Here are some useful tips how you can test your changes using Magento test environment.
Add the comment under your pull request to deploy test or vanilla Magento instance:

  • @magento give me test instance - deploy test instance based on PR changes
  • @magento give me 2.4-develop instance - deploy vanilla Magento instance

❗ Automated tests can be triggered manually with an appropriate comment:

  • @magento run all tests - run or re-run all required tests against the PR changes
  • @magento run <test-build(s)> - run or re-run specific test build(s)
    For example: @magento run Unit Tests

<test-build(s)> is a comma-separated list of build names. Allowed build names are:

  1. Database Compare
  2. Functional Tests CE
  3. Functional Tests EE,
  4. Functional Tests B2B
  5. Integration Tests
  6. Magento Health Index
  7. Sample Data Tests CE
  8. Sample Data Tests EE
  9. Sample Data Tests B2B
  10. Static Tests
  11. Unit Tests
  12. WebAPI Tests
  13. Semantic Version Checker

You can find more information about the builds here

ℹ️ Please run only needed test builds instead of all when developing. Please run all test builds before sending your PR for review.

For more details, please, review the Magento Contributor Guide documentation.

⚠️ According to the Magento Contribution requirements, all Pull Requests must go through the Community Contributions Triage process. Community Contributions Triage is a public meeting.

🕙 You can find the schedule on the Magento Community Calendar page.

📞 The triage of Pull Requests happens in the queue order. If you want to speed up the delivery of your contribution, please join the Community Contributions Triage session to discuss the appropriate ticket.

🎥 You can find the recording of the previous Community Contributions Triage on the Magento Youtube Channel

✏️ Feel free to post questions/proposals/feedback related to the Community Contributions Triage process to the corresponding Slack Channel

@bgorski
Copy link
Contributor Author

bgorski commented Aug 16, 2021

@magento run all tests

@magento-automated-testing
Copy link

The requested builds are added to the queue. You should be able to see them here within a few minutes. Please re-request them if they don't show in a reasonable amount of time.

@bgorski
Copy link
Contributor Author

bgorski commented Aug 16, 2021

@magento run Functional Tests B2B, Functional Tests EE , Functional Tests CE, WebAPI Tests

@magento-automated-testing
Copy link

The requested builds are added to the queue. You should be able to see them here within a few minutes. Please re-request them if they don't show in a reasonable amount of time.

@bgorski
Copy link
Contributor Author

bgorski commented Aug 16, 2021

@magento run Functional Tests B2B, Functional Tests EE, Functional Tests CE

@magento-automated-testing
Copy link

The requested builds are added to the queue. You should be able to see them here within a few minutes. Please re-request them if they don't show in a reasonable amount of time.

@bgorski bgorski changed the title Fixed the customerOrders queries containing sub-resolvers requiring 'model' Fixed customerOrders GraphQL queries containing sub-resolvers requiring 'model' Aug 17, 2021
@bgorski
Copy link
Contributor Author

bgorski commented Aug 17, 2021

@magento run Functional Tests B2B, Functional Tests EE, Functional Tests CE

@magento-automated-testing
Copy link

The requested builds are added to the queue. You should be able to see them here within a few minutes. Please re-request them if they don't show in a reasonable amount of time.

@bgorski
Copy link
Contributor Author

bgorski commented Aug 18, 2021

@magento run Functional Tests EE

@magento-automated-testing
Copy link

The requested builds are added to the queue. You should be able to see them here within a few minutes. Please re-request them if they don't show in a reasonable amount of time.

@sdzhepa
Copy link
Contributor

sdzhepa commented Nov 4, 2021

Hello @bgorski

Could you please provide more details on the scenario and problem?
e.g. Actual and expected results

It is not clear

This will trigger the faulty behavior.

Thank you in advance!

@sidolov
Copy link
Contributor

sidolov commented Nov 18, 2021

@bgorski do you have any updates? Thanks!

@sdzhepa
Copy link
Contributor

sdzhepa commented Dec 2, 2021

Closed due to no activities and no response on #33805 (comment) #33805 (comment)

@bgorski
Copy link
Contributor Author

bgorski commented Dec 3, 2021

@sdzhepa sorry, missed your comment. The scenario involves using the customerOrders query to get (among any other data you might want to get) invoices with invoice items. That will make the system use the Magento\SalesGraphQl\Model\Resolver\Invoice\InvoiceItems resolver class, which contains a language-level error. The base64_encode($invoiceItem->getEntityId()) function that will then get triggered in the getInvoiceItemData method expects to get string and it's provided with an int (an actual int, not just a string containing a number). Because strict types are declared in the InvoiceItems class, this will result in a TypeError. That's the faulty behavior mentioned in my initial report.

@bgorski bgorski reopened this Dec 3, 2021
@bgorski
Copy link
Contributor Author

bgorski commented Dec 7, 2021

@magento run all tests

@magento-automated-testing
Copy link

The requested builds are added to the queue. You should be able to see them here within a few minutes. Please re-request them if they don't show in a reasonable amount of time.

@sidolov sidolov added the Priority: P1 Once P0 defects have been fixed, a defect having this priority is the next candidate for fixing. label Dec 9, 2021
@bgorski
Copy link
Contributor Author

bgorski commented Dec 28, 2021

@magento run WebAPI Tests, Functional Tests CE

@magento-automated-testing
Copy link

The requested builds are added to the queue. You should be able to see them here within a few minutes. Please re-request them if they don't show in a reasonable amount of time.

@bgorski
Copy link
Contributor Author

bgorski commented Dec 28, 2021

@magento run WebAPI Tests, Functional Tests CE

@magento-automated-testing
Copy link

The requested builds are added to the queue. You should be able to see them here within a few minutes. Please re-request them if they don't show in a reasonable amount of time.

@ishakhsuvarov ishakhsuvarov added this to Pending Review in Pull Requests Dashboard Dec 8, 2022
@chernenm chernenm self-assigned this Jan 12, 2023
@m2-community-project m2-community-project bot moved this from Pending Review to Review in Progress in Pull Requests Dashboard Jan 12, 2023
@engcom-Alfa
Copy link
Contributor

@magento create issue

@engcom-Alfa
Copy link
Contributor

hey @bgorski

Thanks for reporting this ticket,

request you to please help us share some more information about the ticket regarding the actual and expected result before we retest it. hence marking it as need update.

@chernenm chernenm removed their assignment Apr 18, 2023
@m2-community-project m2-community-project bot moved this from Review in Progress to Pending Review in Pull Requests Dashboard Apr 18, 2023
@engcom-Hotel
Copy link
Contributor

@magento run all tests

@magento-automated-testing
Copy link

The requested builds are added to the queue. You should be able to see them here within a few minutes. Please re-request them if they don't show in a reasonable amount of time.

@engcom-Hotel engcom-Hotel self-requested a review April 19, 2023 10:28
@engcom-Hotel engcom-Hotel moved this from Pending Review to Review in Progress in Pull Requests Dashboard Apr 19, 2023
@bgorski
Copy link
Contributor Author

bgorski commented May 26, 2023

@magento run Functional Tests EE

@magento-automated-testing
Copy link

The requested builds are added to the queue. You should be able to see them here within a few minutes. Please message the #magento-devops slack channel if they don't show in a reasonable amount of time and a representative will look into any issues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component: SalesGraphQl Partner: MRM Commerce partners-contribution Pull Request is created by Magento Partner Priority: P1 Once P0 defects have been fixed, a defect having this priority is the next candidate for fixing. Progress: review Project: GraphQL Release Line: 2.4
Projects
Pull Requests Dashboard
  
Review in Progress
Development

Successfully merging this pull request may close these issues.

[Issue] Fixed customerOrders GraphQL queries containing sub-resolvers requiring 'model'
7 participants