_agreementFactory = $agreementFactory; parent::__construct($context, $data); $this->_isScopePrivate = true; } /** * @return void */ protected function _construct() { parent::_construct(); $this->setTransportName( \Magento\Paypal\Model\Payment\Method\Billing\AbstractAgreement::TRANSPORT_BILLING_AGREEMENT_ID ); } /** * Retrieve available customer billing agreements * * @return array */ public function getBillingAgreements() { $data = []; /** @var \Magento\Quote\Model\Quote $quote */ $quote = $this->getParentBlock()->getQuote(); if (!$quote || !$quote->getCustomerId()) { return $data; } $collection = $this->_agreementFactory->create()->getAvailableCustomerBillingAgreements( $quote->getCustomerId() ); foreach ($collection as $item) { $data[$item->getId()] = $item->getReferenceId(); } return $data; } }