This repository has been archived by the owner on Feb 16, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #138 from heidelpay/MAGE2-316/fix/shipping_order_s…
…tate (MAGE2-316)[fix] Set expected orderstate after shipment for invoice
- Loading branch information
Showing
6 changed files
with
54 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
<?php | ||
/** | ||
* Trait to handle payment methods that can ship before payment e.g. Invoice. | ||
* | ||
* @license Use of this software requires acceptance of the Evaluation License Agreement. See LICENSE file. | ||
* @copyright Copyright © 2016-present heidelpay GmbH. All rights reserved. | ||
* @link http://dev.heidelpay.com/magento2 | ||
* @author David Owusu | ||
* | ||
* @package heidelpay | ||
* @subpackage magento2 | ||
* @category magento2 | ||
*/ | ||
|
||
namespace Heidelpay\Gateway\Traits; | ||
|
||
|
||
use Magento\Sales\Model\Order; | ||
|
||
trait CanShipBeforePayment | ||
{ | ||
/** | ||
* @param Order $order | ||
*/ | ||
public function setShippedOrderState(&$order) | ||
{ | ||
if ($order->getTotalPaid() < $order->getGrandTotal()) { | ||
$state = Order::STATE_PENDING_PAYMENT; | ||
$status = $order->getConfig()->getStateDefaultStatus($state); | ||
$order->setState($state)->setStatus($status); | ||
} | ||
} | ||
} |