Observer/OrderCancelObserver.php
public function execute(Observer $observer) {

        // Get the order
        $order = $observer->getEvent()->getOrder();

        // Get the payment method
        $paymentMethod = $order->getPayment()->getMethod();

        // Test the current method used
        if ($paymentMethod == ConfigProvider::CODE || $paymentMethod == ConfigProvider::CC_VAULT_CODE || $paymentMethod == ConfigProvider::THREE_DS_CODE) {

            // Update the hub API for cancelled order
            $this->orderService->cancelTransactionToRemote($order);    
        }

        return $this;
    }
public function execute(Observer $observer) {

        // Get the order
        $order = $observer->getEvent()->getOrder();

        // Get the payment method
        $paymentMethod = $order->getPayment()->getMethod();

        // Test the current method used
        if ($paymentMethod == ConfigProvider::CODE || $paymentMethod == ConfigProvider::CC_VAULT_CODE || $paymentMethod == ConfigProvider::THREE_DS_CODE) {

            // Update the hub API for cancelled order
            $this->orderService->cancelTransactionToRemote($order);    
        }

        return $this;
    }
public function execute ( Observer $ observer ) { // Get the order $ order = $ observer -> getEvent ( ) -> getOrder ( ) ; // Get the payment method $ paymentMethod = $ order -> getPayment ( ) -> getMethod ( ) ; // Test the current method used if ( $ paymentMethod == ConfigProvider :: CODE || $ paymentMethod == ConfigProvider :: CC_VAULT_CODE || $ paymentMethod == ConfigProvider :: THREE_DS_CODE ) { // Update the hub API for cancelled order $ this -> orderService -> cancelTransactionToRemote ( $ order ) ; } return $ this ; }
Handles the observer for order cancellation.

@param Observer $observer
@return void
Handles the observer for order cancellation .