_coreRegistry = $coreRegistry; parent::__construct($context); } /** * Initialize billing agreement by ID specified in request * * @return \Magento\Paypal\Model\Billing\Agreement|false */ protected function _initBillingAgreement() { $agreementId = $this->getRequest()->getParam('agreement'); $agreementModel = $this->_objectManager->create( \Magento\Paypal\Model\Billing\Agreement::class )->load($agreementId); if (!$agreementModel->getId()) { $this->messageManager->addErrorMessage( __('Please specify the correct billing agreement ID and try again.') ); return false; } $this->_coreRegistry->register('current_billing_agreement', $agreementModel); return $agreementModel; } }