-
Notifications
You must be signed in to change notification settings - Fork 247
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add "Ready for Pickup" button on the Order page in Admin Panel which …
…notifies Customer that Order could be picked up #2034. Moved IsOrderReadyForPickup to API level. Created an init point for NotifyPickup controller.
- Loading branch information
Showing
7 changed files
with
136 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
<?php | ||
/** | ||
* Copyright © Magento, Inc. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
declare(strict_types=1); | ||
|
||
namespace Magento\InventoryInStorePickup\Model; | ||
|
||
use Magento\InventoryInStorePickup\Model\Order\IsFulfilled; | ||
use Magento\InventoryInStorePickupApi\Api\IsOrderReadyForPickupInterface; | ||
|
||
class IsOrderReadyForPickup implements IsOrderReadyForPickupInterface | ||
{ | ||
/** | ||
* @var \Magento\InventoryInStorePickup\Model\Order\IsFulfilled | ||
*/ | ||
private $isFulfilled; | ||
|
||
/** | ||
* IsReadyForPickup constructor. | ||
* | ||
* @param \Magento\InventoryInStorePickup\Model\Order\IsFulfilled $isFulfilled | ||
*/ | ||
public function __construct( | ||
IsFulfilled $isFulfilled | ||
) { | ||
$this->isFulfilled = $isFulfilled; | ||
} | ||
|
||
/** | ||
* @param int $orderId | ||
* | ||
* @return bool | ||
*/ | ||
public function execute(int $orderId):bool | ||
{ | ||
return $this->isFulfilled->execute($orderId); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
49 changes: 49 additions & 0 deletions
49
InventoryInStorePickupAdminUi/Controller/Adminhtml/Order/NotifyPickup.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
<?php | ||
/** | ||
* Copyright © Magento, Inc. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
declare(strict_types=1); | ||
|
||
namespace Magento\InventoryInStorePickupAdminUi\Controller\Adminhtml\Order; | ||
|
||
class NotifyPickup extends \Magento\Sales\Controller\Adminhtml\Order | ||
{ | ||
/** | ||
* Authorization level of a basic admin session | ||
* | ||
* @see _isAllowed() | ||
*/ | ||
const ADMIN_RESOURCE = 'Magento_Sales::emails'; | ||
|
||
/** | ||
* Notify user | ||
* | ||
* @return \Magento\Framework\Controller\ResultInterface | ||
*/ | ||
public function execute():\Magento\Framework\Controller\ResultInterface | ||
{ | ||
/*TODO*/ | ||
/*$order = $this->_initOrder(); | ||
if ($order) { | ||
try { | ||
$this->orderManagement->notify($order->getEntityId()); | ||
$this->messageManager->addSuccessMessage(__('You sent the order email.')); | ||
} catch (\Magento\Framework\Exception\LocalizedException $e) { | ||
$this->messageManager->addErrorMessage($e->getMessage()); | ||
} catch (\Exception $e) { | ||
$this->messageManager->addErrorMessage(__('We can\'t send the email order right now.')); | ||
$this->logger->critical($e); | ||
} | ||
return $this->resultRedirectFactory->create()->setPath( | ||
'sales/order/view', | ||
[ | ||
'order_id' => $order->getEntityId() | ||
] | ||
); | ||
}*/ | ||
|
||
return $this->resultRedirectFactory->create()->setPath('sales/*/'); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<?xml version="1.0"?> | ||
<!-- | ||
/** | ||
* Copyright © Magento, Inc. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
--> | ||
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:App/etc/routes.xsd"> | ||
<router id="admin"> | ||
<route id="sales" frontName="sales"> | ||
<module name="Magento_InventoryInStorePickupAdminUi" before="Magento_Backend" /> | ||
</route> | ||
</router> | ||
</config> |
18 changes: 18 additions & 0 deletions
18
InventoryInStorePickupApi/Api/IsOrderReadyForPickupInterface.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<?php | ||
/** | ||
* Copyright © Magento, Inc. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
declare(strict_types=1); | ||
|
||
namespace Magento\InventoryInStorePickupApi\Api; | ||
|
||
interface IsOrderReadyForPickupInterface | ||
{ | ||
/** | ||
* @param int $orderId | ||
* | ||
* @return bool | ||
*/ | ||
public function execute(int $orderId):bool; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters