Ejemplo n.º 1
0
 /**
  * @return array|void
  */
 public function getConfig()
 {
     if (!$this->config->isActive()) {
         return [];
     }
     $clientToken = $this->config->getClientToken();
     $config = ['payment' => ['braintree_paypal' => ['clientToken' => $clientToken, 'locale' => $this->localeResolver->getLocale(), 'merchantDisplayName' => $this->config->getMerchantNameOverride()]]];
     return $config;
 }
Ejemplo n.º 2
0
 /**
  * Check whether payment method is enabled
  *
  * @param RequestInterface $request
  * @return \Magento\Framework\Controller\Result\Redirect|\Magento\Framework\App\ResponseInterface
  */
 public function dispatch(RequestInterface $request)
 {
     if (!$this->braintreePayPalConfig->isActive() || !$this->braintreePayPalConfig->isShortcutCheckoutEnabled()) {
         $this->_actionFlag->set('', self::FLAG_NO_DISPATCH, true);
         /** @var \Magento\Framework\Controller\Result\Redirect $resultRedirect */
         $resultRedirect = $this->resultRedirectFactory->create();
         $resultRedirect->setPath('noRoute');
         return $resultRedirect;
     }
     return parent::dispatch($request);
 }
Ejemplo n.º 3
0
 public function testIsActive()
 {
     $prefix = 'payment/braintree_paypal/';
     $this->scopeConfigMock->expects($this->once())->method('getValue')->with($prefix . Config::KEY_ACTIVE, \Magento\Store\Model\ScopeInterface::SCOPE_STORE, null)->willReturn(true);
     $this->assertEquals(true, $this->model->isActive());
 }