Model/Payment.php
public function isAvailable(\Magento\Quote\Api\Data\CartInterface $quote = null)
    {
        // check for product restrictions
        if ($this->cartHelper->hasProductRestrictions($quote)) {
            return false;
        }
        return parent::isAvailable();
    }
public function isAvailable(\Magento\Quote\Api\Data\CartInterface $quote = null)
    {
        // check for product restrictions
        if ($this->cartHelper->hasProductRestrictions($quote)) {
            return false;
        }
        return parent::isAvailable();
    }
public function isAvailable ( \ Magento \ Quote \ Api \ Data \ CartInterface $ quote = null ) { // check for product restrictions if ( $ this -> cartHelper -> hasProductRestrictions ( $ quote ) ) { return false ; } return parent :: isAvailable ( ) ; }
Check whether payment method can be used

@param \Magento\Quote\Api\Data\CartInterface|null $quote
@return bool
Check whether payment method can be used