-
Notifications
You must be signed in to change notification settings - Fork 9.4k
[GraphQl][GiftMessage] Add functionality for getting message for order item #29417
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
[GraphQl][GiftMessage] Add functionality for getting message for order item #29417
Conversation
Hi @Usik2203. Thank you for your contribution
❗ Automated tests can be triggered manually with an appropriate comment:
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. 🕙 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 |
@magento create issue |
b9fdd29
to
d373aeb
Compare
@magento run all tests |
@magento run all tests |
@@ -58,9 +58,11 @@ public function resolve( | |||
if (!isset($value['id'])) { | |||
throw new GraphQlInputException(__('"id" value should be specified')); | |||
} | |||
// phpcs:ignore Magento2.Functions.DiscouragedFunction | |||
$orderId = (int)base64_decode($value['id']) ?: (int)$value['id']; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i think that we must be more careful with values provided from FE.
<?php
declare(strict_types=1);
echo "\nit's wrong (string)`1 hi all!` !== (int)`1`\n";
$a = base64_encode('1 hi all!');
var_dump((int)base64_decode($a));
echo "\nit's wrong (string)`1 hi all!` !== (int)`1`\n";
var_dump((int) '1 hi all!');
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @rvitaliy
I am sorry but I am not sure that i understand your remark.
Yes, I understood problem which you provided in example but i can't get how it is related with this case in the code.
Perhaps you could explain your point ?
Thanks
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
he means if we trust that $value['id'] is a trusted value
and he explained a way to exploit such a value and how it can be misleading using base64_decode
if you wouldn't add this empty line we would of not seen this :)
we actually have a safer way to do this \Magento\Framework\GraphQl\Query\Uid::decode
you can use it if you want, but it's not really the purpose of this PR
return null; | ||
} | ||
|
||
if (!$this->giftMessageHelper->isMessagesAllowed('item', $orderItem)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just want to double-check we really need this part. If we calling isMessageAllowed
with type = "items", the second invocation (with type = "item") will be performed eventually. See the following implementation
if ($this->isMessagesAllowed($_type, $item, $store)) { |
Please, correct me if I'm wrong
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @rogyar
isMessageAllowed with type = "item"
need for checking isMessageAllowed on product level because we can have situation where GiftMessages are enable in configs but disable for some products
Thanks
Hi @sidolov, thank you for the review. |
Hi @Usik2203 Is there any chance you could take a look and resolve the merge conflict with the leatest Thank you |
@magento run all tests |
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. |
@magento run Functional Tests B2B, Functional Tests EE, Integration Tests, Static Tests, Unit Tests , WebAPI Tests |
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. |
@magento run all tests |
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. |
@magento run Functional Tests B2B, Functional Tests EE, Integration Tests, Static Tests |
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. |
@magento run all tests |
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. |
Hi @ishakhsuvarov, I have resolved the merge conflicts. Also fixed all the build failures. The functional b2b failures are not part of this PR, or not even failing because of this PR's changes. Hence moving this PR to Merge in Progress now. Thank you! |
@magento run Functional Tests B2B, Unit Tests |
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. |
[GraphQl][GiftMessage] Add functionality for getting message for order item #29417
Description (*)
Now we use

customerOrders
query for getting GiftMessage of orderBut this query is DEPRECATED
@deprecated(reason: "Use orders from customer instead")
1.
Using correct query we are getting issue

2.
*Using this query we can't get GiftMessage of order items
Actual result
This PR fixes first issue and add functionality to get GiftMessage for Order Items

Fixed Issues (if relevant)
Manual testing scenarios (*)
Questions or comments
Contribution checklist (*)
Resolved issues: