Skip to content

Commit

Permalink
Merge pull request #76 from dpdconnect/1.3.1
Browse files Browse the repository at this point in the history
1.3.1
  • Loading branch information
dpdplugin authored Jun 22, 2023
2 parents 9b836df + 2774b59 commit fd8973b
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 13 deletions.
15 changes: 14 additions & 1 deletion Helper/Data.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
use Magento\Store\Model\ScopeInterface;
use Zend_Pdf;
use Zend_Pdf_Exception;
use Magento\Shipping\Model\ShipmentNotifier;

class Data extends AbstractHelper
{
Expand Down Expand Up @@ -58,6 +59,10 @@ class Data extends AbstractHelper
* @var BatchManager
*/
private $batchManager;
/**
* @var ShipmentNotifier
*/
private $shipmentNotifier;

/**
* Data constructor.
Expand All @@ -67,19 +72,22 @@ class Data extends AbstractHelper
* @param TrackFactory $trackFactory
* @param ShipmentManager $shipmentManager
* @param BatchManager $batchManager
* @param ShipmentNotifier $shipmentNotifier
*/
public function __construct(
Context $context,
ShipmentLabelService $shipmentLabel,
DpdSettings $dpdSettings,
TrackFactory $trackFactory,
ShipmentManager $shipmentManager,
BatchManager $batchManager
BatchManager $batchManager,
ShipmentNotifier $shipmentNotifier
) {
$this->shipmentLabel = $shipmentLabel;
$this->trackFactory = $trackFactory;
$this->dpdSettings = $dpdSettings;
$this->shipmentManager = $shipmentManager;
$this->shipmentNotifier = $shipmentNotifier;

parent::__construct($context);
$this->batchManager = $batchManager;
Expand Down Expand Up @@ -184,6 +192,11 @@ public function generateShippingLabel(Order $order, Order\Shipment $shipment = n
}
}

$sendConfirmEmail = $this->dpdSettings->isSetFlag(DpdSettings::ADVANCED_SEND_CONFIRM_EMAIL);
if ($sendConfirmEmail) {
$this->shipmentNotifier->notify($shipment);
}

return $pdfResult;
}

Expand Down
13 changes: 1 addition & 12 deletions Services/ShipmentManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
use Magento\Sales\Model\Order;
use Magento\Sales\Model\Order\Shipment;
use Magento\Sales\Model\Order\Shipment\TrackFactory;
use Magento\Shipping\Model\ShipmentNotifier;
use Magento\Store\Model\ScopeInterface;

class ShipmentManager
Expand All @@ -30,31 +29,25 @@ class ShipmentManager
* @var TrackFactory
*/
private $trackFactory;
/**
* @var ShipmentNotifier
*/
private $shipmentNotifier;

/**
* ShipmentManager constructor.
* @param OrderConvert $orderConvert
* @param TransactionFactory $transactionFactory
* @param DpdSettings $dpdSettings
* @param TrackFactory $trackFactory
* @param ShipmentNotifier $shipmentNotifier
*/
public function __construct(
OrderConvert $orderConvert,
TransactionFactory $transactionFactory,
DpdSettings $dpdSettings,
TrackFactory $trackFactory,
ShipmentNotifier $shipmentNotifier

) {
$this->orderConvert = $orderConvert;
$this->transactionFactory = $transactionFactory;
$this->dpdSettings = $dpdSettings;
$this->trackFactory = $trackFactory;
$this->shipmentNotifier = $shipmentNotifier;
}

/**
Expand Down Expand Up @@ -149,10 +142,6 @@ public function addTrackingNumbersToShipment(Shipment $shipment, array $parcelNu
$track->getResource()->save($track);
}
}
$sendConfirmEmail = $this->dpdSettings->isSetFlag(DpdSettings::ADVANCED_SEND_CONFIRM_EMAIL);
if ($sendConfirmEmail) {
$this->shipmentNotifier->notify($shipment);
}
}

public function getCarrierCode(Order $order)
Expand Down

0 comments on commit fd8973b

Please sign in to comment.