currentCustomer = $currentCustomer; $this->paypalData = $paypalData; $this->urlBuilder = $urlBuilder; $this->escaper = $escaper; $this->config = $paypalConfigFactory->create(); $this->config->setMethod(Config::METHOD_EXPRESS); } /** * @inheritdoc */ public function getSectionData() { $customerId = $this->currentCustomer->getCustomerId(); if ($this->paypalData->shouldAskToCreateBillingAgreement($this->config, $customerId)) { return [ 'askToCreate' => true, 'confirmUrl' => $this->escaper->escapeUrl( $this->urlBuilder->getUrl( $this->startAction, [\Magento\Paypal\Model\Express\Checkout::PAYMENT_INFO_TRANSPORT_BILLING_AGREEMENT => 1] ) ), 'confirmMessage' => $this->escaper->escapeHtml( __('Would you like to sign a billing agreement to streamline further purchases with PayPal?') ) ]; } return []; } }