|
12345678910111213141516171819202122232425262728 |
- <?php
-
- namespace common\logic\Payment\Event;
-
- use common\logic\Order\Order\Event\OrderDeleteEvent;
- use common\logic\Order\Order\Model\Order;
- use common\logic\Payment\Wrapper\PaymentManager;
- use common\logic\User\User\Wrapper\UserManager;
- use justcoded\yii2\eventlistener\observers\Observer;
-
- class OrderObserver extends Observer
- {
- public function events()
- {
- return [
- Order::EVENT_DELETE => 'onOrderDelete'
- ];
- }
-
- public function onOrderDelete(OrderDeleteEvent $event)
- {
- $order = $event->order;
- $paymentManager = PaymentManager::getInstance();
- $userManager = UserManager::getInstance();
-
- $paymentManager->refundOrderCredit($order, $userManager->getCurrent());
- }
- }
|