-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove inexistent order canceled webhook (#93)
Co-authored-by: Tigran Hovhannisyan <[email protected]>
- Loading branch information
1 parent
acbc09f
commit fa6907b
Showing
9 changed files
with
82 additions
and
17 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
<?php | ||
namespace Mondu\Mondu\Observer; | ||
|
||
use Magento\Framework\Event\Observer; | ||
use Mondu\Mondu\Helpers\ContextHelper; | ||
use Mondu\Mondu\Helpers\Logger\Logger; | ||
use Mondu\Mondu\Helpers\PaymentMethod; | ||
|
||
class AfterPlaceOrder extends MonduObserver | ||
{ | ||
/** | ||
* @var \Mondu\Mondu\Helpers\Log | ||
*/ | ||
protected $monduLogger; | ||
|
||
/** | ||
* @param PaymentMethod $paymentMethodHelper | ||
* @param Logger $monduFileLogger | ||
* @param ContextHelper $contextHelper | ||
* @param \Mondu\Mondu\Helpers\Log $monduLogger | ||
*/ | ||
public function __construct( | ||
PaymentMethod $paymentMethodHelper, | ||
Logger $monduFileLogger, | ||
ContextHelper $contextHelper, | ||
\Mondu\Mondu\Helpers\Log $monduLogger | ||
) { | ||
parent::__construct($paymentMethodHelper, $monduFileLogger, $contextHelper); | ||
$this->monduLogger = $monduLogger; | ||
} | ||
|
||
/** | ||
* Execute | ||
* | ||
* @param Observer $observer | ||
* @return void | ||
*/ | ||
public function _execute(Observer $observer) | ||
{ | ||
$order = $observer->getEvent()->getOrder(); | ||
$monduUuid = $order->getMonduReferenceId(); | ||
$orderData = $this->monduLogger->getTransactionByOrderUid($monduUuid); | ||
|
||
if (isset($orderData['mondu_state']) && $orderData['mondu_state'] === 'pending') { | ||
$order->addStatusHistoryComment( | ||
__('Mondu: Order Status changed to Payment Review because it needs manual confirmation') | ||
); | ||
$order->setState(\Magento\Sales\Model\Order::STATE_PAYMENT_REVIEW); | ||
$order->setStatus(\Magento\Sales\Model\Order::STATE_PAYMENT_REVIEW); | ||
$order->save(); | ||
} | ||
} | ||
} |
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 |
---|---|---|
|
@@ -7,17 +7,19 @@ services: | |
ports: | ||
- 80:8080 | ||
environment: | ||
- BITNAMI_DEBUG=true | ||
- MAGENTO_HOST=localhost | ||
- MAGENTO_MODE=developer | ||
- MAGENTO_DATABASE_HOST=mariadb | ||
- MAGENTO_DATABASE_PORT_NUMBER=3306 | ||
- MAGENTO_DATABASE_USER=bn_magento | ||
- MAGENTO_DATABASE_NAME=bitnami_magento | ||
- MAGENTO_ELASTICSEARCH_HOST=elasticsearch | ||
- MAGENTO_ELASTICSEARCH_PORT_NUMBER=9200 | ||
- MAGENTO_USERNAME=mondu | ||
- MAGENTO_PASSWORD=mondu | ||
- MAGENTO_PASSWORD=mondu123 | ||
- [email protected] | ||
- ALLOW_EMPTY_PASSWORD=yes | ||
- ELASTICSEARCH_HOST=elasticsearch | ||
- ELASTICSEARCH_PORT_NUMBER=9200 | ||
- PHP_MEMORY_LIMIT=5120M | ||
volumes: | ||
- magento_data:/bitnami/magento | ||
|
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