/**
  * Check whether method available for checkout or not
  * Logic based on merchant country, methods dependence
  *
  * @param string|null $methodCode
  * @return bool
  * @SuppressWarnings(PHPMD.CyclomaticComplexity)
  */
 public function isMethodAvailable($methodCode = null)
 {
     $result = parent::isMethodAvailable($methodCode);
     switch ($methodCode) {
         case self::METHOD_WPP_EXPRESS:
         case self::METHOD_WPS_EXPRESS:
             if ($this->isMethodActive(self::METHOD_PAYFLOWPRO) || $this->isMethodActive(self::METHOD_PAYMENT_PRO)) {
                 $result = true;
             }
             break;
         case self::METHOD_WPP_BML:
         case self::METHOD_WPS_BML:
             // check for express payments dependence
             if (!$this->isMethodActive(self::METHOD_WPP_EXPRESS) && !$this->isMethodActive(self::METHOD_WPS_EXPRESS)) {
                 $result = false;
             }
             break;
         case self::METHOD_WPP_PE_EXPRESS:
             // check for direct payments dependence
             if ($this->isMethodActive(self::METHOD_PAYFLOWLINK) || $this->isMethodActive(self::METHOD_PAYFLOWADVANCED)) {
                 $result = true;
             } elseif (!$this->isMethodActive(self::METHOD_PAYFLOWPRO)) {
                 $result = false;
             }
             break;
         case self::METHOD_WPP_PE_BML:
             // check for express payments dependence
             if (!$this->isMethodActive(self::METHOD_WPP_PE_EXPRESS)) {
                 $result = false;
             }
             break;
         case self::METHOD_BILLING_AGREEMENT:
             $result = $this->isWppApiAvailabe();
             break;
     }
     return $result;
 }
Example #2
0
 /**
  * Check whether method active in configuration and supported for merchant country or not
  *
  * @param string $method Method code
  * @return bool
  *
  * @SuppressWarnings(PHPMD.UnusedFormalParameter)
  */
 public function isMethodActive($method)
 {
     return parent::isMethodActive(Config::METHOD_PAYMENT_PRO) || parent::isMethodActive(Config::METHOD_PAYFLOWPRO);
 }