-
-
Notifications
You must be signed in to change notification settings - Fork 40
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
289f98b
commit ecc2c23
Showing
6 changed files
with
299 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
<?php | ||
/** | ||
* Copyright © OpenGento, All rights reserved. | ||
* See LICENSE bundled with this library for license details. | ||
*/ | ||
declare(strict_types=1); | ||
|
||
namespace Opengento\Gdpr\Api; | ||
|
||
use Magento\Framework\Api\SearchCriteriaInterface; | ||
use Magento\Framework\Exception\CouldNotDeleteException; | ||
use Magento\Framework\Exception\CouldNotSaveException; | ||
use Magento\Framework\Exception\LocalizedException; | ||
use Magento\Framework\Exception\NoSuchEntityException; | ||
use Opengento\Gdpr\Api\Data\AgreementInterface; | ||
use Opengento\Gdpr\Api\Data\AgreementSearchResultsInterface; | ||
|
||
/** | ||
* @api | ||
*/ | ||
interface AgreementRepositoryInterface | ||
{ | ||
/** | ||
* Save agreement | ||
* | ||
* @param AgreementInterface $agreement | ||
* @return AgreementInterface | ||
* @throws CouldNotSaveException | ||
*/ | ||
public function save(AgreementInterface $agreement): AgreementInterface; | ||
|
||
/** | ||
* Retrieve agreement by ID | ||
* | ||
* @param int $agreementId | ||
* @return AgreementInterface | ||
* @throws NoSuchEntityException | ||
*/ | ||
public function getById(int $agreementId): AgreementInterface; | ||
|
||
/** | ||
* Retrieve agreement by identifier and scope | ||
* | ||
* @param string $identifier | ||
* @param int $storeId | ||
* @return AgreementInterface | ||
* @throws NoSuchEntityException | ||
*/ | ||
public function getByIdentifier(string $identifier, int $storeId): AgreementInterface; | ||
|
||
/** | ||
* Retrieve agreement list by search filter criteria | ||
* | ||
* @param SearchCriteriaInterface $searchCriteria | ||
* @return AgreementSearchResultsInterface | ||
* @throws LocalizedException | ||
*/ | ||
public function getList(SearchCriteriaInterface $searchCriteria): AgreementSearchResultsInterface; | ||
|
||
/** | ||
* Delete agreement | ||
* | ||
* @param AgreementInterface $agreement | ||
* @return bool true on success | ||
* @throws NoSuchEntityException | ||
* @throws CouldNotDeleteException | ||
*/ | ||
public function delete(AgreementInterface $agreement): bool; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
<?php | ||
/** | ||
* Copyright © OpenGento, All rights reserved. | ||
* See LICENSE bundled with this library for license details. | ||
*/ | ||
declare(strict_types=1); | ||
|
||
namespace Opengento\Gdpr\Api\Data; | ||
|
||
use Magento\Framework\Api\ExtensibleDataInterface; | ||
|
||
/** | ||
* @api | ||
*/ | ||
interface AgreementInterface extends ExtensibleDataInterface | ||
{ | ||
/** | ||
* Constants for fields keys | ||
*/ | ||
public const ID = 'agreement_id'; | ||
public const IDENTIFIER = 'identifier'; | ||
public const IS_ACTIVE = 'is_active'; | ||
public const IS_MANDATORY = 'is_mandatory'; | ||
public const TITLE = 'title'; | ||
public const LABEL = 'label'; | ||
public const CONTENT = 'content'; | ||
|
||
public function getAgreementId(): int; | ||
|
||
public function setAgreementId(int $agreementId): AgreementInterface; | ||
|
||
public function getIdentifier(): string; | ||
|
||
public function setIdentifier(string $identifier): AgreementInterface; | ||
|
||
public function getIsActive(): bool; | ||
|
||
public function setIsActive(bool $isActive): AgreementInterface; | ||
|
||
public function getIsMandatory(): bool; | ||
|
||
public function setIsMandatory(bool $isMandatory): AgreementInterface; | ||
|
||
public function getTitle(): string; | ||
|
||
public function setTitle(string $title): AgreementInterface; | ||
|
||
public function getLabel(): string; | ||
|
||
public function setLabel(string $label): AgreementInterface; | ||
|
||
public function getContent(): string; | ||
|
||
public function setContent(string $content): AgreementInterface; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<?php | ||
/** | ||
* Copyright © OpenGento, All rights reserved. | ||
* See LICENSE bundled with this library for license details. | ||
*/ | ||
declare(strict_types=1); | ||
|
||
namespace Opengento\Gdpr\Api\Data; | ||
|
||
use Magento\Framework\Api\SearchResultsInterface; | ||
|
||
/** | ||
* @api | ||
*/ | ||
interface AgreementSearchResultsInterface extends SearchResultsInterface | ||
{ | ||
/** | ||
* Retrieve the agreement entities list | ||
* | ||
* @return AgreementInterface[] | ||
*/ | ||
public function getItems(): array; | ||
|
||
/** | ||
* Set the agreement entity list | ||
* | ||
* @param AgreementInterface[] $items | ||
* @return AgreementSearchResultsInterface | ||
*/ | ||
public function setItems(array $items): AgreementSearchResultsInterface; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
<?php | ||
/** | ||
* Copyright © OpenGento, All rights reserved. | ||
* See LICENSE bundled with this library for license details. | ||
*/ | ||
declare(strict_types=1); | ||
|
||
namespace Opengento\Gdpr\Api\Data; | ||
|
||
use Magento\Framework\Api\ExtensibleDataInterface; | ||
|
||
/** | ||
* @api | ||
*/ | ||
interface ConsentInterface extends ExtensibleDataInterface | ||
{ | ||
/** | ||
* Constants for fields keys | ||
*/ | ||
public const ID = 'consent_id'; | ||
public const AGREEMENT_IDENTIFIER = 'agreement_identifier'; | ||
public const IS_APPROVED = 'is_approved'; | ||
public const IS_OUTDATED = 'is_outdated'; //todo when it's outdated or the agreement has been modified | ||
public const SUBMITTED_AT = 'submitted_at'; | ||
|
||
public function getConsentId(): int; | ||
|
||
public function setConsentId(int $consentId): ConsentInterface; | ||
|
||
public function getAgreementIdentifier(): string; | ||
|
||
public function setAgreementIdentifier(string $agreementIdentifier): ConsentInterface; | ||
|
||
public function isApproved(): bool; | ||
|
||
public function setIsApproved(bool $isApproved): ConsentInterface; | ||
|
||
public function isOutDated(): bool; | ||
|
||
public function setIsOutDated(bool $isOutDated): ConsentInterface; | ||
|
||
public function getSubmittedAt(): string; | ||
|
||
public function setSubmittedAt(string $submittedAt): ConsentInterface; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
<?php | ||
/** | ||
* Copyright © OpenGento, All rights reserved. | ||
* See LICENSE bundled with this library for license details. | ||
*/ | ||
declare(strict_types=1); | ||
|
||
namespace Opengento\Gdpr\Model; | ||
|
||
use Magento\Framework\Model\AbstractExtensibleModel; | ||
use Opengento\Gdpr\Api\Data\ConsentInterface; | ||
|
||
abstract class AbstractConsent extends AbstractExtensibleModel implements ConsentInterface | ||
{ | ||
public function getConsentId(): int | ||
{ | ||
return (int) $this->_getData(self::ID); | ||
} | ||
|
||
public function setConsentId(int $consentId): ConsentInterface | ||
{ | ||
return $this->setData(self::ID, $consentId); | ||
} | ||
|
||
public function getAgreementIdentifier(): string | ||
{ | ||
return (string) $this->_getData(self::AGREEMENT_IDENTIFIER); | ||
} | ||
|
||
public function setAgreementIdentifier(string $agreementIdentifier): ConsentInterface | ||
{ | ||
return $this->setData(self::AGREEMENT_IDENTIFIER, $agreementIdentifier); | ||
} | ||
|
||
public function isApproved(): bool | ||
{ | ||
return (bool) $this->_getData(self::IS_APPROVED); | ||
} | ||
|
||
public function setIsApproved(bool $isApproved): ConsentInterface | ||
{ | ||
return $this->setData(self::IS_APPROVED, $isApproved); | ||
} | ||
|
||
public function isOutDated(): bool | ||
{ | ||
return (bool) $this->_getData(self::IS_OUTDATED); | ||
} | ||
|
||
public function setIsOutDated(bool $isOutDated): ConsentInterface | ||
{ | ||
return $this->setData(self::IS_OUTDATED, $isOutDated); | ||
} | ||
|
||
public function getSubmittedAt(): string | ||
{ | ||
return (string) $this->_getData(self::SUBMITTED_AT); | ||
} | ||
|
||
public function setSubmittedAt(string $submittedAt): ConsentInterface | ||
{ | ||
return $this->setData(self::SUBMITTED_AT, $submittedAt); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters