Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
All Data Structures Namespaces Files Functions Variables Pages
Agreement.php
Go to the documentation of this file.
1 <?php
7 
11 abstract class Agreement extends \Magento\Backend\App\Action
12 {
18  const ADMIN_RESOURCE = 'Magento_Paypal::billing_agreement';
19 
25  protected $_coreRegistry = null;
26 
31  public function __construct(\Magento\Backend\App\Action\Context $context, \Magento\Framework\Registry $coreRegistry)
32  {
33  $this->_coreRegistry = $coreRegistry;
34  parent::__construct($context);
35  }
36 
42  protected function _initBillingAgreement()
43  {
44  $agreementId = $this->getRequest()->getParam('agreement');
45  $agreementModel = $this->_objectManager->create(
46  \Magento\Paypal\Model\Billing\Agreement::class
47  )->load($agreementId);
48 
49  if (!$agreementModel->getId()) {
50  $this->messageManager->addErrorMessage(
51  __('Please specify the correct billing agreement ID and try again.')
52  );
53  return false;
54  }
55 
56  $this->_coreRegistry->register('current_billing_agreement', $agreementModel);
57  return $agreementModel;
58  }
59 }
__()
Definition: __.php:13
__construct(\Magento\Backend\App\Action\Context $context, \Magento\Framework\Registry $coreRegistry)
Definition: Agreement.php:31