Skip to content

Commit 1585a7b

Browse files
committed
Merge branch 'MC-37794' of https://github.com/magento-mpi/magento2ce into TANGO-PR-10-21-2020-24
2 parents 6bc8dc4 + aa34315 commit 1585a7b

File tree

7 files changed

+65
-533
lines changed

7 files changed

+65
-533
lines changed

app/code/Magento/Sales/Model/ShipOrder.php

Lines changed: 15 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -5,25 +5,15 @@
55
*/
66
namespace Magento\Sales\Model;
77

8-
use DomainException;
98
use Magento\Framework\App\ResourceConnection;
10-
use Magento\Sales\Api\Data\ShipmentCommentCreationInterface;
11-
use Magento\Sales\Api\Data\ShipmentCreationArgumentsInterface;
12-
use Magento\Sales\Api\Data\ShipmentItemCreationInterface;
13-
use Magento\Sales\Api\Data\ShipmentPackageCreationInterface;
14-
use Magento\Sales\Api\Data\ShipmentTrackCreationInterface;
15-
use Magento\Sales\Api\Exception\CouldNotShipExceptionInterface;
16-
use Magento\Sales\Api\Exception\DocumentValidationExceptionInterface;
179
use Magento\Sales\Api\OrderRepositoryInterface;
1810
use Magento\Sales\Api\ShipmentRepositoryInterface;
1911
use Magento\Sales\Api\ShipOrderInterface;
20-
use Magento\Sales\Exception\CouldNotShipException;
21-
use Magento\Sales\Exception\DocumentValidationException;
2212
use Magento\Sales\Model\Order\Config as OrderConfig;
2313
use Magento\Sales\Model\Order\OrderStateResolverInterface;
14+
use Magento\Sales\Model\Order\ShipmentDocumentFactory;
2415
use Magento\Sales\Model\Order\Shipment\NotifierInterface;
2516
use Magento\Sales\Model\Order\Shipment\OrderRegistrarInterface;
26-
use Magento\Sales\Model\Order\ShipmentDocumentFactory;
2717
use Magento\Sales\Model\Order\Validation\ShipOrderInterface as ShipOrderValidator;
2818
use Psr\Log\LoggerInterface;
2919

@@ -126,27 +116,29 @@ public function __construct(
126116
* Process the shipment and save shipment and order data
127117
*
128118
* @param int $orderId
129-
* @param ShipmentItemCreationInterface[] $items
119+
* @param \Magento\Sales\Api\Data\ShipmentItemCreationInterface[] $items
130120
* @param bool $notify
131121
* @param bool $appendComment
132-
* @param ShipmentCommentCreationInterface|null $comment
133-
* @param ShipmentTrackCreationInterface[] $tracks
134-
* @param ShipmentPackageCreationInterface[] $packages
135-
* @param ShipmentCreationArgumentsInterface|null $arguments
122+
* @param \Magento\Sales\Api\Data\ShipmentCommentCreationInterface|null $comment
123+
* @param \Magento\Sales\Api\Data\ShipmentTrackCreationInterface[] $tracks
124+
* @param \Magento\Sales\Api\Data\ShipmentPackageCreationInterface[] $packages
125+
* @param \Magento\Sales\Api\Data\ShipmentCreationArgumentsInterface|null $arguments
136126
* @return int
137-
* @throws DocumentValidationExceptionInterface
138-
* @throws CouldNotShipExceptionInterface
139-
* @throws DomainException
127+
* @throws \Magento\Sales\Api\Exception\DocumentValidationExceptionInterface
128+
* @throws \Magento\Sales\Api\Exception\CouldNotShipExceptionInterface
129+
* @throws \Magento\Framework\Exception\InputException
130+
* @throws \Magento\Framework\Exception\NoSuchEntityException
131+
* @throws \DomainException
140132
*/
141133
public function execute(
142134
$orderId,
143135
array $items = [],
144136
$notify = false,
145137
$appendComment = false,
146-
ShipmentCommentCreationInterface $comment = null,
138+
\Magento\Sales\Api\Data\ShipmentCommentCreationInterface $comment = null,
147139
array $tracks = [],
148140
array $packages = [],
149-
ShipmentCreationArgumentsInterface $arguments = null
141+
\Magento\Sales\Api\Data\ShipmentCreationArgumentsInterface $arguments = null
150142
) {
151143
$connection = $this->resourceConnection->getConnection('sales');
152144
$order = $this->orderRepository->get($orderId);
@@ -170,7 +162,7 @@ public function execute(
170162
$packages
171163
);
172164
if ($validationMessages->hasMessages()) {
173-
throw new DocumentValidationException(
165+
throw new \Magento\Sales\Exception\DocumentValidationException(
174166
__("Shipment Document Validation Error(s):\n" . implode("\n", $validationMessages->getMessages()))
175167
);
176168
}
@@ -189,7 +181,7 @@ public function execute(
189181
} catch (\Exception $e) {
190182
$this->logger->critical($e);
191183
$connection->rollBack();
192-
throw new CouldNotShipException(
184+
throw new \Magento\Sales\Exception\CouldNotShipException(
193185
__('Could not save a shipment, see error log for details')
194186
);
195187
}

app/code/Magento/Sales/Plugin/ProcessOrderAndShipmentViaAPI.php

Lines changed: 0 additions & 241 deletions
This file was deleted.

app/code/Magento/Sales/Test/Unit/Model/ShipOrderTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ protected function setUp(): void
189189
->getMockForAbstractClass();
190190
$this->shipOrderValidatorMock = $this->getMockBuilder(ShipOrderInterface::class)
191191
->disableOriginalConstructor()
192-
->getMock();
192+
->getMockForAbstractClass();
193193
$this->validationMessagesMock = $this->getMockBuilder(ValidatorResultInterface::class)
194194
->disableOriginalConstructor()
195195
->setMethods(['hasMessages', 'getMessages', 'addMessage'])

app/code/Magento/Sales/etc/webapi_rest/di.xml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,4 @@
1919
</argument>
2020
</arguments>
2121
</type>
22-
<type name="Magento\Sales\Model\Order\ShipmentRepository">
23-
<plugin name="process_order_and_shipment_via_api" type="Magento\Sales\Plugin\ProcessOrderAndShipmentViaAPI" />
24-
</type>
2522
</config>

app/code/Magento/Sales/etc/webapi_soap/di.xml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,4 @@
1919
</argument>
2020
</arguments>
2121
</type>
22-
<type name="Magento\Sales\Model\Order\ShipmentRepository">
23-
<plugin name="process_order_and_shipment_via_api" type="Magento\Sales\Plugin\ProcessOrderAndShipmentViaAPI" />
24-
</type>
2522
</config>

0 commit comments

Comments
 (0)