-
Notifications
You must be signed in to change notification settings - Fork 248
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
Add ready for pickup button on the order page in admin panel which notifies customer that order could be picked up 2034 #2127
Add ready for pickup button on the order page in admin panel which notifies customer that order could be picked up 2034 #2127
Conversation
…notifies Customer that Order could be picked up #2034. Added the button itself
…notifies Customer that Order could be picked up #2034. Added check if order is ready for pickup
…notifies Customer that Order could be picked up #2034. Moved IsOrderReadyForPickup to API level. Created an init point for NotifyPickup controller.
…notifies Customer that Order could be picked up #2034. NotifyOrderIsReadyAndShipInterface API; Implemented NotifyPickup controller; Added some TODOs
…notifies Customer that Order could be picked up #2034. Added canShip() check to IsOrderReadyForPickup; Added TODO
…notifies Customer that Order could be picked up #2034. Implemented synchronous email sending with custom email template for storepickup. Added even more TODOs
…notifies Customer that Order could be picked up #2034. Do not show button is order is not placed using storepickup or it can not be shipped
app/code/Magento/InventoryInStorePickup/Model/NotifyOrderIsReadyAndShip.php
Outdated
Show resolved
Hide resolved
app/code/Magento/InventoryInStorePickup/Model/Order/IsFulfilled.php
Outdated
Show resolved
Hide resolved
app/code/Magento/InventoryInStorePickup/Model/Order/Email/ReadyForPickupNotifier.php
Show resolved
Hide resolved
app/code/Magento/InventoryInStorePickup/Model/NotifyOrderIsReadyAndShip.php
Outdated
Show resolved
Hide resolved
app/code/Magento/InventoryInStorePickup/Model/IsOrderReadyForPickup.php
Outdated
Show resolved
Hide resolved
app/code/Magento/InventoryInStorePickup/Model/IsOrderReadyForPickup.php
Outdated
Show resolved
Hide resolved
app/code/Magento/InventoryInStorePickup/Model/IsOrderReadyForPickup.php
Outdated
Show resolved
Hide resolved
app/code/Magento/InventoryInStorePickup/Model/Order/IsFulfilled.php
Outdated
Show resolved
Hide resolved
app/code/Magento/InventoryInStorePickup/Model/Order/Email/ReadyForPickupSender.php
Outdated
Show resolved
Hide resolved
app/code/Magento/InventoryInStorePickup/Model/Order/Email/ReadyForPickupSender.php
Outdated
Show resolved
Hide resolved
app/code/Magento/InventoryInStorePickup/Model/Order/Email/Container/ReadyForPickupIdentity.php
Outdated
Show resolved
Hide resolved
app/code/Magento/InventoryInStorePickup/Model/Order/IsFulfilled.php
Outdated
Show resolved
Hide resolved
app/code/Magento/InventoryInStorePickup/Model/Order/IsFulfilled.php
Outdated
Show resolved
Hide resolved
app/code/Magento/InventoryInStorePickupAdminUi/Controller/Adminhtml/Order/NotifyPickup.php
Show resolved
Hide resolved
app/code/Magento/InventoryInStorePickupAdminUi/Controller/Adminhtml/Order/NotifyPickup.php
Outdated
Show resolved
Hide resolved
|
||
namespace Magento\InventoryInStorePickupAdminUi\Model; | ||
|
||
class IsDisplayReadyForPickupButton |
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.
Display?
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.
Display. May replace by Render
app/code/Magento/InventoryInStorePickupApi/Api/NotifyOrderIsReadyAndShipInterface.php
Outdated
Show resolved
Hide resolved
All the points seem to be fixed. I suggest to implement asynchronous email and tests coverage in separate Issues/PRs. |
@novikor I agree with implementing those items separately. This PR is already growing out of control |
use Magento\Sales\Api\OrderRepositoryInterface; | ||
use Magento\Sales\Model\Order; | ||
|
||
class IsOrderReadyForPickup implements IsOrderReadyForPickupInterface |
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.
Please indicate clear purpose of each class in docblock.
While class name looks like it speaks for itself, as a someone who is new to Store Pickup I wouldn't know the conditions for that.
PS: This applies to every class, interface and method hereafter
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.
Done for all the classes and most of the methods (except execute
).
private $orderRepository; | ||
|
||
/** | ||
* NotifyOrderIsReadyAndShip constructor. |
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.
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.
Eliminated.
/** @noinspection PhpParamsInspection */ | ||
$this->emailNotifier->notify($this->orderRepository->get($orderId)); | ||
|
||
/* TODO: add order comment? */ |
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.
Yes, good idea. I think it was discussed on one of the meetings
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`ll create an issue
throw new OrderIsNotReadyForPickupException(); | ||
} | ||
|
||
/** @noinspection PhpParamsInspection */ |
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.
🤣
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.
Of course, I could use instanceof
to do not send the email or throw an exception instead of a fatal error.
But anyway more likely I will kill the notifier class in the nearest future, so it is OK
} | ||
|
||
/** | ||
* {@inheritdoc} |
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.
Curly braces aren't needed here.
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.
Eliminated.
public function execute(OrderInterface $order): bool | ||
{ | ||
if ($order->getExtensionAttributes() | ||
&& $sourceCode = $order->getExtensionAttributes()->getPickupLocationCode() |
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.
Is it only me or assignments inside conditional statements are not that good for readability?
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.
Well, I really like doing that and like to save the code lines and avoid the code duplicating.
However, I`ve created a poll and realized that nobody likes that.
So, - fixed.
private $eventManager; | ||
|
||
/** | ||
* ReadyForPickupSender constructor. |
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.
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.
Eliminated.
private $isDisplayButton; | ||
|
||
/** | ||
* ReadyForPickup constructor. |
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.
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.
Eliminated.
private $logger; | ||
|
||
/** | ||
* NotifyPickup constructor. |
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.
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.
Eliminated.
…tifies customer that order could be picked up 2034. Simplified Fully Qualified names
154ccff
to
80d20e9
Compare
…tifies customer that order could be picked up 2034. CanBeFulfilled -> IsFulfillable
…tifies customer that order could be picked up 2034. Killed OrderIsNotReadyForPickupException
…tifies customer that order could be picked up 2034. Just another PHPDocs improvement
…tifies customer that order could be picked up 2034. Stopped declaring variables inside if condition
…rder-page-in-Admin-Panel-which-notifies-Customer-that-Order-could-be-picked-up-2034
@@ -25,4 +25,14 @@ | |||
</argument> | |||
</arguments> | |||
</type> | |||
|
|||
<preference for="\Magento\InventoryInStorePickupApi\Api\NotifyOrderIsReadyForPickupInterface" |
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.
Please avoid leading slashes in di configuration
* | ||
* @package Magento\InventoryInStorePickupAdminUi\Controller\Adminhtml\Order | ||
*/ | ||
class NotifyPickup extends Action |
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.
Name is slightly misleading. It's notify and ship in reality
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.
- Minor coding style improvements
- Static testing results applied
Hi @novikor, thank you for your contribution! |
- Minor coding style improvements
- Static testing results applied
Description (*)
New API:
Added 'Notify Order is Ready for Pickup' button;
Notify customer using custom email template
Ship the order after the notification to reserve QTY
Fixed Issues (if relevant)
Manual testing scenarios (*)
Life is too short for that
Contribution checklist (*)