/** * Exclude Express Checkout from the list of available for checkout payment methods * if Payflow Link or Paypal Advanced are avavilable * * @return array */ public function getPaymentMethods() { $list = parent::getPaymentMethods(); $transaction = $this->getFirstOpenPaymentTransaction(); $paymentMethod = $transaction ? $transaction->getPaymentMethod() : null; if (!isset($paymentMethod) || !$this->isExpressCheckout($paymentMethod)) { $expressCheckoutKey = null; $found = false; foreach ($list as $k => $method) { if ($this->isExpressCheckout($method)) { $expressCheckoutKey = $k; } if (in_array($method->getServiceName(), array('PayflowLink', 'PaypalAdvanced'))) { $found = true; } if (isset($expressCheckoutKey) && $found) { break; } } if (isset($expressCheckoutKey) && $found) { unset($list[$expressCheckoutKey]); } } return $list; }
/** * {@inheritDoc} */ public function getPaymentMethods() { $this->__initializer__ && $this->__initializer__->__invoke($this, 'getPaymentMethods', array()); return parent::getPaymentMethods(); }