9 use Magento\CheckoutAgreements\Model\ResourceModel\Agreement\CollectionFactory as AgreementCollectionFactory;
32 private $collectionFactory;
39 private $storeManager;
51 private $resourceModel;
56 private $agreementFactory;
61 private $extensionAttributesJoinProcessor;
66 private $agreementsList;
71 private $activeStoreAgreementsFilter;
87 AgreementCollectionFactory $collectionFactory,
91 AgreementFactory $agreementFactory,
93 \
Magento\CheckoutAgreements\Api\CheckoutAgreementsListInterface $agreementsList =
null,
96 $this->collectionFactory = $collectionFactory;
98 $this->scopeConfig = $scopeConfig;
99 $this->resourceModel = $agreementResource;
100 $this->agreementFactory = $agreementFactory;
101 $this->extensionAttributesJoinProcessor = $extensionAttributesJoinProcessor;
103 \
Magento\CheckoutAgreements\Api\CheckoutAgreementsListInterface::class
106 ActiveStoreAgreementsFilter::class
120 return $this->agreementsList->getList($this->activeStoreAgreementsFilter->buildSearchCriteria());
134 $storeId = $this->storeManager->getStore()->getId();
138 $this->resourceModel->save(
$data);
139 }
catch (\Exception $e) {
140 throw new \Magento\Framework\Exception\CouldNotSaveException(
141 __(
'The "%1" checkout agreement couldn\'t be saved.',
$data->getAgreementId())
153 $this->resourceModel->delete(
$data);
154 }
catch (\Exception $e) {
155 throw new \Magento\Framework\Exception\CouldNotDeleteException(
156 __(
'The "%1" checkout agreement couldn\'t be removed.',
$data->getAgreementId())
178 $agreement = $this->agreementFactory->create();
182 __(
'A checkout agreement with the "%1" specified ID wasn\'t found. Verify the ID and try again.',
$id)
__construct(AgreementCollectionFactory $collectionFactory, StoreManagerInterface $storeManager, ScopeConfigInterface $scopeConfig, AgreementResource $agreementResource, AgreementFactory $agreementFactory, JoinProcessorInterface $extensionAttributesJoinProcessor, \Magento\CheckoutAgreements\Api\CheckoutAgreementsListInterface $agreementsList=null, ActiveStoreAgreementsFilter $activeStoreAgreementsFilter=null)
save(\Magento\CheckoutAgreements\Api\Data\AgreementInterface $data, $storeId=null)