public function testExecute()
 {
     $details = $this->getDetails();
     $quoteMock = $this->getQuoteMock();
     $paymentMock = $this->getPaymentMock();
     $quoteMock->expects(self::once())->method('getPayment')->willReturn($paymentMock);
     $paymentMock->expects(self::once())->method('setMethod')->with(ConfigProvider::PAYPAL_CODE);
     $paymentMock->expects(self::once())->method('setAdditionalInformation')->with(DataAssignObserver::PAYMENT_METHOD_NONCE, self::TEST_NONCE);
     $this->updateQuoteStep($quoteMock, $details);
     $this->quoteUpdater->execute(self::TEST_NONCE, $details, $quoteMock);
 }
 /**
  * @inheritdoc
  */
 public function execute()
 {
     $requestData = json_decode($this->getRequest()->getPostValue('result', '{}'), true);
     $quote = $this->checkoutSession->getQuote();
     try {
         $this->validateQuote($quote);
         $this->validateRequestData($requestData);
         $this->quoteUpdater->execute($requestData['nonce'], $requestData['details'], $quote);
         /** @var \Magento\Framework\View\Result\Page $resultPage */
         $resultPage = $this->resultFactory->create(ResultFactory::TYPE_PAGE);
         /** @var \Magento\BraintreeTwo\Block\Paypal\Checkout\Review $reviewBlock */
         $reviewBlock = $resultPage->getLayout()->getBlock('braintreetwo.paypal.review');
         $reviewBlock->setQuote($quote);
         $reviewBlock->getChildBlock('shipping_method')->setData('quote', $quote);
         return $resultPage;
     } catch (\Exception $e) {
         $this->messageManager->addExceptionMessage($e, $e->getMessage());
     }
     /** @var \Magento\Framework\Controller\Result\Redirect $resultRedirect */
     $resultRedirect = $this->resultFactory->create(ResultFactory::TYPE_REDIRECT);
     return $resultRedirect->setPath('checkout/cart', ['_secure' => true]);
 }