Example #1
0
 /**
  * Create shipment
  *
  * @throws bool
  */
 protected function _createShipment()
 {
     $this->_adyenLogger->addAdyenNotificationCronjob('Creating shipment for order');
     // create shipment for cash payment
     $payment = $this->_order->getPayment()->getMethodInstance();
     if ($this->_order->canShip()) {
         $itemQty = [];
         $shipment = $this->_order->prepareShipment($itemQty);
         if ($shipment) {
             $shipment->register();
             $shipment->getOrder()->setIsInProcess(true);
             $comment = __('Shipment created by Adyen');
             $shipment->addComment($comment);
             /** @var \Magento\Framework\DB\Transaction $transaction */
             $transaction = $this->_transactionFactory->create();
             $transaction->addObject($shipment)->addObject($shipment->getOrder())->save();
             $this->_adyenLogger->addAdyenNotificationCronjob('Order is shipped');
         }
     } else {
         $this->_adyenLogger->addAdyenNotificationCronjob('Order can\'t be shipped');
     }
 }
Example #2
0
 /**
  *
  */
 protected function _createShipment()
 {
     $this->_debugData['_createShipment'] = 'Creating shipment for order';
     // create shipment for cash payment
     $payment = $this->_order->getPayment()->getMethodInstance();
     if ($this->_order->canShip()) {
         $itemQty = array();
         $shipment = $this->_order->prepareShipment($itemQty);
         if ($shipment) {
             $shipment->register();
             $shipment->getOrder()->setIsInProcess(true);
             $comment = __('Shipment created by Adyen');
             $shipment->addComment($comment);
             /** @var \Magento\Framework\DB\Transaction $transaction */
             $transaction = $this->_transactionFactory->create();
             $transaction->addObject($shipment)->addObject($shipment->getOrder())->save();
             $this->_debugData['_createShipment done'] = 'Order is shipped';
         }
     } else {
         $this->_debugData['_createShipment error'] = 'Order can\'t be shipped';
     }
 }