/**
  * Continue Pay Pal checkout.
  *
  * @return array|null
  */
 public function run()
 {
     $this->reviewBlock = $this->paypalPage->getReviewBlock()->isVisible() ? $this->paypalPage->getReviewBlock() : $this->paypalPage->getOldReviewBlock();
     $this->selectCustomerAddress($this->customer);
     $this->reviewBlock->continueCheckout();
     $successBlock = $this->checkoutOnepageSuccess->getSuccessBlock();
     return ['orderId' => $successBlock->isVisible() ? $successBlock->getGuestOrderId() : null];
 }
 /**
  * Login to Pay Pal.
  *
  * @return void
  */
 public function run()
 {
     /** Log out from previous session. */
     $this->paypalPage->getReviewBlock()->logOut();
     $payPalLoginBlock = $this->paypalPage->getLoginBlock();
     $payPalLoginBlock->fill($this->customer);
     $payPalLoginBlock->submit();
 }
 /**
  * Select customer address.
  *
  * @param PaypalCustomer $customer
  * @return void
  */
 protected function selectCustomerAddress(PaypalCustomer $customer)
 {
     $reviewBlock = $this->paypalPage->getReviewBlock();
     if ($reviewBlock->checkChangeAddressAbility()) {
         $address = $customer->getDataFieldConfig('address')['source']->getAddresses()[0];
         $reviewBlock->getAddressesBlock()->selectAddress($address);
         $reviewBlock->waitLoader();
     }
 }
 /**
  * Login to Pay Pal.
  *
  * @return void
  */
 public function run()
 {
     $browser = $this->browser;
     $selector = $this->loader;
     $browser->waitUntil(function () use($browser, $selector) {
         $element = $browser->find($selector);
         return $element->isVisible() == false ? true : null;
     });
     /** Log out from previous session. */
     $reviewBlock = $this->paypalPage->getReviewBlock()->isVisible() ? $this->paypalPage->getReviewBlock() : $this->paypalPage->getOldReviewBlock();
     $reviewBlock->logOut();
     $payPalLoginBlock = $this->paypalPage->getLoginBlock()->isVisible() ? $this->paypalPage->getLoginBlock() : $this->paypalPage->getOldLoginBlock();
     $payPalLoginBlock->fill($this->customer);
     $payPalLoginBlock->submit();
     $reviewBlock->waitLoader();
 }