Skip to content

Commit

Permalink
MOL-1225: add batch shipments to administration
Browse files Browse the repository at this point in the history
  • Loading branch information
boxblinkracer committed Dec 13, 2023
1 parent ab42644 commit 3d6de7a
Show file tree
Hide file tree
Showing 45 changed files with 1,369 additions and 1,076 deletions.
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
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

0 comments on commit 3d6de7a

Please sign in to comment.