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

Order add comment functionality in REST API #2315

Merged
merged 2 commits into from
Jul 13, 2022

Conversation

elidrissidev
Copy link
Member

@elidrissidev elidrissidev commented Jul 13, 2022

Description (*)

This is the first out of many coming PRs where I will be adding some missing endpoints to the REST Api, this one will add the functionality for adding and retrieving order comments as an authenticated Admin user, as well as the ACL permissions.

I chose to target the 20.0 branch with these new features, but It's subject to change if there's demand. For people interested that can't use v20 yet, I made an extension where I'll be porting the same changes for use with v19 (we'll be using it in production in the next few weeks).

Manual testing scenarios (*)

After applying this patch, you should be able to perform the following actions as Admin user:

  • Retrieve a single comment: GET /api/rest/orders/comments/<comment_id>
  • Add comment to an order (although all the fields in the body are optional, you can't omit all of them):
POST /api/rest/orders/<order_id>/comments HTTP/1.1
Host: <magento_host>
Accept: application/json
Content-Type: application/json
Authorization: ...

{
    "status": "pending", // defaults to false (current order status)
    "comment": "Test adding comment from REST API", // optional, defaults to an empty string
    "is_customer_notified": 0, // defaults to false (use null for non-applicable notification)
    "is_visible_on_front": 0 // defaults to 0
}

Questions or comments

Testing is encouraged for people using OAuth as I didn't test with it.

Contribution checklist (*)

  • Pull request has a meaningful description of its purpose
  • All commits are accompanied by meaningful commit messages
  • All automated tests passed successfully (all builds are green)
  • Add yourself to contributors list

@github-actions github-actions bot added the Component: Sales Relates to Mage_Sales label Jul 13, 2022
@fballiano fballiano merged commit 1837f74 into OpenMage:20.0 Jul 13, 2022
@github-actions
Copy link
Contributor

Unit Test Results

0 files  ±0  0 suites  ±0   0s ⏱️ ±0s
0 tests ±0  0 ✔️ ±0  0 💤 ±0  0 ❌ ±0 

Results for commit 1837f74. ± Comparison against base commit b2e2960.

@elidrissidev elidrissidev deleted the feat/rest-order-add-comment branch July 14, 2022 08:38
@sreichel sreichel mentioned this pull request Nov 19, 2022
4 tasks
sreichel added a commit that referenced this pull request Nov 24, 2022
* Added order comment functionality to REST API (#2315)

* CS Fixes

* Updated phpstan-baseline.neon

Co-authored-by: Mohamed ELIDRISSI <67818913+elidrissidev@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component: Sales Relates to Mage_Sales new feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants