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

MOL-1225: add batch shipments to administration #665

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion makefile
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ clean: ## Cleans all dependencies and files
rm -rf ./src/Resources/app/storefront/dist/storefront
# ------------------------------------------------------
rm -rf ./src/Resources/public/administration
rm -rf ./src/Resources/public/molllie-payments.js
rm -rf ./src/Resources/public/mollie-payments.js

build: ## Installs the plugin, and builds the artifacts using the Shopware build commands.
# -----------------------------------------------------
Expand Down
24 changes: 9 additions & 15 deletions src/Compatibility/Bundles/FlowBuilder/Actions/ShipOrderAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@

namespace Kiener\MolliePayments\Compatibility\Bundles\FlowBuilder\Actions;

use Kiener\MolliePayments\Facade\MollieShipment;
use Kiener\MolliePayments\Facade\MollieShipmentInterface;
use Kiener\MolliePayments\Service\OrderService;
use Kiener\MolliePayments\Components\ShipmentManager\ShipmentManagerInterface;
use Kiener\MolliePayments\Service\OrderServiceInterface;
use Psr\Log\LoggerInterface;
use Shopware\Core\Content\Flow\Dispatching\Action\FlowAction;
Expand All @@ -27,20 +25,20 @@ class ShipOrderAction extends FlowAction implements EventSubscriberInterface
private $orderService;

/**
* @var MollieShipmentInterface
* @var ShipmentManagerInterface
*/
private $shipmentFacade;
private $shipment;


/**
* @param OrderServiceInterface $orderService
* @param MollieShipmentInterface $shipment
* @param ShipmentManagerInterface $shipment
* @param LoggerInterface $logger
*/
public function __construct(OrderServiceInterface $orderService, MollieShipmentInterface $shipment, LoggerInterface $logger)
public function __construct(OrderServiceInterface $orderService, ShipmentManagerInterface $shipment, LoggerInterface $logger)
{
$this->orderService = $orderService;
$this->shipmentFacade = $shipment;
$this->shipment = $shipment;
$this->logger = $logger;
}

Expand Down Expand Up @@ -122,13 +120,9 @@ private function shipOrder(string $orderId, Context $context): void

$this->logger->info('Starting Shipment through Flow Builder Action for order: ' . $orderNumber);

$this->shipmentFacade->shipOrder(
$order,
'',
'',
'',
$context
);
# ship (all or) the rest of the order without providing any specific tracking information.
# this will ensure tracking data is automatically taken from the order
$this->shipment->shipOrderRest($order, null, $context);
} catch (\Exception $ex) {
$this->logger->error(
'Error when shipping order with Flow Builder Action',
Expand Down
5 changes: 3 additions & 2 deletions src/Components/MollieLimits/Service/MollieLimitsRemover.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
use Kiener\MolliePayments\Exception\MissingCartServiceException;
use Kiener\MolliePayments\Exception\MissingRequestException;
use Kiener\MolliePayments\Service\MollieApi\OrderDataExtractor;
use Kiener\MolliePayments\Service\MollieApi\OrderItemsExtractor;
use Kiener\MolliePayments\Service\OrderService;
use Kiener\MolliePayments\Service\Payment\Provider\ActivePaymentMethodsProviderInterface;
use Kiener\MolliePayments\Service\Payment\Remover\PaymentMethodRemover;
Expand Down Expand Up @@ -35,10 +36,10 @@ class MollieLimitsRemover extends PaymentMethodRemover
* @param OrderService $orderService
* @param SettingsService $settingsService
* @param ActivePaymentMethodsProviderInterface $paymentMethodsProvider
* @param OrderDataExtractor $orderDataExtractor
* @param OrderItemsExtractor $orderDataExtractor
* @param LoggerInterface $logger
*/
public function __construct(ContainerInterface $container, RequestStack $requestStack, OrderService $orderService, SettingsService $settingsService, ActivePaymentMethodsProviderInterface $paymentMethodsProvider, OrderDataExtractor $orderDataExtractor, LoggerInterface $logger)
public function __construct(ContainerInterface $container, RequestStack $requestStack, OrderService $orderService, SettingsService $settingsService, ActivePaymentMethodsProviderInterface $paymentMethodsProvider, OrderItemsExtractor $orderDataExtractor, LoggerInterface $logger)
{
parent::__construct($container, $requestStack, $orderService, $settingsService, $orderDataExtractor, $logger);

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?php

namespace Kiener\MolliePayments\Components\ShipmentManager\Exceptions;

class NoDeliveriesFoundException extends \Exception
{
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?php

namespace Kiener\MolliePayments\Components\ShipmentManager\Exceptions;

class NoLineItemsProvidedException extends \Exception
{
}
43 changes: 43 additions & 0 deletions src/Components/ShipmentManager/Models/ShipmentLineItem.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
<?php

namespace Kiener\MolliePayments\Components\ShipmentManager\Models;

class ShipmentLineItem
{

/**
* @var string
*/
private $shopwareId;

/**
* @var int
*/
private $quantity;

/**
* @param string $shopwareId
* @param int $quantity
*/
public function __construct(string $shopwareId, int $quantity)
{
$this->shopwareId = $shopwareId;
$this->quantity = $quantity;
}

/**
* @return string
*/
public function getShopwareId(): string
{
return $this->shopwareId;
}

/**
* @return int
*/
public function getQuantity(): int
{
return $this->quantity;
}
}
58 changes: 58 additions & 0 deletions src/Components/ShipmentManager/Models/TrackingData.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
<?php

namespace Kiener\MolliePayments\Components\ShipmentManager\Models;

class TrackingData
{

/**
* @var string
*/
private $carrier;

/**
* @var string
*/
private $code;

/**
* @var string
*/
private $trackingUrl;

/**
* @param string $carrier
* @param string $code
* @param string $trackingUrl
*/
public function __construct(string $carrier, string $code, string $trackingUrl)
{
$this->carrier = $carrier;
$this->code = $code;
$this->trackingUrl = $trackingUrl;
}

/**
* @return string
*/
public function getCarrier(): string
{
return $this->carrier;
}

/**
* @return string
*/
public function getCode(): string
{
return $this->code;
}

/**
* @return string
*/
public function getTrackingUrl(): string
{
return $this->trackingUrl;
}
}
Loading
Loading