Sonata\PaymentBundle\Consumer\PaymentProcessOrderElementConsumer::process PHP Method

process() public method

public process ( Sonata\NotificationBundle\Consumer\ConsumerEvent $event )
$event Sonata\NotificationBundle\Consumer\ConsumerEvent
    public function process(ConsumerEvent $event)
    {
        $orderStatus = $event->getMessage()->getValue('order_status');
        $transactionStatus = $event->getMessage()->getValue('transaction_status');
        $productId = $event->getMessage()->getValue('product_id');
        $productType = $event->getMessage()->getValue('product_type');
        $quantity = $event->getMessage()->getValue('quantity');
        $productManager = $this->getProductManager($productType);
        $productProvider = $this->getProductProvider($productType);
        $diff = $this->generateDiffValue($transactionStatus, $orderStatus, $quantity);
        if ($diff) {
            $productProvider->updateStock($productId, $productManager, $diff);
        }
    }